Skip to content

Commit a9c5792

Browse files
committed
list: added first two document types to tags
1 parent 2ce53a5 commit a9c5792

8 files changed

Lines changed: 98 additions & 50 deletions

File tree

vis/js/default-config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ var config = {
230230
backlink_list_streamgraph: "← Show all documents",
231231
backlink_list_streamgraph_stream_selected: "← Show all documents in stream",
232232
keywords: "Keywords",
233+
doctypes: "Document type(s)",
234+
unknown: "Unknown",
233235
no_keywords: "not available",
234236
not_available: "not available",
235237
no_title: "No title",
@@ -426,6 +428,8 @@ var config = {
426428
backlink: "← Back to overview",
427429
backlink_list: "← Show all documents in area",
428430
keywords: "Keywords",
431+
doctypes: "Document type(s)",
432+
unknown: "Unknown",
429433
no_keywords: "not available",
430434
not_available: "not available",
431435
no_title: "No title",
@@ -490,6 +494,8 @@ var config = {
490494
backlink_list_streamgraph: "← Show all documents",
491495
backlink_list_streamgraph_stream_selected: "← Show all documents in stream",
492496
keywords: "Keywords",
497+
doctypes: "Document type(s)",
498+
unknown: "Unknown",
493499
no_keywords: "not available",
494500
not_available: "not available",
495501
no_title: "No title",
@@ -573,6 +579,8 @@ var config = {
573579
backlink: "← Back to overview",
574580
backlink_list: "← Show all documents in area",
575581
keywords: "Keywords",
582+
doctypes: "Document type(s)",
583+
unknown: "Unknown",
576584
no_keywords: "not available",
577585
not_available: "not available",
578586
no_title: "No title",
@@ -669,6 +677,8 @@ var config = {
669677
backlink: "← Zurück zur Übersicht",
670678
backlink_list: "← Zeige alle Themen im Themenfeld",
671679
keywords: "Keywords",
680+
doctypes: "Document type(s)",
681+
unknown: "Unknown",
672682
no_keywords: "nicht vorhanden",
673683
not_available: "nicht vorhanden",
674684
no_title: "Kein Titel",
@@ -732,6 +742,8 @@ var config = {
732742
backlink: "← Zurück zur Übersicht",
733743
backlink_list: "← Zeige alle Themen im Themenfeld",
734744
keywords: "Keywords",
745+
doctypes: "Document type(s)",
746+
unknown: "Unknown",
735747
no_keywords: "nicht vorhanden",
736748
not_available: "nicht vorhanden",
737749
no_title: "Kein Titel",
@@ -795,6 +807,8 @@ var config = {
795807
backlink: "← Back to overview",
796808
backlink_list: "← Show all topics in area",
797809
keywords: "Keywords",
810+
doctypes: "Document type(s)",
811+
unknown: "Unknown",
798812
no_keywords: "not available",
799813
not_available: "not available",
800814
no_title: "No title",
@@ -855,6 +869,8 @@ var config = {
855869
backlink_list_streamgraph: "← Show all documents",
856870
backlink_list_streamgraph_stream_selected: "← Show all documents in stream",
857871
keywords: "Keywords",
872+
doctypes: "Document type(s)",
873+
unknown: "Unknown",
858874
no_keywords: "not available",
859875
not_available: "not available",
860876
no_title: "No title",

vis/js/templates/listentry/AccessIcons.jsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
11
import React from "react";
22

33
import Highlight from "../../components/Highlight";
4+
import Tags from "./Tags";
5+
6+
const datasetPredicate = (e) => e.toLowerCase() === "dataset";
7+
const unknownPredicate = (e) => e.toLowerCase().includes("unknown");
8+
9+
const AccessIcons = ({ paper, showDocTypes }) => {
10+
const isDataset = paper.resulttype.some(datasetPredicate);
11+
12+
const tags = [...paper.tags];
13+
if (showDocTypes) {
14+
tags.push(
15+
...paper.resulttype
16+
.filter((e) => !datasetPredicate(e))
17+
.filter((e) => !unknownPredicate(e))
18+
.slice(0, isDataset ? 1 : 2)
19+
);
20+
}
421

5-
const AccessIcons = ({ isOpenAccess, isFreeAccess, isDataset, tags }) => {
622
return (
723
// html template starts here
824
<div id="oa">
9-
{!!isOpenAccess && (
25+
{!!paper.oa && (
1026
<span className="paper-tag open-access-tag">
1127
<span className="access_icon outlink_symbol">
1228
<i className="fas fa-lock-open"></i>
1329
</span>
1430
<Highlight>open access</Highlight>
1531
</span>
1632
)}
17-
{!!isFreeAccess && (
33+
{!!paper.free_access && (
1834
<span className="paper-tag free-access-tag">
1935
<span className="access_icon outlink_symbol">
2036
<i className="fas fa-lock-open"></i>
2137
</span>
2238
<Highlight>free access</Highlight>
2339
</span>
2440
)}
25-
{!!isDataset && (
41+
{isDataset && (
2642
<span className="paper-tag dataset-tag">
27-
<span className="fa fa-database access_icon"></span>
43+
<span className="fas fa-database access_icon"></span>
2844
<Highlight>dataset</Highlight>
2945
</span>
3046
)}
31-
{tags}
47+
{tags.length > 0 && <Tags values={tags} />}
3248
</div>
3349
// html template ends here
3450
);

vis/js/templates/listentry/Area.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ const Area = ({
3535
return (
3636
// html template starts here
3737
<div
38-
id="list_area"
39-
className={isShort ? "short" : undefined}
38+
className={"list_row list_area" + (isShort ? " short" : "")}
4039
onClick={handleClick}
4140
onMouseOver={handleMouseOver}
4241
onMouseOut={handleAreaMouseout}
4342
>
44-
<span className="area_tag">{localization.area}:</span>{" "}
43+
<span className="list_row_label">{localization.area}: </span>
4544
<span className="area_name" title={paper.area}>
4645
{paper.area}
4746
</span>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
3+
import { useLocalizationContext } from "../../components/LocalizationProvider";
4+
import Highlight from "../../components/Highlight";
5+
6+
const Keywords = ({ types }) => {
7+
const loc = useLocalizationContext();
8+
9+
const typesString = types.length > 0 ? types.join(", ") : loc.unknown;
10+
11+
return (
12+
// html template starts here
13+
<div className="list_row">
14+
<span className="list_row_label">{loc.doctypes}: </span>
15+
<span className="list_row_content">
16+
<Highlight queryHighlight>{typesString}</Highlight>
17+
</span>
18+
</div>
19+
// html template ends here
20+
);
21+
};
22+
23+
export default Keywords;

vis/js/templates/listentry/Keywords.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const Keywords = ({ children: text }) => {
88

99
return (
1010
// html template starts here
11-
<div id="list_keywords" style={{ display: "block" }}>
12-
<span className="keyword_tag">{localization.keywords}: </span>
13-
<span className="keywords">
11+
<div className="list_row">
12+
<span className="list_row_label">{localization.keywords}: </span>
13+
<span className="list_row_content">
1414
<Highlight queryHighlight>{text}</Highlight>
1515
</span>
1616
</div>

vis/js/templates/listentry/StandardListEntry.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import Area from "./Area";
1111
import Citations from "./Citations";
1212
import Comments from "./Comments";
1313
import Details from "./Details";
14+
import DocTypesRow from "./DocTypesRow";
1415
import DocumentType from "./DocumentType";
1516
import EntryBacklink from "./EntryBacklink";
1617
import Keywords from "./Keywords";
1718
import Link from "./Link";
1819
import Metrics from "./Metrics";
19-
import Tags from "./Tags";
2020
import Title from "./Title";
2121

2222
/**
@@ -34,6 +34,8 @@ const StandardListEntry = ({
3434
isStreamgraph,
3535
showBacklink,
3636
isInStreamBacklink,
37+
showDocTags,
38+
showAllDocTypes,
3739
// event handlers
3840
handleBacklinkClick,
3941
}) => {
@@ -56,12 +58,7 @@ const StandardListEntry = ({
5658
<div className="list_entry">
5759
<a className="list_anchor" id={paper.safe_id}></a>
5860
<div className="list_metadata">
59-
<AccessIcons
60-
isOpenAccess={!!paper.oa}
61-
isFreeAccess={!!paper.free_access}
62-
isDataset={paper.resulttype.includes("dataset")}
63-
tags={paper.tags.length > 0 ? <Tags values={paper.tags} /> : null}
64-
/>
61+
<AccessIcons paper={paper} showDocTypes={showDocTags} />
6562
<Title paper={paper} />
6663
<Details authors={paper.authors_list} source={paper.published_in} />
6764
<Link
@@ -75,6 +72,7 @@ const StandardListEntry = ({
7572
<Abstract text={paper.paper_abstract} />
7673
{paper.comments.length > 0 && <Comments items={paper.comments} />}
7774
{showKeywords && <Keywords>{paper.keywords}</Keywords>}
75+
{showAllDocTypes && <DocTypesRow types={paper.resulttype} />}
7876
{showMetrics && (
7977
<Metrics
8078
citations={paper.citation_count}
@@ -109,6 +107,8 @@ const mapStateToProps = (state) => ({
109107
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
110108
showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
111109
isInStreamBacklink: !!state.selectedBubble,
110+
showDocTags: state.service === "base",
111+
showAllDocTypes: state.service === "base" && !!state.selectedPaper,
112112
});
113113

114114
export default connect(

vis/stylesheets/base/_colors.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ $list_show_hide_button: #2d3e52; //#5c6d7f;
2929
$highlight-searchterm: #eff3f4;
3030
$modal-title: #2d3e52;
3131
$area-title-h2: #333;
32+
$tag-color: #333;
3233

3334
// Additional colors for buttons etc.
3435
$okm-modal-btn: #2d3e52;
@@ -74,6 +75,7 @@ $highlight: #e1e5e5;
7475
$infolink: #444444;
7576
$framed-item: #3696e0;
7677
$dataset: #444444;
78+
$tag-color: $dataset;
7779
}
7880

7981
@if $skin == 'cris_vis' {
@@ -125,6 +127,7 @@ $highlight: #e1e5e5;
125127
$infolink: #1e6662;
126128
$modal-title: $medium-blue;
127129
$area-title-h2: $okm-blue;
130+
$tag-color: $medium-blue;
128131
}
129132

130133
@if $skin == 'triple' {

0 commit comments

Comments
 (0)