From 94b73c85b0df8dc1df5d5ea1532c59703f24b974 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 15 Nov 2021 16:47:02 +0100
Subject: [PATCH 01/34] replaced the More info button
---
vis/js/components/ContextLine.js | 2 +
vis/js/components/Heading.js | 48 +-----------
vis/js/default-config.js | 20 ++---
vis/js/templates/ZoomedOutHeading.jsx | 73 ++++++++++++-------
.../contextfeatures/MoreInfoLink.jsx | 38 ++++++++++
vis/stylesheets/modules/map/_header.scss | 6 ++
6 files changed, 101 insertions(+), 86 deletions(-)
create mode 100644 vis/js/templates/contextfeatures/MoreInfoLink.jsx
diff --git a/vis/js/components/ContextLine.js b/vis/js/components/ContextLine.js
index b6ae97b53..4c90a3858 100644
--- a/vis/js/components/ContextLine.js
+++ b/vis/js/components/ContextLine.js
@@ -18,6 +18,7 @@ import Timestamp from "../templates/contextfeatures/Timestamp";
import MetadataQuality from "../templates/contextfeatures/MetadataQuality";
import Modifier from "../templates/contextfeatures/Modifier";
import { trackMatomoEvent } from "../utils/useMatomo";
+import MoreInfoLink from "../templates/contextfeatures/MoreInfoLink";
const defined = (param) => param !== undefined && param !== null;
@@ -87,6 +88,7 @@ class ContextLine extends React.Component {
{defined(params.searchLanguage) && (
{params.searchLanguage}
)}
+
);
}
diff --git a/vis/js/components/Heading.js b/vis/js/components/Heading.js
index 585086b9d..d1b723064 100644
--- a/vis/js/components/Heading.js
+++ b/vis/js/components/Heading.js
@@ -4,8 +4,6 @@ import { connect } from "react-redux";
import ZoomedInHeadingTemplate from "../templates/ZoomedInHeading";
import ZoomedOutHeadingTemplate from "../templates/ZoomedOutHeading";
-import { changeFile, openInfoModal } from "../actions/index";
-
import {
BasicTitle,
ProjectTitle,
@@ -21,10 +19,7 @@ const Heading = ({
query,
bubbleTitle,
headingParams,
- files,
- onFileChange,
streamgraph,
- onInfoModalOpen,
}) => {
if (zoomed) {
let label = streamgraph ? localization.area_streamgraph : localization.area;
@@ -33,16 +28,7 @@ const Heading = ({
}
return (
-
+
{renderTitle(localization, query, headingParams)}
);
@@ -54,16 +40,10 @@ const mapStateToProps = (state) => ({
query: state.query.text,
bubbleTitle: state.selectedBubble ? state.selectedBubble.title : null,
headingParams: state.heading,
- files: state.files,
streamgraph: state.chartType === STREAMGRAPH_MODE,
});
-const mapDispatchToProps = (dispatch) => ({
- onFileChange: (fileIndex) => dispatch(changeFile(fileIndex)),
- onInfoModalOpen: () => dispatch(openInfoModal()),
-});
-
-export default connect(mapStateToProps, mapDispatchToProps)(Heading);
+export default connect(mapStateToProps)(Heading);
// This should probably make its way to a more global config
const MAX_LENGTH_VIPER = 47;
@@ -198,27 +178,3 @@ const unescapeHTML = (string) => {
}
);
};
-
-const renderAdditionalFeatures = ({ showDropdown }, files, onFileChange) => {
- if (showDropdown && files.list.length > 0) {
- const handleChange = (e) => {
- onFileChange(parseInt(e.target.value));
- };
-
- return (
- <>
- {" "}
- Select dataset:{" "}
-
- {files.list.map((entry, index) => (
-
- {entry.title}
-
- ))}
-
- >
- );
- }
-
- return null;
-};
diff --git a/vis/js/default-config.js b/vis/js/default-config.js
index 81423a107..39ad8568e 100644
--- a/vis/js/default-config.js
+++ b/vis/js/default-config.js
@@ -223,8 +223,7 @@ var config = {
search_placeholder: "Search within map...",
show_list: "Show list",
hide_list: "Hide list",
- intro_label: "",
- intro_icon: "",
+ intro_label: "More information",
readers: "readers",
year: "date",
authors: "authors",
@@ -293,8 +292,7 @@ var config = {
search_placeholder: "Suche in der Liste...",
show_list: "Liste ausklappen",
hide_list: "Liste einklappen",
- intro_label: "",
- intro_icon: "",
+ intro_label: "Mehr Informationen",
readers: "Leser",
year: "Jahr",
authors: "Autor",
@@ -362,8 +360,7 @@ var config = {
search_placeholder: "Suche in der Liste...",
show_list: "Liste ausklappen",
hide_list: "Liste einklappen",
- intro_label: "",
- intro_icon: "",
+ intro_label: "Mehr Informationen",
readers: "Leser",
year: "Jahr",
authors: "Autor",
@@ -434,8 +431,7 @@ var config = {
search_placeholder: "Search within map...",
show_list: "Show list",
hide_list: "Hide list",
- intro_label: "",
- intro_icon: "",
+ intro_label: "More information",
readers: "views",
year: "date",
authors: "authors",
@@ -496,8 +492,7 @@ var config = {
search_placeholder: "Search within map...",
show_list: "Show list",
hide_list: "Hide list",
- intro_label: "",
- intro_icon: "",
+ intro_label: "More information",
relevance: "relevance",
readers: "citations",
year: "year",
@@ -579,7 +574,6 @@ var config = {
show_list: "Show list",
hide_list: "Hide list",
intro_label: "more info",
- intro_icon: "",
relevance: "relevance",
readers: "readers",
tweets: "tweets",
@@ -667,7 +661,6 @@ var config = {
show_list: "Liste ausklappen",
hide_list: "Liste einklappen",
intro_label: "mehr Informationen",
- intro_icon: "",
intro_label_areas: "Verteilung der Respondenten",
intro_areas_title: "Verteilung der Respondenten für ",
readers: "Nennungen",
@@ -730,7 +723,6 @@ var config = {
show_list: "Liste ausklappen",
hide_list: "Liste einklappen",
intro_label: "mehr Informationen",
- intro_icon: "",
intro_label_areas: "Verteilung der Respondenten",
intro_areas_title: "Verteilung der Respondenten für ",
readers: "Anzahl Fragen",
@@ -793,7 +785,6 @@ var config = {
show_list: "Show list",
hide_list: "Hide list",
intro_label: "more information",
- intro_icon: "",
intro_label_areas: "Distribution of respondents",
intro_areas_title: "Distribution of respondents for ",
readers: "no. questions",
@@ -860,7 +851,6 @@ var config = {
show_list: "Show list",
hide_list: "Hide list",
intro_label: "[more info]",
- intro_icon: "",
relevance: "relevance",
readers: "citations",
year: "date",
diff --git a/vis/js/templates/ZoomedOutHeading.jsx b/vis/js/templates/ZoomedOutHeading.jsx
index c39c0523b..74de4ac52 100644
--- a/vis/js/templates/ZoomedOutHeading.jsx
+++ b/vis/js/templates/ZoomedOutHeading.jsx
@@ -1,44 +1,67 @@
import React from "react";
-import useMatomo from "../utils/useMatomo";
+import { connect } from "react-redux";
+
+import { changeFile, openInfoModal } from "../actions";
const ZoomedOutHeading = ({
- introIcon,
- introLabel,
children: title,
- additionalFeatures,
+ infoButton,
+ filesDropdown,
onInfoClick,
+ onFileChange,
}) => {
- const { trackEvent } = useMatomo();
-
- const handleInfoClick = (event) => {
- event.preventDefault();
-
- trackEvent("Title & Context line", "Open more info modal", "More info button");
-
- if (onInfoClick) {
- onInfoClick();
- }
- };
-
return (
// html template starts here
{title}
- {!!onInfoClick && (
-
- {" "}
- {introLabel}
+ {infoButton.show && (
+
+
+
+ {" "}
)}
- {additionalFeatures}
+ {filesDropdown.show && (
+ <>
+ {" "}
+ Select dataset:{" "}
+ onFileChange(parseInt(e.target.value))}
+ >
+ {filesDropdown.files.list.map((entry, index) => (
+
+ {entry.title}
+
+ ))}
+
+ >
+ )}
// html template ends here
);
};
-export default ZoomedOutHeading;
+const mapStateToProps = (state) => ({
+ infoButton: {
+ show: !state.contextLine.show,
+ },
+ filesDropdown: {
+ show: state.heading.showDropdown,
+ files: state.files,
+ },
+});
+
+const mapDispatchToProps = (dispatch) => ({
+ onInfoClick: () => dispatch(openInfoModal()),
+ onFileChange: (fileIndex) => dispatch(changeFile(fileIndex)),
+});
+
+export default connect(mapStateToProps, mapDispatchToProps)(ZoomedOutHeading);
diff --git a/vis/js/templates/contextfeatures/MoreInfoLink.jsx b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
new file mode 100644
index 000000000..ec57661bd
--- /dev/null
+++ b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
@@ -0,0 +1,38 @@
+import React from "react";
+import { connect } from "react-redux";
+
+import useMatomo from "../../utils/useMatomo";
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { openInfoModal } from "../../actions";
+
+const MoreInfoLink = ({ onClick }) => {
+ const loc = useLocalizationContext();
+ const { trackEvent } = useMatomo();
+
+ const handleClick = () => {
+ onClick();
+
+ trackEvent(
+ "Title & Context line",
+ "Open more info modal",
+ "More info button"
+ );
+ };
+
+ return (
+ // html template starts here
+
+
+ {loc.intro_label}
+
+
+
+ // html template ends here
+ );
+};
+
+const mapDispatchToProps = (dispatch) => ({
+ onClick: () => dispatch(openInfoModal()),
+});
+
+export default connect(null, mapDispatchToProps)(MoreInfoLink);
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 7c8e25a77..319283fa1 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -59,6 +59,12 @@
#context {
font-size: 11px;
color: $black;
+ button {
+ background: none!important;
+ border: none;
+ padding: 0!important;
+ cursor: pointer!important;
+ }
.context_moreinfo {
border-bottom: 1px solid $medium-blue;
cursor: help;
From 1313fc779f0cc8daeb619316dfd5df91157524dd Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 15 Nov 2021 16:51:16 +0100
Subject: [PATCH 02/34] searchbox: map -> visualization
---
vis/js/default-config.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/vis/js/default-config.js b/vis/js/default-config.js
index 39ad8568e..2c136ad0d 100644
--- a/vis/js/default-config.js
+++ b/vis/js/default-config.js
@@ -220,7 +220,7 @@ var config = {
localization: {
eng: {
loading: "Loading...",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "More information",
@@ -428,7 +428,7 @@ var config = {
},
eng_plos: {
loading: "Loading...",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "More information",
@@ -489,7 +489,7 @@ var config = {
},
eng_pubmed: {
loading: "Loading knowledge map.",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "More information",
@@ -570,7 +570,7 @@ var config = {
},
eng_openaire: {
loading: "Loading...",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "more info",
@@ -781,7 +781,7 @@ var config = {
},
eng_cris_2: {
loading: "Loading...",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "more information",
@@ -847,7 +847,7 @@ var config = {
},
eng_gsheets: {
loading: "Updating and retrieving map. This may take a few seconds, please hold on.",
- search_placeholder: "Search within map...",
+ search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
intro_label: "[more info]",
From 4d00dd7db9e9b6334473962bfc5b71f52f72ff7c Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Tue, 16 Nov 2021 11:34:44 +0100
Subject: [PATCH 03/34] fixed failing tests
---
vis/test/component/contextline.test.js | 74 +-
vis/test/component/heading.test.js | 985 ++++++++++--------
vis/test/component/knowledgemap-base.test.js | 2 +-
vis/test/component/knowledgemap.test.js | 1 +
vis/test/component/list-base.test.js | 4 +-
vis/test/component/list.test.js | 22 +-
.../__snapshots__/contextline.test.js.snap | 97 +-
.../__snapshots__/list-base.test.js.snap | 31 +
vis/test/store/selectedPaper.test.js | 1 +
vis/test/store/zoom.test.js | 1 +
10 files changed, 729 insertions(+), 489 deletions(-)
diff --git a/vis/test/component/contextline.test.js b/vis/test/component/contextline.test.js
index f4c4804c3..3db0767fa 100644
--- a/vis/test/component/contextline.test.js
+++ b/vis/test/component/contextline.test.js
@@ -9,6 +9,7 @@ import { Provider } from "react-redux";
import ContextLine from "../../js/components/ContextLine";
import LocalizationProvider from "../../js/components/LocalizationProvider";
import { STREAMGRAPH_MODE } from "../../js/reducers/chartType";
+import { openInfoModal } from "../../js/actions";
const mockStore = configureStore([]);
const setup = (overrideStoreObject = {}) => {
@@ -528,13 +529,11 @@ describe("Context line component", () => {
act(() => {
render(
-
-
-
-
-
-
- ,
+
+
+
+
+ ,
container
);
});
@@ -553,13 +552,11 @@ describe("Context line component", () => {
act(() => {
render(
-
-
-
-
-
-
- ,
+
+
+
+
+ ,
container
);
});
@@ -877,7 +874,9 @@ describe("Context line component", () => {
act(() => {
render(
-
+
+
+
,
container
);
@@ -1005,7 +1004,9 @@ describe("Context line component", () => {
act(() => {
render(
-
+
+
+
,
container
);
@@ -1035,7 +1036,9 @@ describe("Context line component", () => {
act(() => {
render(
-
+
+
+
,
container
);
@@ -1065,7 +1068,9 @@ describe("Context line component", () => {
act(() => {
render(
-
+
+
+
,
container
);
@@ -1095,7 +1100,9 @@ describe("Context line component", () => {
act(() => {
render(
-
+
+
+
,
container
);
@@ -1113,6 +1120,35 @@ describe("Context line component", () => {
storeObject.localization[`${QUALITY}_metadata_quality_desc_${SERVICE}`]
);
});
+
+ it("triggers a correct redux action when info icon is clicked", () => {
+ const SERVICE = "pubmed";
+ const storeObject = setup({ service: SERVICE });
+
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+
+
+ ,
+ container
+ );
+ });
+
+ const select = document.querySelector("#more-info-link button");
+ act(() => {
+ const event = new Event("click", { bubbles: true });
+ select.dispatchEvent(event);
+ });
+
+ const actions = store.getActions();
+ const expectedPayload = openInfoModal()
+
+ expect(actions).toEqual([expectedPayload]);
+ });
});
});
diff --git a/vis/test/component/heading.test.js b/vis/test/component/heading.test.js
index 5ead0a03c..e7e3821bf 100644
--- a/vis/test/component/heading.test.js
+++ b/vis/test/component/heading.test.js
@@ -1,6 +1,7 @@
import React from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { act } from "react-dom/test-utils";
+import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
@@ -15,6 +16,9 @@ const setup = (overrideStore = {}) => {
{
zoom: false,
query: { text: "", parsedTerms: [] }, // context.query
+ contextLine: {
+ show: true,
+ },
heading: {
title: "Sample title", // context.params.title
acronym: "Sample acronym", // context.params.acronym
@@ -66,7 +70,12 @@ describe("Heading component", () => {
it("renders", () => {
const { store } = setup({ zoom: true });
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.childNodes.length).toBe(1);
@@ -87,7 +96,12 @@ describe("Heading component", () => {
const store = mockStore(storeObject);
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.querySelector("#area-bold").textContent).toContain(
@@ -100,7 +114,12 @@ describe("Heading component", () => {
const { store } = setup({ zoom: true, selectedBubble: { title: TITLE } });
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.querySelector("#area-not-bold").textContent).toEqual(
@@ -117,7 +136,12 @@ describe("Heading component", () => {
});
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.querySelector("#area-not-bold").textContent).toEqual(
@@ -136,7 +160,12 @@ describe("Heading component", () => {
const store = mockStore(storeObject);
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.querySelector("h4").textContent).toContain(TITLE);
@@ -149,571 +178,643 @@ describe("Heading component", () => {
const store = mockStore(storeObject);
act(() => {
- render( , container);
+ render(
+
+
+ ,
+ container
+ );
});
expect(container.querySelector("h4").textContent).toContain(TITLE);
});
- // TODO test not needed with proper localization
- it("renders with an infolink label", () => {
- const LABEL = "Special test label";
- const { storeObject } = setup();
- storeObject.heading.presetTitle = "Some title...";
- storeObject.localization.intro_label = LABEL;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
- });
+ describe("viper", () => {
+ const setupViper = () => {
+ const { storeObject } = setup();
+ storeObject.heading.titleStyle = "viper";
- expect(container.querySelector("#infolink").textContent).toContain(
- LABEL
- );
- });
+ const store = mockStore(storeObject);
- // TODO test not needed with proper localization
- it("renders with an infolink icon", () => {
- const ICON = "ABC";
- const { storeObject } = setup();
- storeObject.heading.presetTitle = "Some title...";
- storeObject.localization.intro_icon = ICON;
- const store = mockStore(storeObject);
+ return { store, storeObject };
+ };
- act(() => {
- render( , container);
+ it("renders with correct title", () => {
+ const TITLE = "Special Test Title";
+
+ const { storeObject } = setupViper();
+ storeObject.heading.title = TITLE;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("span.truncated-project-title").textContent
+ ).toContain(TITLE);
});
- expect(container.querySelector("#whatsthis").textContent).toContain(
- ICON
- );
- });
- });
-
- describe("viper", () => {
- const setupViper = () => {
- const { storeObject } = setup();
- storeObject.heading.titleStyle = "viper";
-
- const store = mockStore(storeObject);
-
- return { store, storeObject };
- };
-
- it("renders with correct title", () => {
- const TITLE = "Special Test Title";
-
- const { storeObject } = setupViper();
- storeObject.heading.title = TITLE;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders with correct title attribute", () => {
+ const TITLE = "Special Test Title";
+
+ const { storeObject } = setupViper();
+ storeObject.heading.title = TITLE;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container
+ .querySelector("span.truncated-project-title")
+ .getAttribute("title")
+ ).toContain(TITLE);
});
- expect(
- container.querySelector("span.truncated-project-title").textContent
- ).toContain(TITLE);
- });
-
- it("renders with correct title attribute", () => {
- const TITLE = "Special Test Title";
-
- const { storeObject } = setupViper();
- storeObject.heading.title = TITLE;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders with correct acronym", () => {
+ const ACRONYM = "Special Test Acronym";
+
+ const { storeObject } = setupViper();
+ storeObject.heading.acronym = ACRONYM;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("span.truncated-project-title").textContent
+ ).toContain(ACRONYM);
});
- expect(
- container
- .querySelector("span.truncated-project-title")
- .getAttribute("title")
- ).toContain(TITLE);
- });
-
- it("renders with correct acronym", () => {
- const ACRONYM = "Special Test Acronym";
-
- const { storeObject } = setupViper();
- storeObject.heading.acronym = ACRONYM;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders without acronym", () => {
+ const TITLE = "Special Test Title";
+
+ const { storeObject } = setupViper();
+ storeObject.heading.title = TITLE;
+ delete storeObject.heading.acronym;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("span.truncated-project-title").textContent
+ ).toEqual(TITLE);
});
- expect(
- container.querySelector("span.truncated-project-title").textContent
- ).toContain(ACRONYM);
- });
-
- it("renders without acronym", () => {
- const TITLE = "Special Test Title";
-
- const { storeObject } = setupViper();
- storeObject.heading.title = TITLE;
- delete storeObject.heading.acronym;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders with correct project id", () => {
+ const ID = 42069;
+
+ const { storeObject } = setupViper();
+ storeObject.heading.projectId = ID;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("span.project-id").textContent
+ ).toEqual(`(${ID})`);
});
- expect(
- container.querySelector("span.truncated-project-title").textContent
- ).toEqual(TITLE);
- });
-
- it("renders with correct project id", () => {
- const ID = 42069;
-
- const { storeObject } = setupViper();
- storeObject.heading.projectId = ID;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders with correct but long title", () => {
+ const TITLE = "Special Test Title".repeat(100);
+
+ const { storeObject } = setupViper();
+ storeObject.heading.title = TITLE;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("span.truncated-project-title").textContent
+ ).toContain("...");
});
- expect(container.querySelector("span.project-id").textContent).toEqual(
- `(${ID})`
- );
- });
-
- it("renders with correct but long title", () => {
- const TITLE = "Special Test Title".repeat(100);
-
- const { storeObject } = setupViper();
- storeObject.heading.title = TITLE;
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ it("renders with correct but long title attribute", () => {
+ const TITLE = "Special Test Title".repeat(100);
+
+ const { storeObject } = setupViper();
+ storeObject.heading.title = TITLE;
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container
+ .querySelector("span.truncated-project-title")
+ .getAttribute("title")
+ ).toContain(TITLE);
});
-
- expect(
- container.querySelector("span.truncated-project-title").textContent
- ).toContain("...");
});
- it("renders with correct but long title attribute", () => {
- const TITLE = "Special Test Title".repeat(100);
+ describe("linkedcat", () => {
+ const setupLinkedcat = (overrideStore) => {
+ const { storeObject } = setup();
+ storeObject.heading.titleStyle = "linkedcat";
+ storeObject.query.text = "Some query";
- const { storeObject } = setupViper();
- storeObject.heading.title = TITLE;
- const store = mockStore(storeObject);
+ Object.assign(storeObject, overrideStore);
- act(() => {
- render( , container);
- });
+ const store = mockStore(storeObject);
- expect(
- container
- .querySelector("span.truncated-project-title")
- .getAttribute("title")
- ).toContain(TITLE);
- });
- });
-
- describe("linkedcat", () => {
- const setupLinkedcat = (overrideStore) => {
- const { storeObject } = setup();
- storeObject.heading.titleStyle = "linkedcat";
- storeObject.query.text = "Some query";
-
- Object.assign(storeObject, overrideStore);
-
- const store = mockStore(storeObject);
+ return { store, storeObject };
+ };
- return { store, storeObject };
- };
+ it("renders with correct streamgraph author label", () => {
+ const LABEL = "Special Streamgraph Author Test Label";
- it("renders with correct streamgraph author label", () => {
- const LABEL = "Special Streamgraph Author Test Label";
+ const { storeObject } = setupLinkedcat();
+ storeObject.heading.titleLabelType = "authorview-streamgraph";
+ storeObject.localization.streamgraph_authors_label = LABEL;
- const { storeObject } = setupLinkedcat();
- storeObject.heading.titleLabelType = "authorview-streamgraph";
- storeObject.localization.streamgraph_authors_label = LABEL;
+ const store = mockStore(storeObject);
- const store = mockStore(storeObject);
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(container.querySelector("h4").textContent).toContain(LABEL);
});
- expect(container.querySelector("h4").textContent).toContain(LABEL);
- });
+ it("renders with correct knowledgemap author label", () => {
+ const LABEL = "Special Knowledgemap Author Test Label";
- it("renders with correct knowledgemap author label", () => {
- const LABEL = "Special Knowledgemap Author Test Label";
+ const { storeObject } = setupLinkedcat();
+ storeObject.heading.titleLabelType = "authorview-knowledgemap";
+ storeObject.localization.overview_authors_label = LABEL;
- const { storeObject } = setupLinkedcat();
- storeObject.heading.titleLabelType = "authorview-knowledgemap";
- storeObject.localization.overview_authors_label = LABEL;
+ const store = mockStore(storeObject);
- const store = mockStore(storeObject);
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(container.querySelector("h4").textContent).toContain(LABEL);
});
- expect(container.querySelector("h4").textContent).toContain(LABEL);
- });
+ it("renders with correct streamgraph non-author label", () => {
+ const LABEL = "Special Streamgraph non-Author Test Label";
- it("renders with correct streamgraph non-author label", () => {
- const LABEL = "Special Streamgraph non-Author Test Label";
+ const { storeObject } = setupLinkedcat();
+ storeObject.heading.titleLabelType = "keywordview-streamgraph";
+ storeObject.localization.streamgraph_label = LABEL;
- const { storeObject } = setupLinkedcat();
- storeObject.heading.titleLabelType = "keywordview-streamgraph";
- storeObject.localization.streamgraph_label = LABEL;
+ const store = mockStore(storeObject);
- const store = mockStore(storeObject);
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(container.querySelector("h4").textContent).toContain(LABEL);
});
- expect(container.querySelector("h4").textContent).toContain(LABEL);
- });
+ it("renders with correct knowledgemap non-author label", () => {
+ const LABEL = "Special Knowledgemap non-Author Test Label";
- it("renders with correct knowledgemap non-author label", () => {
- const LABEL = "Special Knowledgemap non-Author Test Label";
+ const { storeObject } = setupLinkedcat();
+ storeObject.heading.titleLabelType = "keywordview-knowledgemap";
+ storeObject.localization.overview_label = LABEL;
- const { storeObject } = setupLinkedcat();
- storeObject.heading.titleLabelType = "keywordview-knowledgemap";
- storeObject.localization.overview_label = LABEL;
+ const store = mockStore(storeObject);
- const store = mockStore(storeObject);
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(container.querySelector("h4").textContent).toContain(LABEL);
});
- expect(container.querySelector("h4").textContent).toContain(LABEL);
- });
+ it("renders with correct query", () => {
+ const QUERY = "Special Test Query";
- it("renders with correct query", () => {
- const QUERY = "Special Test Query";
+ const { store } = setupLinkedcat({ query: { text: QUERY } });
- const { store } = setupLinkedcat({ query: { text: QUERY } });
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toEqual(QUERY);
});
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toEqual(QUERY);
- });
+ it("renders with correct title attribute", () => {
+ const QUERY = "Special Test Query";
- it("renders with correct title attribute", () => {
- const QUERY = "Special Test Query";
+ const { store } = setupLinkedcat({ query: { text: QUERY } });
- const { store } = setupLinkedcat({ query: { text: QUERY } });
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").getAttribute("title")
+ ).toEqual(QUERY);
});
- expect(
- container.querySelector("#search-term-unique").getAttribute("title")
- ).toEqual(QUERY);
- });
+ it("renders with correct but long title", () => {
+ const QUERY = "Special Test Query".repeat(100);
- it("renders with correct but long title", () => {
- const QUERY = "Special Test Query".repeat(100);
+ const { store } = setupLinkedcat({ query: { text: QUERY } });
- const { store } = setupLinkedcat({ query: { text: QUERY } });
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toContain("...");
});
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toContain("...");
- });
+ it("renders with correct but long title attribute", () => {
+ const QUERY = "Special Test Query".repeat(100);
- it("renders with correct but long title attribute", () => {
- const QUERY = "Special Test Query".repeat(100);
+ const { store } = setupLinkedcat({ query: { text: QUERY } });
- const { store } = setupLinkedcat({ query: { text: QUERY } });
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").getAttribute("title")
+ ).toEqual(QUERY);
});
-
- expect(
- container.querySelector("#search-term-unique").getAttribute("title")
- ).toEqual(QUERY);
});
- });
- describe("custom title", () => {
- const setupCustom = (overrideStore) => {
- const { storeObject } = setup();
- storeObject.heading.titleStyle = "custom";
- storeObject.heading.customTitle = "Some title";
- storeObject.localization.custom_title_explanation = "Some explanation";
- storeObject.query.text = "Some query";
-
- Object.assign(storeObject, overrideStore);
+ describe("custom title", () => {
+ const setupCustom = (overrideStore) => {
+ const { storeObject } = setup();
+ storeObject.heading.titleStyle = "custom";
+ storeObject.heading.customTitle = "Some title";
+ storeObject.localization.custom_title_explanation =
+ "Some explanation";
+ storeObject.query.text = "Some query";
- const store = mockStore(storeObject);
+ Object.assign(storeObject, overrideStore);
- return { store, storeObject };
- };
-
- it("renders with correct title", () => {
- const TITLE = "Special Test Title";
+ const store = mockStore(storeObject);
- const { storeObject } = setupCustom();
- storeObject.heading.customTitle = TITLE;
+ return { store, storeObject };
+ };
- const store = mockStore(storeObject);
+ it("renders with correct title", () => {
+ const TITLE = "Special Test Title";
- act(() => {
- render( , container);
- });
+ const { storeObject } = setupCustom();
+ storeObject.heading.customTitle = TITLE;
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toEqual(TITLE);
- });
+ const store = mockStore(storeObject);
- it("renders with correct but too long title", () => {
- const TITLE = "Special Test Title";
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- const { storeObject } = setupCustom();
- storeObject.heading.customTitle = TITLE.repeat(100);
-
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toEqual(TITLE);
});
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toContain(TITLE);
+ it("renders with correct but too long title", () => {
+ const TITLE = "Special Test Title";
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toContain("...");
- });
+ const { storeObject } = setupCustom();
+ storeObject.heading.customTitle = TITLE.repeat(100);
- it("renders with correct explanation", () => {
- const EXPLANATION = "Special Test Explanation";
+ const store = mockStore(storeObject);
- const { storeObject } = setupCustom();
- storeObject.localization.custom_title_explanation = EXPLANATION;
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- const store = mockStore(storeObject);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toContain(TITLE);
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toContain("...");
});
- expect(
- container.querySelector("#search-term-unique").getAttribute("title")
- ).toContain(EXPLANATION);
- });
-
- it("renders with correct query", () => {
- const QUERY = "Special Test Query".repeat(100);
-
- const { store } = setupCustom({ query: { text: QUERY } });
+ it("renders with correct explanation", () => {
+ const EXPLANATION = "Special Test Explanation";
- act(() => {
- render( , container);
- });
+ const { storeObject } = setupCustom();
+ storeObject.localization.custom_title_explanation = EXPLANATION;
- expect(
- container.querySelector("#search-term-unique").getAttribute("title")
- ).toContain(QUERY);
- });
+ const store = mockStore(storeObject);
- // we might add other escaped characters to the test in future
- it("renders with title that contains "", () => {
- const TITLE = "Special "Test" Title";
- const ESCAPED_TITLE = 'Special "Test" Title';
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- const { storeObject } = setupCustom();
- storeObject.heading.customTitle = TITLE;
-
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").getAttribute("title")
+ ).toContain(EXPLANATION);
});
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toEqual(ESCAPED_TITLE);
- });
- });
-
- describe("standard title", () => {
- const setupStandard = (overrideStore) => {
- const { storeObject } = setup(overrideStore);
- storeObject.heading.titleStyle = "standard";
+ it("renders with correct query", () => {
+ const QUERY = "Special Test Query".repeat(100);
- const store = mockStore(storeObject);
+ const { store } = setupCustom({ query: { text: QUERY } });
- return { store, storeObject };
- };
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- it("renders with query as the title", () => {
- const QUERY = "Special Test Query".repeat(100);
-
- const { store } = setupStandard({ query: { text: QUERY } });
-
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").getAttribute("title")
+ ).toContain(QUERY);
});
- expect(
- container.querySelector("#search-term-unique").textContent
- ).toEqual(QUERY);
- });
+ // we might add other escaped characters to the test in future
+ it("renders with title that contains "", () => {
+ const TITLE = "Special "Test" Title";
+ const ESCAPED_TITLE = 'Special "Test" Title';
- it("renders with query as the title's title attribute", () => {
- const QUERY = "Special Test Query".repeat(100);
+ const { storeObject } = setupCustom();
+ storeObject.heading.customTitle = TITLE;
- const { store } = setupStandard({ query: { text: QUERY } });
+ const store = mockStore(storeObject);
- act(() => {
- render( , container);
- });
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- expect(
- container.querySelector("#search-term-unique").getAttribute("title")
- ).toEqual(QUERY);
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toEqual(ESCAPED_TITLE);
+ });
});
- });
- describe("additional features", () => {
- const setupFeatures = () => {
- const { storeObject } = setup();
- storeObject.heading.titleStyle = "standard";
- storeObject.query.text = "Some query";
+ describe("standard title", () => {
+ const setupStandard = (overrideStore) => {
+ const { storeObject } = setup(overrideStore);
+ storeObject.heading.titleStyle = "standard";
- const store = mockStore(storeObject);
+ const store = mockStore(storeObject);
- return { store, storeObject };
- };
-
- const FILES = [
- {
- title: "edu1",
- file: "./data/edu1.csv",
- },
- {
- title: "edu2",
- file: "./data/edu2.csv",
- },
- ];
-
- it("renders with a dropdown", () => {
- const { storeObject } = setupFeatures();
- storeObject.heading.showDropdown = true;
- storeObject.files = {
- current: 0,
- list: FILES,
+ return { store, storeObject };
};
- const store = mockStore(storeObject);
-
- act(() => {
- render( , container);
- });
-
- expect(
- container.querySelector("#datasets").querySelectorAll("option").length
- ).toBe(2);
+ it("renders with query as the title", () => {
+ const QUERY = "Special Test Query".repeat(100);
- expect(
- container.querySelector("#datasets").querySelectorAll("option")[0]
- .textContent
- ).toEqual("edu1");
+ const { store } = setupStandard({ query: { text: QUERY } });
- expect(
- container
- .querySelector("#datasets")
- .querySelectorAll("option")[0]
- .getAttribute("value")
- ).toEqual("0");
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- expect(
- container.querySelector("#datasets").querySelectorAll("option")[1]
- .textContent
- ).toEqual("edu2");
+ expect(
+ container.querySelector("#search-term-unique").textContent
+ ).toEqual(QUERY);
+ });
- expect(
- container
- .querySelector("#datasets")
- .querySelectorAll("option")[1]
- .getAttribute("value")
- ).toEqual("1");
- });
+ it("renders with query as the title's title attribute", () => {
+ const QUERY = "Special Test Query".repeat(100);
- it("triggers a correct redux action when dropdown changes", () => {
- const { storeObject } = setupFeatures();
- storeObject.heading.showDropdown = true;
- storeObject.files = {
- current: 0,
- list: FILES,
- };
+ const { store } = setupStandard({ query: { text: QUERY } });
- const store = mockStore(storeObject);
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
- act(() => {
- render( , container);
+ expect(
+ container.querySelector("#search-term-unique").getAttribute("title")
+ ).toEqual(QUERY);
});
-
- const select = document.querySelector("#datasets");
- act(() => {
- const event = new Event("change", { bubbles: true });
- select.dispatchEvent(event);
- });
-
- const actions = store.getActions();
- const expectedPayload = changeFile(0);
-
- expect(actions).toEqual([expectedPayload]);
});
- it("throws error on unknown label type", () => {
- const { storeObject } = setup();
- const LABEL = "label-that-does-not-exist";
-
- expect(() => getHeadingLabel(LABEL, storeObject.localization)).toThrow(
- Error
- );
- });
+ describe("additional features", () => {
+ const setupFeatures = () => {
+ const { storeObject } = setup();
+ storeObject.heading.titleStyle = "standard";
+ storeObject.query.text = "Some query";
- it("triggers a correct redux action when info icon is clicked", () => {
- const { storeObject } = setupFeatures();
+ const store = mockStore(storeObject);
- const store = mockStore(storeObject);
+ return { store, storeObject };
+ };
- act(() => {
- render( , container);
+ const FILES = [
+ {
+ title: "edu1",
+ file: "./data/edu1.csv",
+ },
+ {
+ title: "edu2",
+ file: "./data/edu2.csv",
+ },
+ ];
+
+ it("renders with a dropdown", () => {
+ const { storeObject } = setupFeatures();
+ storeObject.heading.showDropdown = true;
+ storeObject.files = {
+ current: 0,
+ list: FILES,
+ };
+
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ expect(
+ container.querySelector("#datasets").querySelectorAll("option")
+ .length
+ ).toBe(2);
+
+ expect(
+ container.querySelector("#datasets").querySelectorAll("option")[0]
+ .textContent
+ ).toEqual("edu1");
+
+ expect(
+ container
+ .querySelector("#datasets")
+ .querySelectorAll("option")[0]
+ .getAttribute("value")
+ ).toEqual("0");
+
+ expect(
+ container.querySelector("#datasets").querySelectorAll("option")[1]
+ .textContent
+ ).toEqual("edu2");
+
+ expect(
+ container
+ .querySelector("#datasets")
+ .querySelectorAll("option")[1]
+ .getAttribute("value")
+ ).toEqual("1");
});
- const select = document.querySelector("#infolink");
- act(() => {
- const event = new Event("click", { bubbles: true });
- select.dispatchEvent(event);
+ it("triggers a correct redux action when dropdown changes", () => {
+ const { storeObject } = setupFeatures();
+ storeObject.heading.showDropdown = true;
+ storeObject.files = {
+ current: 0,
+ list: FILES,
+ };
+
+ const store = mockStore(storeObject);
+
+ act(() => {
+ render(
+
+
+ ,
+ container
+ );
+ });
+
+ const select = document.querySelector("#datasets");
+ act(() => {
+ const event = new Event("change", { bubbles: true });
+ select.dispatchEvent(event);
+ });
+
+ const actions = store.getActions();
+ const expectedPayload = changeFile(0);
+
+ expect(actions).toEqual([expectedPayload]);
});
- const actions = store.getActions();
- const expectedPayload = openInfoModal();
+ it("throws error on unknown label type", () => {
+ const { storeObject } = setup();
+ const LABEL = "label-that-does-not-exist";
- expect(actions).toEqual([expectedPayload]);
+ expect(() =>
+ getHeadingLabel(LABEL, storeObject.localization)
+ ).toThrow(Error);
+ });
});
});
});
diff --git a/vis/test/component/knowledgemap-base.test.js b/vis/test/component/knowledgemap-base.test.js
index eec25819f..dadbb5aa7 100644
--- a/vis/test/component/knowledgemap-base.test.js
+++ b/vis/test/component/knowledgemap-base.test.js
@@ -234,7 +234,7 @@ describe("Knowledge map component - special BASE tests", () => {
const actions = store.getActions();
- const EXPECTED_PAYLOAD = [deselectPaper().type, zoomIn().type];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
expect(actions.map((a) => a.type)).toEqual(EXPECTED_PAYLOAD);
});
diff --git a/vis/test/component/knowledgemap.test.js b/vis/test/component/knowledgemap.test.js
index eceee8977..5e264707d 100644
--- a/vis/test/component/knowledgemap.test.js
+++ b/vis/test/component/knowledgemap.test.js
@@ -59,6 +59,7 @@ const setup = (overrideStoreObject = {}) => {
isContentBased: false,
baseUnit: undefined,
},
+ tracking: {},
localization: {},
},
overrideStoreObject
diff --git a/vis/test/component/list-base.test.js b/vis/test/component/list-base.test.js
index 4430f2b95..804080ba1 100644
--- a/vis/test/component/list-base.test.js
+++ b/vis/test/component/list-base.test.js
@@ -96,7 +96,7 @@ describe("List entries component - special BASE tests", () => {
const actions = store.getActions();
- const EXPECTED_PAYLOAD = [selectPaper({}).type, zoomIn().type];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
expect(actions.map((a) => a.type)).toEqual(EXPECTED_PAYLOAD);
});
@@ -122,7 +122,7 @@ describe("List entries component - special BASE tests", () => {
const actions = store.getActions();
- const EXPECTED_PAYLOAD = [deselectPaper().type, zoomIn().type];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
expect(actions.map((a) => a.type)).toEqual(EXPECTED_PAYLOAD);
});
diff --git a/vis/test/component/list.test.js b/vis/test/component/list.test.js
index 8601d54b5..8311615a5 100644
--- a/vis/test/component/list.test.js
+++ b/vis/test/component/list.test.js
@@ -77,6 +77,7 @@ const setup = (
renderMap: true,
renderList: true,
},
+ tracking: {},
selectedBubble: undefined,
selectedPaper: undefined,
chartType: KNOWLEDGEMAP_MODE,
@@ -829,10 +830,7 @@ describe("List entries component", () => {
describe("events", () => {
it("triggers a correct title click action in local files", () => {
- const EXPECTED_PAYLOAD = [
- selectPaper(initialTestData[0]).type,
- zoomIn().type,
- ];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
const storeObject = setup({ show: true }, { service: null });
const store = mockStore(storeObject);
@@ -858,7 +856,7 @@ describe("List entries component", () => {
});
it("triggers a correct area click action in local files", () => {
- const EXPECTED_PAYLOAD = [deselectPaper().type, zoomIn().type];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
const storeObject = setup({ show: true }, { service: null });
const store = mockStore(storeObject);
@@ -970,7 +968,7 @@ describe("List entries component", () => {
});
it("triggers a correct area click action in linkedcat", () => {
- const EXPECTED_PAYLOAD = [deselectPaper().type, zoomIn().type];
+ const EXPECTED_PAYLOAD = [zoomIn().type];
const storeObject = setup(
{ list: [linkedcatData[0]] },
{ show: true },
@@ -1208,9 +1206,15 @@ describe("List entries component", () => {
);
});
- expect(container.querySelector("#paper_list_title").textContent).toEqual(storeObject.localization.default_paper_title);
- expect(container.querySelector(".list_authors").textContent).toEqual(storeObject.localization.default_authors);
- expect(container.querySelector("#list_abstract").textContent).toEqual(storeObject.localization.default_abstract);
+ expect(container.querySelector("#paper_list_title").textContent).toEqual(
+ storeObject.localization.default_paper_title
+ );
+ expect(container.querySelector(".list_authors").textContent).toEqual(
+ storeObject.localization.default_authors
+ );
+ expect(container.querySelector("#list_abstract").textContent).toEqual(
+ storeObject.localization.default_abstract
+ );
});
});
});
diff --git a/vis/test/snapshot/__snapshots__/contextline.test.js.snap b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
index dcabbdd8c..34f3c62b6 100644
--- a/vis/test/snapshot/__snapshots__/contextline.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
@@ -33,6 +33,15 @@ exports[`Context line component snapshot matches a covis snapshot 1`] = `
:
2020-08-12 02:40:04 UTC
+
+
+
`;
@@ -77,6 +86,15 @@ exports[`Context line component snapshot matches a linkedcat authorview snapshot
}
id="source"
/>
+
+
+
`;
@@ -111,6 +129,7 @@ exports[`Context line component snapshot matches a linkedcat keywordview snapsho
+
+
+
`;
@@ -139,17 +167,21 @@ exports[`Context line component snapshot matches a project website (base low qua
100
- most relevant
+
+ most relevant
+
+
-
documents
(
@@ -174,6 +206,7 @@ exports[`Context line component snapshot matches a project website (base low qua
+
+
+
`;
@@ -219,17 +261,21 @@ exports[`Context line component snapshot matches a project website (pubmed high
100
- most relevant
+
+ most relevant
+
+
-
documents
(
@@ -254,6 +300,7 @@ exports[`Context line component snapshot matches a project website (pubmed high
+
+
+
`;
@@ -342,5 +398,14 @@ exports[`Context line component snapshot matches a viper snapshot 1`] = `
>
2011-2016
+
+
+
`;
diff --git a/vis/test/snapshot/__snapshots__/list-base.test.js.snap b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
index b5b0a4db8..e00c8d1e8 100644
--- a/vis/test/snapshot/__snapshots__/list-base.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
@@ -383,6 +383,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-in, p
@@ -1031,6 +1032,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1139,6 +1141,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1336,6 +1339,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1470,6 +1474,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1518,6 +1523,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1641,6 +1647,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1711,6 +1718,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1857,6 +1865,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -1905,6 +1914,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2024,6 +2034,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2094,6 +2105,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2274,6 +2286,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2481,6 +2494,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2705,6 +2719,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -2935,6 +2950,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3053,6 +3069,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3101,6 +3118,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3308,6 +3326,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3437,6 +3456,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3485,6 +3505,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3597,6 +3618,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3645,6 +3667,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3863,6 +3886,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -3953,6 +3977,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4050,6 +4075,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4208,6 +4234,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4405,6 +4432,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4512,6 +4540,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4560,6 +4589,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
@@ -4745,6 +4775,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
diff --git a/vis/test/store/selectedPaper.test.js b/vis/test/store/selectedPaper.test.js
index d1fba873d..b970c1a01 100644
--- a/vis/test/store/selectedPaper.test.js
+++ b/vis/test/store/selectedPaper.test.js
@@ -14,6 +14,7 @@ describe("list state", () => {
type: "SELECT_PAPER",
safeId: PAPER.safe_id,
paper: PAPER,
+ isFromBackButton: false,
};
expect(selectPaper(PAPER)).toEqual(EXPECTED_ACTION);
});
diff --git a/vis/test/store/zoom.test.js b/vis/test/store/zoom.test.js
index e069caf71..1ca4bae59 100644
--- a/vis/test/store/zoom.test.js
+++ b/vis/test/store/zoom.test.js
@@ -17,6 +17,7 @@ describe("zoom state", () => {
alreadyZoomed: false,
callback: undefined,
isFromBackButton: false,
+ selectedPaperData: null,
};
expect(zoomIn(DATA)).toEqual(EXPECTED_ACTION);
});
From 7753939997f428573d89d46170ea690f22d5cfbd Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Tue, 16 Nov 2021 14:56:20 +0100
Subject: [PATCH 04/34] refactored list entries code
---
.../{listentries => }/EntriesWrapper.js | 0
vis/js/components/ListEntries.js | 76 +++++++--
.../listentries/BasicListEntries.js | 102 ------------
.../listentries/ClassificationListEntries.js | 120 --------------
.../listentries/StandardListEntries.js | 154 ------------------
vis/js/templates/listentry/BasicListEntry.jsx | 69 +++++++-
.../listentry/ClassificationListEntry.jsx | 86 ++++++++--
.../templates/listentry/StandardListEntry.jsx | 118 ++++++++++++--
8 files changed, 297 insertions(+), 428 deletions(-)
rename vis/js/components/{listentries => }/EntriesWrapper.js (100%)
delete mode 100644 vis/js/components/listentries/BasicListEntries.js
delete mode 100644 vis/js/components/listentries/ClassificationListEntries.js
delete mode 100644 vis/js/components/listentries/StandardListEntries.js
diff --git a/vis/js/components/listentries/EntriesWrapper.js b/vis/js/components/EntriesWrapper.js
similarity index 100%
rename from vis/js/components/listentries/EntriesWrapper.js
rename to vis/js/components/EntriesWrapper.js
diff --git a/vis/js/components/ListEntries.js b/vis/js/components/ListEntries.js
index 3bed6c705..769f55650 100644
--- a/vis/js/components/ListEntries.js
+++ b/vis/js/components/ListEntries.js
@@ -1,17 +1,19 @@
import React from "react";
import { connect } from "react-redux";
-import BasicListEntries from "./listentries/BasicListEntries";
-import ClassificationListEntries from "./listentries/ClassificationListEntries";
-import StandardListEntries from "./listentries/StandardListEntries";
-import EntriesWrapper from "./listentries/EntriesWrapper";
-
import { useLocalizationContext } from "./LocalizationProvider";
import { filterData } from "../utils/data";
import { STREAMGRAPH_MODE } from "../reducers/chartType";
+import { mapDispatchToListEntriesProps } from "../utils/eventhandlers";
+
+import EntriesWrapper from "./EntriesWrapper";
+import BasicListEntry from "../templates/listentry/BasicListEntry";
+import ClassificationListEntry from "../templates/listentry/ClassificationListEntry";
+import StandardListEntry from "../templates/listentry/StandardListEntry";
const ListEntries = ({
+ // data
show,
service,
displayedData,
@@ -19,9 +21,32 @@ const ListEntries = ({
searchSettings,
filterSettings,
isStreamgraph,
+ disableClicks,
+ // functions
+ handleZoomIn,
+ handleSelectPaper,
+ handleSelectPaperWithZoom,
}) => {
const localization = useLocalizationContext();
+ const handleTitleClick = (paper) => {
+ if (disableClicks) {
+ return;
+ }
+ if (!isStreamgraph) {
+ handleSelectPaperWithZoom(paper);
+ } else {
+ handleSelectPaper(paper);
+ }
+ };
+
+ const handleAreaClick = (paper) => {
+ if (disableClicks) {
+ return;
+ }
+ handleZoomIn(paper);
+ };
+
if (!show) {
return null;
}
@@ -29,7 +54,7 @@ const ListEntries = ({
let showEmptyMessage = displayedData.length === 0;
if (!isStreamgraph && showEmptyMessage) {
// we have to perform knowledge map filtering here (it's different
- // to the filtering in the List.js component - paper selection is
+ // to the filtering in the List.js component - paper selection is
// not taken into account)
// if the list is empty, but there are visible papers in the zoomed
// bubble, the message is not displayed
@@ -47,15 +72,20 @@ const ListEntries = ({
);
}
- if (service === null || typeof service === "undefined") {
- return ;
- }
-
- if (service.startsWith("linkedcat")) {
- return ;
- }
+ const ListEntryComponent = getListEntryComponent(service);
- return ;
+ return (
+
+ {displayedData.map((paper) => (
+ handleTitleClick(paper)}
+ handleAreaClick={() => handleAreaClick(paper)}
+ />
+ ))}
+
+ );
};
const mapStateToProps = (state) => ({
@@ -75,6 +105,22 @@ const mapStateToProps = (state) => ({
docIds: state.selectedBubble ? state.selectedBubble.docIds : null,
},
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
+ disableClicks: state.list.disableClicks,
});
-export default connect(mapStateToProps)(ListEntries);
+export default connect(
+ mapStateToProps,
+ mapDispatchToListEntriesProps
+)(ListEntries);
+
+const getListEntryComponent = (service) => {
+ if (service === null || typeof service === "undefined") {
+ return BasicListEntry;
+ }
+
+ if (service.startsWith("linkedcat")) {
+ return ClassificationListEntry;
+ }
+
+ return StandardListEntry;
+};
diff --git a/vis/js/components/listentries/BasicListEntries.js b/vis/js/components/listentries/BasicListEntries.js
deleted file mode 100644
index 15100ce9c..000000000
--- a/vis/js/components/listentries/BasicListEntries.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import React from "react";
-import { connect } from "react-redux";
-
-import BasicListEntryTemplate from "../../templates/listentry/BasicListEntry";
-import EntriesWrapper from "./EntriesWrapper";
-
-import {
- getPaperPreviewImage,
- getPaperPreviewLink,
- getPaperPDFClickHandler,
-} from "../../utils/data";
-import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { shorten } from "../../utils/string";
-
-const BasicListEntries = ({
- displayedData,
- handleZoomIn,
- handleSelectPaperWithZoom,
- handlePDFClick,
- handleAreaMouseover,
- handleAreaMouseout,
- abstractSize,
- baseUnit,
- localization,
- showPreviewImage,
- showRealPreviewImage,
- disableClicks,
-}) => {
- const handleTitleClick = (paper) => {
- if (disableClicks) {
- return;
- }
- handleSelectPaperWithZoom(paper);
- };
-
- const handleAreaClick = (paper) => {
- if (disableClicks) {
- return;
- }
- handleZoomIn(paper);
- };
-
- return (
-
- {displayedData.map((entry) => (
- handleAreaMouseover(entry),
- onMouseOut: () => handleAreaMouseout(),
- }}
- readers={entry.num_readers}
- baseUnit={baseUnit}
- handleTitleClick={() => handleTitleClick(entry)}
- handleAreaClick={() => handleAreaClick(entry)}
- />
- ))}
-
- );
-};
-
-const mapStateToProps = (state) => ({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
- baseUnit: state.list.baseUnit,
- showPreviewImage: !!state.selectedPaper,
- showRealPreviewImage: state.list.showRealPreviewImage,
- disableClicks: state.list.disableClicks,
- localization: state.localization,
-});
-
-export default connect(
- mapStateToProps,
- mapDispatchToListEntriesProps
-)(BasicListEntries);
diff --git a/vis/js/components/listentries/ClassificationListEntries.js b/vis/js/components/listentries/ClassificationListEntries.js
deleted file mode 100644
index d3ca14ac7..000000000
--- a/vis/js/components/listentries/ClassificationListEntries.js
+++ /dev/null
@@ -1,120 +0,0 @@
-import React from "react";
-import { connect } from "react-redux";
-
-import ClassificationListEntry from "../../templates/listentry/ClassificationListEntry";
-import EntriesWrapper from "./EntriesWrapper";
-
-import {
- getPaperPreviewLink,
- getPaperPDFClickHandler,
- getPaperKeywords,
- getPaperClassification,
- getPaperTextLink,
-} from "../../utils/data";
-import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { shorten } from "../../utils/string";
-
-import { STREAMGRAPH_MODE } from "../../reducers/chartType";
-
-const ClassificationListEntries = ({
- displayedData,
- abstractSize,
- linkType,
- isStreamgraph,
- localization,
- showBacklink,
- isInStreamBacklink,
- disableClicks,
- handleZoomIn,
- handleSelectPaper,
- handleSelectPaperWithZoom,
- handlePDFClick,
- handleAreaMouseover,
- handleAreaMouseout,
- handleBacklinkClick,
-}) => {
- const handleTitleClick = (paper) => {
- if (disableClicks) {
- return;
- }
- if (!isStreamgraph) {
- handleSelectPaperWithZoom(paper);
- } else {
- handleSelectPaper(paper);
- }
- };
-
- const handleAreaClick = (paper) => {
- if (disableClicks) {
- return;
- }
- handleZoomIn(paper);
- };
-
- return (
-
- {displayedData.map((entry) => (
- handleAreaMouseover(entry),
- onMouseOut: () => handleAreaMouseout(),
- }
- }
- handleTitleClick={() => handleTitleClick(entry)}
- handleAreaClick={() => handleAreaClick(entry)}
- backlink={{
- show: showBacklink,
- isInStream: isInStreamBacklink,
- onClick: () => handleBacklinkClick(),
- }}
- />
- ))}
-
- );
-};
-
-const mapStateToProps = (state) => ({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
- linkType: state.list.linkType,
- isStreamgraph: state.chartType === STREAMGRAPH_MODE,
- localization: state.localization,
- showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
- isInStreamBacklink: !!state.selectedBubble,
- disableClicks: state.list.disableClicks,
-});
-
-export default connect(
- mapStateToProps,
- mapDispatchToListEntriesProps
-)(ClassificationListEntries);
diff --git a/vis/js/components/listentries/StandardListEntries.js b/vis/js/components/listentries/StandardListEntries.js
deleted file mode 100644
index f9decbf01..000000000
--- a/vis/js/components/listentries/StandardListEntries.js
+++ /dev/null
@@ -1,154 +0,0 @@
-import React from "react";
-import { connect } from "react-redux";
-
-import StandardListEntry from "../../templates/listentry/StandardListEntry";
-import EntriesWrapper from "./EntriesWrapper";
-
-import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { STREAMGRAPH_MODE } from "../../reducers/chartType";
-
-import {
- getPaperPreviewLink,
- getPaperPDFClickHandler,
- getPaperKeywords,
- getPaperTextLink,
- getPaperComments,
- getPaperTags,
-} from "../../utils/data";
-import { shorten } from "../../utils/string";
-
-const StandardListEntries = ({
- displayedData,
- abstractSize,
- linkType,
- showDocumentType,
- showMetrics,
- isContentBased,
- baseUnit,
- showPreviewImage,
- localization,
- showKeywords,
- isStreamgraph,
- showBacklink,
- isInStreamBacklink,
- disableClicks,
- handleZoomIn,
- handleSelectPaper,
- handleSelectPaperWithZoom,
- handlePDFClick,
- handleAreaMouseover,
- handleAreaMouseout,
- handleBacklinkClick,
-}) => {
- const handleTitleClick = (paper) => {
- if (disableClicks) {
- return;
- }
- if (!isStreamgraph) {
- handleSelectPaperWithZoom(paper);
- } else {
- handleSelectPaper(paper);
- }
- };
-
- const handleAreaClick = (paper) => {
- if (disableClicks) {
- return;
- }
- handleZoomIn(paper);
- };
-
- return (
-
- {displayedData.map((entry) => (
- handleAreaMouseover(entry),
- onMouseOut: () => handleAreaMouseout(),
- }
- : null
- }
- citations={
- !isContentBased && !!baseUnit && !showMetrics
- ? entry.num_readers
- : null
- }
- baseUnit={baseUnit}
- handleTitleClick={() => handleTitleClick(entry)}
- handleAreaClick={() => handleAreaClick(entry)}
- backlink={{
- show: showBacklink,
- isInStream: isInStreamBacklink,
- onClick: () => handleBacklinkClick(),
- }}
- />
- ))}
-
- );
-};
-
-const mapStateToProps = (state) => ({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
- linkType: state.list.linkType,
- showDocumentType: state.list.showDocumentType,
- showMetrics: state.list.showMetrics,
- isContentBased: state.list.isContentBased,
- baseUnit: state.list.baseUnit,
- showPreviewImage: !!state.selectedPaper,
- localization: state.localization,
- showKeywords:
- state.list.showKeywords &&
- (!!state.selectedPaper || !state.list.hideUnselectedKeywords),
- isStreamgraph: state.chartType === STREAMGRAPH_MODE,
- showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
- isInStreamBacklink: !!state.selectedBubble,
- disableClicks: state.list.disableClicks,
-});
-
-export default connect(
- mapStateToProps,
- mapDispatchToListEntriesProps
-)(StandardListEntries);
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index a643c16f4..231711595 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -1,4 +1,15 @@
import React from "react";
+import { connect } from "react-redux";
+
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import {
+ getPaperPDFClickHandler,
+ getPaperPreviewImage,
+ getPaperPreviewLink,
+} from "../../utils/data";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
+import { shorten } from "../../utils/string";
+
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
import Area from "./Area";
@@ -14,18 +25,48 @@ import Title from "./Title";
* @param {Object} props
*/
const BasicListEntry = ({
- id,
- access,
- title,
- preview,
- details,
- abstract,
- area,
- readers,
+ paper,
+ abstractSize,
baseUnit,
+ handlePDFClick,
+ handleAreaMouseover,
+ handleAreaMouseout,
handleTitleClick,
handleAreaClick,
+ // deprecated
+ showPreviewImage,
+ showRealPreviewImage,
}) => {
+ const loc = useLocalizationContext();
+
+ const id = paper.safe_id;
+ const access = {
+ isOpenAccess: !!paper.oa,
+ isFreeAccess: !!paper.free_access,
+ isDataset: paper.resulttype === "dataset",
+ };
+ const title = paper.title ? paper.title : loc.default_paper_title;
+ const preview = {
+ link: getPaperPreviewLink(paper),
+ onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
+ showPreviewImage,
+ previewImage: showRealPreviewImage ? getPaperPreviewImage(paper) : null,
+ };
+ const details = {
+ authors: paper.authors_string ? paper.authors_string : loc.default_authors,
+ source: paper.published_in,
+ year: paper.year,
+ };
+ const abstract = abstractSize
+ ? shorten(paper.paper_abstract, abstractSize)
+ : paper.paper_abstract;
+ const area = {
+ text: paper.area,
+ onMouseOver: () => handleAreaMouseover(paper),
+ onMouseOut: () => handleAreaMouseout(),
+ };
+ const readers = paper.num_readers;
+
return (
// html template starts here
@@ -63,4 +104,14 @@ const BasicListEntry = ({
);
};
-export default BasicListEntry;
+const mapStateToProps = (state) => ({
+ abstractSize: state.selectedPaper ? null : state.list.abstractSize,
+ baseUnit: state.list.baseUnit,
+ showPreviewImage: !!state.selectedPaper,
+ showRealPreviewImage: state.list.showRealPreviewImage,
+});
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToListEntriesProps
+)(BasicListEntry);
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index 8c596668a..baaded433 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -1,4 +1,18 @@
import React from "react";
+import { connect } from "react-redux";
+
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { STREAMGRAPH_MODE } from "../../reducers/chartType";
+import {
+ getPaperClassification,
+ getPaperKeywords,
+ getPaperPDFClickHandler,
+ getPaperPreviewLink,
+ getPaperTextLink,
+} from "../../utils/data";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
+import { shorten } from "../../utils/string";
+
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
import Area from "./Area";
@@ -16,20 +30,56 @@ import Title from "./Title";
* @param {Object} props
*/
const ClassificationListEntry = ({
- id,
- access,
- title,
- preview,
- details,
- link,
- classification,
- abstract,
- keywords,
- area,
+ paper,
+ handlePDFClick,
+ linkType,
+ abstractSize,
+ isStreamgraph,
+ handleAreaMouseover,
+ handleAreaMouseout,
handleTitleClick,
handleAreaClick,
- backlink,
+ showBacklink,
+ isInStreamBacklink,
+ handleBacklinkClick,
}) => {
+ const loc = useLocalizationContext();
+
+ const id = paper.safe_id;
+ const access = {
+ isOpenAccess: !!paper.oa,
+ isFreeAccess: !!paper.free_access,
+ isDataset: paper.resulttype === "dataset",
+ };
+ const title = paper.title ? paper.title : loc.default_paper_title;
+ const preview = {
+ link: getPaperPreviewLink(paper),
+ onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
+ };
+ const details = {
+ authors: paper.authors_string ? paper.authors_string : loc.default_authors,
+ source: paper.published_in,
+ year: paper.year,
+ };
+ const link = getPaperTextLink(paper, linkType);
+ const classification = getPaperClassification(paper, loc);
+ const abstract = abstractSize
+ ? shorten(paper.paper_abstract, abstractSize)
+ : paper.paper_abstract;
+ const keywords = getPaperKeywords(paper, loc);
+ const area = !isStreamgraph
+ ? {
+ text: paper.area,
+ onMouseOver: () => handleAreaMouseover(paper),
+ onMouseOut: () => handleAreaMouseout(),
+ }
+ : null;
+ const backlink = {
+ show: showBacklink,
+ isInStream: isInStreamBacklink,
+ onClick: () => handleBacklinkClick(),
+ };
+
return (
// html template starts here
@@ -67,4 +117,16 @@ const ClassificationListEntry = ({
);
};
-export default ClassificationListEntry;
+const mapStateToProps = (state) => ({
+ abstractSize: state.selectedPaper ? null : state.list.abstractSize,
+ linkType: state.list.linkType,
+ isStreamgraph: state.chartType === STREAMGRAPH_MODE,
+ showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
+ isInStreamBacklink: !!state.selectedBubble,
+ disableClicks: state.list.disableClicks,
+});
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToListEntriesProps
+)(ClassificationListEntry);
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index 511ff4f70..2e846e99f 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -1,4 +1,19 @@
import React from "react";
+import { connect } from "react-redux";
+
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { STREAMGRAPH_MODE } from "../../reducers/chartType";
+import {
+ getPaperComments,
+ getPaperKeywords,
+ getPaperPDFClickHandler,
+ getPaperPreviewLink,
+ getPaperTags,
+ getPaperTextLink,
+} from "../../utils/data";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
+import { shorten } from "../../utils/string";
+
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
import Area from "./Area";
@@ -21,25 +36,76 @@ import Title from "./Title";
* @param {Object} props
*/
const StandardListEntry = ({
- id,
- access,
- tags,
- title,
- preview,
- details,
- link,
- documentType,
- abstract,
- comments,
- keywords,
- metrics,
- area,
- citations,
+ paper,
+ handlePDFClick,
+ linkType,
+ showDocumentType,
+ abstractSize,
+ showKeywords,
+ showMetrics,
+ isContentBased,
baseUnit,
+ isStreamgraph,
+ handleAreaMouseover,
+ handleAreaMouseout,
handleTitleClick,
handleAreaClick,
- backlink,
+ showBacklink,
+ isInStreamBacklink,
+ handleBacklinkClick,
+ // deprecated
+ showPreviewImage,
}) => {
+ const loc = useLocalizationContext();
+
+ const id = paper.safe_id;
+ const access = {
+ isOpenAccess: !!paper.oa,
+ isFreeAccess: !!paper.free_access,
+ isDataset: paper.resulttype === "dataset",
+ };
+ const tags = getPaperTags(paper);
+ const title = paper.title ? paper.title : loc.default_paper_title;
+ const preview = {
+ link: getPaperPreviewLink(paper),
+ onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
+ showPreviewImage,
+ };
+ const details = {
+ authors: paper.authors_string ? paper.authors_string : loc.default_authors,
+ source: paper.published_in,
+ year: paper.year,
+ };
+ const link = getPaperTextLink(paper, linkType);
+ const documentType = showDocumentType ? paper.resulttype : null;
+ const abstract = abstractSize
+ ? shorten(paper.paper_abstract, abstractSize)
+ : paper.paper_abstract;
+ const comments = getPaperComments(paper);
+ const keywords = showKeywords ? getPaperKeywords(paper, loc) : null;
+ const metrics = showMetrics
+ ? {
+ tweets: paper.cited_by_tweeters_count,
+ readers: paper["readers.mendeley"],
+ citations: paper.citation_count,
+ baseUnit: !isContentBased ? baseUnit : null,
+ }
+ : null;
+ const area = !isStreamgraph
+ ? {
+ text: paper.area,
+ onMouseOver: () => handleAreaMouseover(paper),
+ onMouseOut: () => handleAreaMouseout(),
+ }
+ : null;
+ const backlink = {
+ show: showBacklink,
+ isInStream: isInStreamBacklink,
+ onClick: () => handleBacklinkClick(),
+ };
+ const citations =
+ !isContentBased && !!baseUnit && !showMetrics ? paper.num_readers : null;
+
return (
// html template starts here
@@ -97,4 +163,24 @@ const StandardListEntry = ({
);
};
-export default StandardListEntry;
+const mapStateToProps = (state) => ({
+ abstractSize: state.selectedPaper ? null : state.list.abstractSize,
+ linkType: state.list.linkType,
+ showDocumentType: state.list.showDocumentType,
+ showMetrics: state.list.showMetrics,
+ isContentBased: state.list.isContentBased,
+ baseUnit: state.list.baseUnit,
+ showPreviewImage: !!state.selectedPaper,
+ showKeywords:
+ state.list.showKeywords &&
+ (!!state.selectedPaper || !state.list.hideUnselectedKeywords),
+ isStreamgraph: state.chartType === STREAMGRAPH_MODE,
+ showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
+ isInStreamBacklink: !!state.selectedBubble,
+ disableClicks: state.list.disableClicks,
+});
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToListEntriesProps
+)(StandardListEntry);
From 3e7135b7ef50e468d7f3af09f08e65626895184a Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Tue, 16 Nov 2021 15:46:48 +0100
Subject: [PATCH 05/34] moved paper date from details to title
---
vis/js/components/ListEntries.js | 14 -
vis/js/templates/listentry/BasicListEntry.jsx | 16 +-
.../listentry/ClassificationListEntry.jsx | 16 +-
vis/js/templates/listentry/Details.jsx | 7 +-
.../templates/listentry/StandardListEntry.jsx | 16 +-
vis/js/templates/listentry/Title.jsx | 54 ++-
vis/js/utils/dates.js | 10 +-
vis/test/component/list-base.test.js | 28 +-
.../__snapshots__/list-base.test.js.snap | 378 +++++++-----------
9 files changed, 225 insertions(+), 314 deletions(-)
diff --git a/vis/js/components/ListEntries.js b/vis/js/components/ListEntries.js
index 769f55650..df6b69d51 100644
--- a/vis/js/components/ListEntries.js
+++ b/vis/js/components/ListEntries.js
@@ -24,22 +24,9 @@ const ListEntries = ({
disableClicks,
// functions
handleZoomIn,
- handleSelectPaper,
- handleSelectPaperWithZoom,
}) => {
const localization = useLocalizationContext();
- const handleTitleClick = (paper) => {
- if (disableClicks) {
- return;
- }
- if (!isStreamgraph) {
- handleSelectPaperWithZoom(paper);
- } else {
- handleSelectPaper(paper);
- }
- };
-
const handleAreaClick = (paper) => {
if (disableClicks) {
return;
@@ -80,7 +67,6 @@ const ListEntries = ({
handleTitleClick(paper)}
handleAreaClick={() => handleAreaClick(paper)}
/>
))}
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index 231711595..187912984 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -31,7 +31,6 @@ const BasicListEntry = ({
handlePDFClick,
handleAreaMouseover,
handleAreaMouseout,
- handleTitleClick,
handleAreaClick,
// deprecated
showPreviewImage,
@@ -45,18 +44,12 @@ const BasicListEntry = ({
isFreeAccess: !!paper.free_access,
isDataset: paper.resulttype === "dataset",
};
- const title = paper.title ? paper.title : loc.default_paper_title;
const preview = {
link: getPaperPreviewLink(paper),
onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
showPreviewImage,
previewImage: showRealPreviewImage ? getPaperPreviewImage(paper) : null,
};
- const details = {
- authors: paper.authors_string ? paper.authors_string : loc.default_authors,
- source: paper.published_in,
- year: paper.year,
- };
const abstract = abstractSize
? shorten(paper.paper_abstract, abstractSize)
: paper.paper_abstract;
@@ -76,12 +69,13 @@ const BasicListEntry = ({
isFreeAccess={access.isFreeAccess}
isDataset={access.isDataset}
/>
- {title}
+
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index baaded433..40b3a9f2d 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -37,7 +37,6 @@ const ClassificationListEntry = ({
isStreamgraph,
handleAreaMouseover,
handleAreaMouseout,
- handleTitleClick,
handleAreaClick,
showBacklink,
isInStreamBacklink,
@@ -51,16 +50,10 @@ const ClassificationListEntry = ({
isFreeAccess: !!paper.free_access,
isDataset: paper.resulttype === "dataset",
};
- const title = paper.title ? paper.title : loc.default_paper_title;
const preview = {
link: getPaperPreviewLink(paper),
onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
};
- const details = {
- authors: paper.authors_string ? paper.authors_string : loc.default_authors,
- source: paper.published_in,
- year: paper.year,
- };
const link = getPaperTextLink(paper, linkType);
const classification = getPaperClassification(paper, loc);
const abstract = abstractSize
@@ -89,9 +82,14 @@ const ClassificationListEntry = ({
isFreeAccess={access.isFreeAccess}
isDataset={access.isDataset}
/>
- {title}
+
-
+
{classification}
diff --git a/vis/js/templates/listentry/Details.jsx b/vis/js/templates/listentry/Details.jsx
index 8d89de870..88733b650 100644
--- a/vis/js/templates/listentry/Details.jsx
+++ b/vis/js/templates/listentry/Details.jsx
@@ -2,7 +2,7 @@ import React from "react";
import Highlight from "../../components/Highlight";
-const Details = ({ authors, source, year }) => {
+const Details = ({ authors, source }) => {
return (
// html template starts here
@@ -19,11 +19,6 @@ const Details = ({ authors, source, year }) => {
>
)}
- {!!year && (
-
- {` (${year})`}
-
- )}
// html template ends here
);
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index 2e846e99f..739aeab5e 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -48,7 +48,6 @@ const StandardListEntry = ({
isStreamgraph,
handleAreaMouseover,
handleAreaMouseout,
- handleTitleClick,
handleAreaClick,
showBacklink,
isInStreamBacklink,
@@ -65,17 +64,11 @@ const StandardListEntry = ({
isDataset: paper.resulttype === "dataset",
};
const tags = getPaperTags(paper);
- const title = paper.title ? paper.title : loc.default_paper_title;
const preview = {
link: getPaperPreviewLink(paper),
onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
showPreviewImage,
};
- const details = {
- authors: paper.authors_string ? paper.authors_string : loc.default_authors,
- source: paper.published_in,
- year: paper.year,
- };
const link = getPaperTextLink(paper, linkType);
const documentType = showDocumentType ? paper.resulttype : null;
const abstract = abstractSize
@@ -116,12 +109,13 @@ const StandardListEntry = ({
isDataset={access.isDataset}
tags={tags ? : null}
/>
- {title}
+
diff --git a/vis/js/templates/listentry/Title.jsx b/vis/js/templates/listentry/Title.jsx
index e701bc508..a06b8ffb6 100644
--- a/vis/js/templates/listentry/Title.jsx
+++ b/vis/js/templates/listentry/Title.jsx
@@ -1,13 +1,34 @@
import React from "react";
+import { connect } from "react-redux";
import Highlight from "../../components/Highlight";
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { STREAMGRAPH_MODE } from "../../reducers/chartType";
+import { getDateFromTimestamp } from "../../utils/dates";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import useMatomo from "../../utils/useMatomo";
-const Title = ({ children, onClick }) => {
+const Title = ({
+ paper,
+ isStreamgraph,
+ disableClicks,
+ handleSelectPaper,
+ handleSelectPaperWithZoom,
+}) => {
+ const loc = useLocalizationContext();
const { trackEvent } = useMatomo();
const handleClick = () => {
- onClick();
+ if (disableClicks) {
+ return;
+ }
+
+ if (!isStreamgraph) {
+ handleSelectPaperWithZoom(paper);
+ } else {
+ handleSelectPaper(paper);
+ }
+
trackEvent("List document", "Select paper", "List title");
};
@@ -15,11 +36,36 @@ const Title = ({ children, onClick }) => {
// html template starts here
// html template ends here
);
};
-export default Title;
+const mapStateToProps = (state) => ({
+ isStreamgraph: state.chartType === STREAMGRAPH_MODE,
+ disableClicks: state.list.disableClicks,
+});
+
+export default connect(mapStateToProps, mapDispatchToListEntriesProps)(Title);
+
+const formatDate = (date) => {
+ const strDate = date.toString();
+ let format = "yyyy-mm-dd";
+ if (strDate.match(/^\d{4}(-\d{2})?$/)) {
+ format = "yyyy";
+ }
+
+ const formatted = getDateFromTimestamp(date, format);
+ if (!formatted) {
+ return strDate;
+ }
+
+ return formatted;
+};
diff --git a/vis/js/utils/dates.js b/vis/js/utils/dates.js
index 372576d7a..2d39b3d83 100644
--- a/vis/js/utils/dates.js
+++ b/vis/js/utils/dates.js
@@ -15,7 +15,7 @@ export const getDateTimeFromTimestamp = (timestamp) => {
return `on ${date} at ${time}`;
};
-export const getDateFromTimestamp = (timestamp) => {
+export const getDateFromTimestamp = (timestamp, format = "d mmm yyyy") => {
if (typeof timestamp !== "string" || !timestamp) {
return "";
}
@@ -23,14 +23,14 @@ export const getDateFromTimestamp = (timestamp) => {
const date = parseTimestamp(timestamp);
try {
- return dateFormat(date, "d mmm yyyy");
+ return dateFormat(date, format);
} catch (error) {
console.warn(error);
return "";
}
};
-export const getTimeFromTimestamp = (timestamp) => {
+export const getTimeFromTimestamp = (timestamp, format = "H:MM") => {
if (typeof timestamp !== "string" || !timestamp) {
return "";
}
@@ -38,7 +38,7 @@ export const getTimeFromTimestamp = (timestamp) => {
const date = parseTimestamp(timestamp);
try {
- return dateFormat(date, "H:MM");
+ return dateFormat(date, format);
} catch (error) {
console.warn(error);
return "";
@@ -51,4 +51,4 @@ const parseTimestamp = (timestamp) => {
}
return new Date(timestamp);
-}
+};
diff --git a/vis/test/component/list-base.test.js b/vis/test/component/list-base.test.js
index 804080ba1..b6ad79a6b 100644
--- a/vis/test/component/list-base.test.js
+++ b/vis/test/component/list-base.test.js
@@ -291,33 +291,15 @@ describe("List entries component - special BASE tests", () => {
const regexp = /\((?\d{4})/;
let years = [...papers]
- .map((e) => e.querySelector(".list_pubyear").textContent)
+ .map((e) => e.querySelector(".list_title").textContent)
.map((y) => {
const found = y.match(regexp);
return parseInt(found.groups.year);
});
expect(years).toEqual([
- 2020,
- 2019,
- 2019,
- 2019,
- 2019,
- 2019,
- 2018,
- 2018,
- 2018,
- 2017,
- 2016,
- 2014,
- 2014,
- 2014,
- 2013,
- 2012,
- 2011,
- 2010,
- 2008,
- 2007,
+ 2020, 2019, 2019, 2019, 2019, 2019, 2018, 2018, 2018, 2017, 2016, 2014,
+ 2014, 2014, 2013, 2012, 2011, 2010, 2008, 2007,
]);
});
@@ -362,8 +344,8 @@ describe("List entries component - special BASE tests", () => {
);
expect(titles).toEqual([
- "Digital Education And Learning: The Growing Trend In Academic And Business Spaces—An International Overview",
- "Integrating Digital Libraries into Distance Education: A Review of Models, Roles, And Strategies",
+ "Digital Education And Learning: The Growing Trend In Academic And Business Spaces—An International Overview (2018)",
+ "Integrating Digital Libraries into Distance Education: A Review of Models, Roles, And Strategies (2019-04-01)",
]);
});
});
diff --git a/vis/test/snapshot/__snapshots__/list-base.test.js.snap b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
index e00c8d1e8..0dc1d81ac 100644
--- a/vis/test/snapshot/__snapshots__/list-base.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
@@ -329,6 +329,13 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-in, p
And Learning: The Growing Trend In Academic And Business Spaces—An International Overview
+
+
+ (2018)
+
+
-
-
-
- (2018)
-
-
-
+
+
+ (2014-08-14)
+
+
-
-
-
- (2014-08-14)
-
-
-
+
+
+ (2018)
+
+
-
-
-
- (2018)
-
-
-
+
+
+ (2011)
+
+
-
-
-
- (2011)
-
-
-
+
+
+ (2012-04-01)
+
+
-
-
-
- (2012-04-01T07:00:00Z)
-
-
-
+
+
+ (2010)
+
+
-
-
-
- (2010)
-
-
-
+
+
+ (2013-09-01)
+
+
-
-
-
- (2013-09-01T00:00:00Z)
-
-
-
+
+
+ (2019)
+
+
-
-
-
- (2019-09)
-
-
-
+
+
+ (2019-04-01)
+
+
-
-
-
- (2019-04-01T00:00:00Z)
-
-
-
+
+
+ (2017-01-17)
+
+
-
-
-
- (2017-01-17)
-
-
-
+
+
+ (2019-05-23)
+
+
-
-
-
- (2019-05-23)
-
-
-
+
+
+ (2019)
+
+
-
-
-
- (2019)
-
-
-
+
+
+ (2019)
+
+
-
-
-
- (2019)
-
-
-
+
+
+ (2014)
+
+
-
-
-
- (2014-09)
-
-
-
+
+
+ (2016-08-26)
+
+
-
-
-
- (2016-08-26)
-
-
-
+
+
+ (2018-06-14)
+
+
-
-
-
- (2018-06-14)
-
-
-
+
+
+ (2007)
+
+
-
-
-
- (2007)
-
-
-
+
+
+ (2014)
+
+
-
-
-
- (2014)
-
-
-
+
+
+ (2018-01-12)
+
+
-
-
-
- (2018-01-12T14:18:08Z)
-
-
-
+
+
+ (2008)
+
+
-
-
-
- (2008)
-
-
-
+
+
+ (2020-03-01)
+
+
-
-
-
- (2020-03-01T00:00:00Z)
-
-
-
Date: Tue, 16 Nov 2021 17:20:26 +0100
Subject: [PATCH 06/34] removed link from side icons
---
vis/js/templates/listentry/BasicListEntry.jsx | 4 +-
.../listentry/ClassificationListEntry.jsx | 6 +-
...{PreviewIcons.jsx => SidePreviewIcons.jsx} | 4 +-
.../templates/listentry/StandardListEntry.jsx | 12 +-
.../__snapshots__/list-base.test.js.snap | 193 +-----------------
5 files changed, 19 insertions(+), 200 deletions(-)
rename vis/js/templates/listentry/{PreviewIcons.jsx => SidePreviewIcons.jsx} (91%)
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index 187912984..2f8a93406 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -15,7 +15,7 @@ import AccessIcons from "./AccessIcons";
import Area from "./Area";
import Details from "./Details";
import ListEntry from "./ListEntry";
-import PreviewIcons from "./PreviewIcons";
+import SidePreviewIcons from "./SidePreviewIcons";
import PreviewImage from "./PreviewImage";
import Readers from "./Readers";
import Title from "./Title";
@@ -70,7 +70,7 @@ const BasicListEntry = ({
isDataset={access.isDataset}
/>
-
+
-
+
{
+const SidePreviewIcons = ({ link, onClickPDF }) => {
const { trackEvent } = useMatomo();
const trackLinkClick = () => {
@@ -38,4 +38,4 @@ const PreviewIcons = ({ link, onClickPDF }) => {
);
};
-export default PreviewIcons;
+export default SidePreviewIcons;
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index 739aeab5e..bbe545903 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -7,7 +7,6 @@ import {
getPaperComments,
getPaperKeywords,
getPaperPDFClickHandler,
- getPaperPreviewLink,
getPaperTags,
getPaperTextLink,
} from "../../utils/data";
@@ -26,8 +25,7 @@ import Keywords from "./Keywords";
import Link from "./Link";
import ListEntry from "./ListEntry";
import Metrics from "./Metrics";
-import PreviewIcons from "./PreviewIcons";
-import PreviewImage from "./PreviewImage";
+import SidePreviewIcons from "./SidePreviewIcons";
import Tags from "./Tags";
import Title from "./Title";
@@ -52,7 +50,7 @@ const StandardListEntry = ({
showBacklink,
isInStreamBacklink,
handleBacklinkClick,
- // deprecated
+ // TODO deprecated
showPreviewImage,
}) => {
const loc = useLocalizationContext();
@@ -65,7 +63,6 @@ const StandardListEntry = ({
};
const tags = getPaperTags(paper);
const preview = {
- link: getPaperPreviewLink(paper),
onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
showPreviewImage,
};
@@ -110,7 +107,7 @@ const StandardListEntry = ({
tags={tags ? : null}
/>
-
+
}
{!!comments && }
- {!!preview.showPreviewImage && !!preview.onClickPDF && (
-
- )}
{!!keywords && {keywords} }
{!!metrics && (
-
-
- Click here to open preview
-
-
+ />
@@ -1465,22 +1427,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -1634,22 +1581,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -1848,22 +1780,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -2013,22 +1930,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -3028,22 +2930,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -3407,22 +3294,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -3565,22 +3437,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -3916,22 +3773,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
@@ -4467,22 +4309,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
+ />
From 33c63ebaf2248f2545c191bdc0f7dd54374f4022 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 12:07:05 +0100
Subject: [PATCH 07/34] moved pdf button in doc entry
---
examples/project_website/base.html | 6 ++--
examples/project_website/pubmed.html | 28 +++--------------
vis/js/templates/PaperButtons.jsx | 31 +++++++++++++++++++
.../listentry/ClassificationListEntry.jsx | 10 ++----
.../templates/listentry/StandardListEntry.jsx | 20 ++++--------
vis/stylesheets/components/_buttons.scss | 18 +++++++++++
vis/stylesheets/modules/list/_entry.scss | 17 +++++-----
7 files changed, 75 insertions(+), 55 deletions(-)
create mode 100644 vis/js/templates/PaperButtons.jsx
diff --git a/examples/project_website/base.html b/examples/project_website/base.html
index ba370c0ff..31f0ea86e 100644
--- a/examples/project_website/base.html
+++ b/examples/project_website/base.html
@@ -86,8 +86,10 @@
diff --git a/examples/project_website/pubmed.html b/examples/project_website/pubmed.html
index 03773ad87..afc7d68e5 100644
--- a/examples/project_website/pubmed.html
+++ b/examples/project_website/pubmed.html
@@ -54,23 +54,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -87,7 +70,6 @@
@@ -95,12 +77,12 @@
diff --git a/vis/js/templates/PaperButtons.jsx b/vis/js/templates/PaperButtons.jsx
new file mode 100644
index 000000000..8bafffbf6
--- /dev/null
+++ b/vis/js/templates/PaperButtons.jsx
@@ -0,0 +1,31 @@
+import React from "react";
+import { connect } from "react-redux";
+
+import useMatomo from "../utils/useMatomo";
+import { getPaperPDFClickHandler } from "../utils/data";
+import { mapDispatchToListEntriesProps } from "../utils/eventhandlers";
+
+const PaperButtons = ({ paper, handlePDFClick }) => {
+ const { trackEvent } = useMatomo();
+
+ const onPDFClick = getPaperPDFClickHandler(paper, handlePDFClick);
+
+ const handlePDFButtonClick = () => {
+ onPDFClick();
+ trackEvent("List document", "Show PDF preview", "PDF button");
+ };
+
+ return (
+ // html template starts here
+
+ {!!onPDFClick && (
+
+ PDF
+
+ )}
+
+ // html template ends here
+ );
+};
+
+export default connect(null, mapDispatchToListEntriesProps)(PaperButtons);
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index 715a3eac9..a5cfcdca9 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -6,11 +6,11 @@ import { STREAMGRAPH_MODE } from "../../reducers/chartType";
import {
getPaperClassification,
getPaperKeywords,
- getPaperPDFClickHandler,
getPaperTextLink,
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import { shorten } from "../../utils/string";
+import PaperButtons from "../PaperButtons";
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
@@ -21,7 +21,6 @@ import EntryBacklink from "./EntryBacklink";
import Keywords from "./Keywords";
import Link from "./Link";
import ListEntry from "./ListEntry";
-import SidePreviewIcons from "./SidePreviewIcons";
import Title from "./Title";
/**
@@ -30,7 +29,6 @@ import Title from "./Title";
*/
const ClassificationListEntry = ({
paper,
- handlePDFClick,
linkType,
abstractSize,
isStreamgraph,
@@ -49,9 +47,6 @@ const ClassificationListEntry = ({
isFreeAccess: !!paper.free_access,
isDataset: paper.resulttype === "dataset",
};
- const preview = {
- onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
- };
const link = getPaperTextLink(paper, linkType);
const classification = getPaperClassification(paper, loc);
const abstract = abstractSize
@@ -81,7 +76,6 @@ const ClassificationListEntry = ({
isDataset={access.isDataset}
/>
-
{classification}
{keywords}
+
{!!area && (
({
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
isInStreamBacklink: !!state.selectedBubble,
- disableClicks: state.list.disableClicks,
});
export default connect(
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index bbe545903..fcdaf9879 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -6,12 +6,12 @@ import { STREAMGRAPH_MODE } from "../../reducers/chartType";
import {
getPaperComments,
getPaperKeywords,
- getPaperPDFClickHandler,
getPaperTags,
getPaperTextLink,
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import { shorten } from "../../utils/string";
+import PaperButtons from "../PaperButtons";
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
@@ -25,7 +25,6 @@ import Keywords from "./Keywords";
import Link from "./Link";
import ListEntry from "./ListEntry";
import Metrics from "./Metrics";
-import SidePreviewIcons from "./SidePreviewIcons";
import Tags from "./Tags";
import Title from "./Title";
@@ -34,8 +33,8 @@ import Title from "./Title";
* @param {Object} props
*/
const StandardListEntry = ({
+ // data
paper,
- handlePDFClick,
linkType,
showDocumentType,
abstractSize,
@@ -44,14 +43,13 @@ const StandardListEntry = ({
isContentBased,
baseUnit,
isStreamgraph,
+ showBacklink,
+ isInStreamBacklink,
+ // event handlers
handleAreaMouseover,
handleAreaMouseout,
handleAreaClick,
- showBacklink,
- isInStreamBacklink,
handleBacklinkClick,
- // TODO deprecated
- showPreviewImage,
}) => {
const loc = useLocalizationContext();
@@ -62,10 +60,6 @@ const StandardListEntry = ({
isDataset: paper.resulttype === "dataset",
};
const tags = getPaperTags(paper);
- const preview = {
- onClickPDF: getPaperPDFClickHandler(paper, handlePDFClick),
- showPreviewImage,
- };
const link = getPaperTextLink(paper, linkType);
const documentType = showDocumentType ? paper.resulttype : null;
const abstract = abstractSize
@@ -107,7 +101,6 @@ const StandardListEntry = ({
tags={tags ? : null}
/>
-
)}
+
{!!area && (
({
showMetrics: state.list.showMetrics,
isContentBased: state.list.isContentBased,
baseUnit: state.list.baseUnit,
- showPreviewImage: !!state.selectedPaper,
showKeywords:
state.list.showKeywords &&
(!!state.selectedPaper || !state.list.hideUnselectedKeywords),
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
isInStreamBacklink: !!state.selectedBubble,
- disableClicks: state.list.disableClicks,
});
export default connect(
diff --git a/vis/stylesheets/components/_buttons.scss b/vis/stylesheets/components/_buttons.scss
index e84568a47..ffa94279a 100755
--- a/vis/stylesheets/components/_buttons.scss
+++ b/vis/stylesheets/components/_buttons.scss
@@ -147,6 +147,24 @@ img#close-button {
font-size: 10px;
}
+.paper_buttons_row {
+ margin: 10px 0px;
+}
+
+.paper_button {
+ color: white;
+ border: 1px solid #E55137;
+ background-color: #E55137;
+ padding: 5px;
+ border-radius: 5px;
+ cursor: pointer;
+
+ &:hover {
+ color: #E55137;
+ background-color: white;
+ }
+}
+
@media screen and (max-width: 1150px) {
#modals .btn, .reload-button.small-reload {
font-size: 13px;
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 937b5ff8d..a4c41c50f 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -76,7 +76,7 @@
font-size: 14px;
line-height:120%;
margin-bottom: 10px;
- max-width: 82%;
+ padding-right: 10px;
display: inline-block;
color: $list_metadata_title_paper;
font-weight: $fontweight600;
@@ -173,7 +173,7 @@
line-height: 120%;
color: $list_detail;
padding: 0;
- max-width: 82%;
+ padding-right: 10px;
.list_authors {
color: $list_detail_authors;
@@ -197,11 +197,10 @@
}
#list_abstract {
- max-width: 82%;
+ padding-right: 10px;
font-size: 13px;
font-family: $abstract-font-family;
line-height: 130%;
- padding-right: 0;
padding-left: 0px;
color: $list_abstract;
font-weight: $fontweight400;
@@ -230,7 +229,7 @@ s.resulttype {
padding: 0;
text-align: left;
display: inline-block;
- max-width: 82%;
+ padding-right: 10px;
.area_tag, .keyword_tag {
font-weight: $fontweight700;
@@ -246,6 +245,8 @@ s.resulttype {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
+ max-width: 82%;
+ padding-right: 0;
.area_name {
color: $medium-blue;
@@ -364,8 +365,8 @@ s.resulttype {
display: none;
}
-#list_keywords, #list_basic_classification, #list_ddc {
- margin-bottom: 20px;
+#list_keywords, #list_basic_classification {
+ margin-bottom: 10px;
}
.oa-link-hidden {
@@ -878,7 +879,7 @@ img#preview_page {
.comments .comment-text {
font-size: 12px;
- max-width: 82%;
+ padding-right: 10px;
background-color: #f1f1f1;
padding: 5px;
border-radius: 5px;
From ac22927a783ae2c86acb457d2c29dfa116bb92ac Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 12:27:04 +0100
Subject: [PATCH 08/34] area refactoring + added tooltip
---
vis/js/components/ListEntries.js | 23 ++--------------
vis/js/templates/listentry/Area.jsx | 26 ++++++++++++-------
vis/js/templates/listentry/BasicListEntry.jsx | 16 +-----------
.../listentry/ClassificationListEntry.jsx | 20 +-------------
.../templates/listentry/StandardListEntry.jsx | 20 +-------------
5 files changed, 22 insertions(+), 83 deletions(-)
diff --git a/vis/js/components/ListEntries.js b/vis/js/components/ListEntries.js
index df6b69d51..37e47ff82 100644
--- a/vis/js/components/ListEntries.js
+++ b/vis/js/components/ListEntries.js
@@ -5,7 +5,6 @@ import { useLocalizationContext } from "./LocalizationProvider";
import { filterData } from "../utils/data";
import { STREAMGRAPH_MODE } from "../reducers/chartType";
-import { mapDispatchToListEntriesProps } from "../utils/eventhandlers";
import EntriesWrapper from "./EntriesWrapper";
import BasicListEntry from "../templates/listentry/BasicListEntry";
@@ -21,19 +20,9 @@ const ListEntries = ({
searchSettings,
filterSettings,
isStreamgraph,
- disableClicks,
- // functions
- handleZoomIn,
}) => {
const localization = useLocalizationContext();
- const handleAreaClick = (paper) => {
- if (disableClicks) {
- return;
- }
- handleZoomIn(paper);
- };
-
if (!show) {
return null;
}
@@ -64,11 +53,7 @@ const ListEntries = ({
return (
{displayedData.map((paper) => (
- handleAreaClick(paper)}
- />
+
))}
);
@@ -91,13 +76,9 @@ const mapStateToProps = (state) => ({
docIds: state.selectedBubble ? state.selectedBubble.docIds : null,
},
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
- disableClicks: state.list.disableClicks,
});
-export default connect(
- mapStateToProps,
- mapDispatchToListEntriesProps
-)(ListEntries);
+export default connect(mapStateToProps)(ListEntries);
const getListEntryComponent = (service) => {
if (service === null || typeof service === "undefined") {
diff --git a/vis/js/templates/listentry/Area.jsx b/vis/js/templates/listentry/Area.jsx
index 3edd6b0b0..e0ba07318 100644
--- a/vis/js/templates/listentry/Area.jsx
+++ b/vis/js/templates/listentry/Area.jsx
@@ -2,27 +2,32 @@ import React from "react";
import { connect } from "react-redux";
import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import useMatomo from "../../utils/useMatomo";
const Area = ({
- children,
- onClick,
- onMouseOver,
- onMouseOut,
+ paper,
trackMouseOver,
+ disableClicks,
+ handleZoomIn,
+ handleAreaMouseover,
+ handleAreaMouseout,
}) => {
const localization = useLocalizationContext();
const { trackEvent } = useMatomo();
const handleMouseOver = () => {
- onMouseOver();
+ handleAreaMouseover(paper);
if (trackMouseOver) {
trackEvent("List document", "Hover bubble", "Area name");
}
};
const handleClick = () => {
- onClick();
+ if (disableClicks) {
+ return;
+ }
+ handleZoomIn(paper);
trackEvent("List document", "Zoom in", "Area name");
};
@@ -32,10 +37,12 @@ const Area = ({
id="list_area"
onClick={handleClick}
onMouseOver={handleMouseOver}
- onMouseOut={onMouseOut}
+ onMouseOut={handleAreaMouseout}
>
{localization.area}: {" "}
- {children}
+
+ {paper.area}
+
// html template ends here
);
@@ -43,6 +50,7 @@ const Area = ({
const mapStateToProps = (state) => ({
trackMouseOver: state.tracking.trackMouseOver,
+ disableClicks: state.list.disableClicks,
});
-export default connect(mapStateToProps)(Area);
+export default connect(mapStateToProps, mapDispatchToListEntriesProps)(Area);
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index 2f8a93406..45991e573 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -29,9 +29,6 @@ const BasicListEntry = ({
abstractSize,
baseUnit,
handlePDFClick,
- handleAreaMouseover,
- handleAreaMouseout,
- handleAreaClick,
// deprecated
showPreviewImage,
showRealPreviewImage,
@@ -53,11 +50,6 @@ const BasicListEntry = ({
const abstract = abstractSize
? shorten(paper.paper_abstract, abstractSize)
: paper.paper_abstract;
- const area = {
- text: paper.area,
- onMouseOver: () => handleAreaMouseover(paper),
- onMouseOut: () => handleAreaMouseout(),
- };
const readers = paper.num_readers;
return (
@@ -85,13 +77,7 @@ const BasicListEntry = ({
onClick={preview.onClickPDF}
/>
)}
-
- {area.text}
-
+
// html template ends here
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index a5cfcdca9..8c8840c69 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -32,9 +32,6 @@ const ClassificationListEntry = ({
linkType,
abstractSize,
isStreamgraph,
- handleAreaMouseover,
- handleAreaMouseout,
- handleAreaClick,
showBacklink,
isInStreamBacklink,
handleBacklinkClick,
@@ -53,13 +50,6 @@ const ClassificationListEntry = ({
? shorten(paper.paper_abstract, abstractSize)
: paper.paper_abstract;
const keywords = getPaperKeywords(paper, loc);
- const area = !isStreamgraph
- ? {
- text: paper.area,
- onMouseOver: () => handleAreaMouseover(paper),
- onMouseOut: () => handleAreaMouseout(),
- }
- : null;
const backlink = {
show: showBacklink,
isInStream: isInStreamBacklink,
@@ -88,15 +78,7 @@ const ClassificationListEntry = ({
{keywords}
- {!!area && (
-
- {area.text}
-
- )}
+ {!isStreamgraph && }
{!!backlink.show && (
{
const loc = useLocalizationContext();
@@ -75,13 +72,6 @@ const StandardListEntry = ({
baseUnit: !isContentBased ? baseUnit : null,
}
: null;
- const area = !isStreamgraph
- ? {
- text: paper.area,
- onMouseOver: () => handleAreaMouseover(paper),
- onMouseOut: () => handleAreaMouseout(),
- }
- : null;
const backlink = {
show: showBacklink,
isInStream: isInStreamBacklink,
@@ -122,15 +112,7 @@ const StandardListEntry = ({
/>
)}
- {!!area && (
-
- {area.text}
-
- )}
+ {!isStreamgraph && }
{(!!citations || parseInt(citations) === 0) && (
)}
From 3dd0b0d970d1083a458e251fc4a0d9c19ed9f6c0 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 13:56:17 +0100
Subject: [PATCH 09/34] abbreviating title to max 2 lines
---
vis/js/templates/listentry/Title.jsx | 30 +++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/vis/js/templates/listentry/Title.jsx b/vis/js/templates/listentry/Title.jsx
index a06b8ffb6..ef1ead6f5 100644
--- a/vis/js/templates/listentry/Title.jsx
+++ b/vis/js/templates/listentry/Title.jsx
@@ -8,10 +8,13 @@ import { getDateFromTimestamp } from "../../utils/dates";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import useMatomo from "../../utils/useMatomo";
+const MAX_TITLE_LENGTH = 150;
+
const Title = ({
paper,
isStreamgraph,
disableClicks,
+ isSelected,
handleSelectPaper,
handleSelectPaperWithZoom,
}) => {
@@ -32,16 +35,19 @@ const Title = ({
trackEvent("List document", "Select paper", "List title");
};
+ const rawTitle = paper.title ? paper.title : loc.default_paper_title;
+
+ const formattedDate = ` (${formatDate(paper.year)})`;
+ const formattedTitle = isSelected
+ ? rawTitle
+ : formatTitle(rawTitle, MAX_TITLE_LENGTH - formattedDate.length);
+
return (
// html template starts here
// html template ends here
@@ -51,6 +57,7 @@ const Title = ({
const mapStateToProps = (state) => ({
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
disableClicks: state.list.disableClicks,
+ isSelected: !!state.selectedPaper,
});
export default connect(mapStateToProps, mapDispatchToListEntriesProps)(Title);
@@ -69,3 +76,12 @@ const formatDate = (date) => {
return formatted;
};
+
+const formatTitle = (title, maxLength) => {
+ const ellipsis = "...";
+ if (title.length > maxLength) {
+ return title.substr(0, maxLength - ellipsis.length).trim() + ellipsis;
+ }
+
+ return title;
+};
From f127c03792c8c1886508541748596c533ee36356 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 14:34:05 +0100
Subject: [PATCH 10/34] abbreviating paper source
---
vis/js/templates/listentry/Details.jsx | 17 ++++++++++------
vis/stylesheets/modules/list/_entry.scss | 26 +++++++++++++++---------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/vis/js/templates/listentry/Details.jsx b/vis/js/templates/listentry/Details.jsx
index 88733b650..73de5debe 100644
--- a/vis/js/templates/listentry/Details.jsx
+++ b/vis/js/templates/listentry/Details.jsx
@@ -1,27 +1,32 @@
import React from "react";
+import { connect } from "react-redux";
import Highlight from "../../components/Highlight";
-const Details = ({ authors, source }) => {
+const Details = ({ authors, source, isSelected }) => {
return (
// html template starts here
-
+
{authors}
-
+
{!!source && (
- <>
+
in
{source}
- >
+
)}
// html template ends here
);
};
-export default Details;
+const mapStateToProps = (state) => ({
+ isSelected: !!state.selectedPaper,
+});
+
+export default connect(mapStateToProps)(React.memo(Details));
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index a4c41c50f..e0be2c087 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -180,18 +180,24 @@
font-weight: $fontweight400;
}
- .list_in {
- color: $list_detail_in;
- }
+ .list_source {
+ padding-top: 3px;
+
+ &.short {
+ text-overflow: ellipsis;
+ height: min-content;
+ overflow: hidden;
+ white-space: nowrap;
+ }
- .list_published_in {
- color: $black;
- font-style: italic;
- }
+ .list_in {
+ color: $list_detail_in;
+ }
- .list_pubyear {
- font-weight: $fontweight700;
- color: $black;
+ .list_published_in {
+ color: $black;
+ font-style: italic;
+ }
}
}
}
From 9aa7872ba3a6d51321718182ddc649f547939e08 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 14:41:47 +0100
Subject: [PATCH 11/34] fixed dimensions in embed mode
---
vis/js/utils/dimensions.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/vis/js/utils/dimensions.js b/vis/js/utils/dimensions.js
index d59558857..c6dbba57f 100644
--- a/vis/js/utils/dimensions.js
+++ b/vis/js/utils/dimensions.js
@@ -1,7 +1,7 @@
import $ from "jquery";
// these constants are hardcoded dimensions of various headstart parts
-const TITLE_HEIGHT = 54.2;
+const TITLE_HEIGHT = 54.7;
const TOOLBAR_HEIGHT = 66;
const TITLE_IMAGE_HEIGHT = 70;
const SHOW_HIDE_BTN_HEIGHT = 34;
@@ -11,10 +11,12 @@ const LIST_HEIGHT_CORRECTION = 10;
const VIS_COL_RATIO = 0.6;
const MODALS_WIDTH = 43;
+const CREATED_BY_HEIGHT = 50;
+
const FOOTER_HEIGHT = {
- base: 50,
- pubmed: 50,
- triple: 50,
+ base: CREATED_BY_HEIGHT,
+ pubmed: CREATED_BY_HEIGHT,
+ triple: CREATED_BY_HEIGHT,
default: 0,
};
From a3e12a613488f246955cac90e123c150ec3d3dd0 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 16:02:02 +0100
Subject: [PATCH 12/34] fixed tests
---
.../listentry/ClassificationListEntry.jsx | 2 +-
.../{ => listentry}/PaperButtons.jsx | 6 +-
.../templates/listentry/StandardListEntry.jsx | 2 +-
vis/test/component/list-base.test.js | 2 +-
vis/test/component/list.test.js | 5 +-
.../__snapshots__/list-base.test.js.snap | 1101 +++++++++--------
6 files changed, 578 insertions(+), 540 deletions(-)
rename vis/js/templates/{ => listentry}/PaperButtons.jsx (80%)
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index 8c8840c69..eb8d6ed63 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -10,7 +10,7 @@ import {
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import { shorten } from "../../utils/string";
-import PaperButtons from "../PaperButtons";
+import PaperButtons from "./PaperButtons";
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
diff --git a/vis/js/templates/PaperButtons.jsx b/vis/js/templates/listentry/PaperButtons.jsx
similarity index 80%
rename from vis/js/templates/PaperButtons.jsx
rename to vis/js/templates/listentry/PaperButtons.jsx
index 8bafffbf6..03224891e 100644
--- a/vis/js/templates/PaperButtons.jsx
+++ b/vis/js/templates/listentry/PaperButtons.jsx
@@ -1,9 +1,9 @@
import React from "react";
import { connect } from "react-redux";
-import useMatomo from "../utils/useMatomo";
-import { getPaperPDFClickHandler } from "../utils/data";
-import { mapDispatchToListEntriesProps } from "../utils/eventhandlers";
+import useMatomo from "../../utils/useMatomo";
+import { getPaperPDFClickHandler } from "../../utils/data";
+import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
const PaperButtons = ({ paper, handlePDFClick }) => {
const { trackEvent } = useMatomo();
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index eeb1caced..f8a729ceb 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -11,7 +11,7 @@ import {
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import { shorten } from "../../utils/string";
-import PaperButtons from "../PaperButtons";
+import PaperButtons from "./PaperButtons";
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
diff --git a/vis/test/component/list-base.test.js b/vis/test/component/list-base.test.js
index b6ad79a6b..f4bc9c734 100644
--- a/vis/test/component/list-base.test.js
+++ b/vis/test/component/list-base.test.js
@@ -201,7 +201,7 @@ describe("List entries component - special BASE tests", () => {
);
});
- const pdfPreview = container.querySelector(".link2.oa-link");
+ const pdfPreview = container.querySelector(".paper_button");
act(() => {
ReactTestUtils.Simulate.click(pdfPreview);
});
diff --git a/vis/test/component/list.test.js b/vis/test/component/list.test.js
index 8311615a5..a7f5f3b98 100644
--- a/vis/test/component/list.test.js
+++ b/vis/test/component/list.test.js
@@ -1140,7 +1140,7 @@ describe("List entries component", () => {
);
});
- const pdfPreview = container.querySelector(".link2.oa-link");
+ const pdfPreview = container.querySelector(".paper_button");
act(() => {
ReactTestUtils.Simulate.click(pdfPreview);
});
@@ -1183,6 +1183,7 @@ describe("List entries component", () => {
free_access: true,
oa_link: "https://www.nature.com/articles/nrmicro2090.pdf",
outlink: "https://doi.org/10.1038/nrmicro2090",
+ year: "2020",
},
],
},
@@ -1207,7 +1208,7 @@ describe("List entries component", () => {
});
expect(container.querySelector("#paper_list_title").textContent).toEqual(
- storeObject.localization.default_paper_title
+ `${storeObject.localization.default_paper_title} (2020)`
);
expect(container.querySelector(".list_authors").textContent).toEqual(
storeObject.localization.default_authors
diff --git a/vis/test/snapshot/__snapshots__/list-base.test.js.snap b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
index a620b5b75..48c74987f 100644
--- a/vis/test/snapshot/__snapshots__/list-base.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
@@ -304,6 +304,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-in, p
>
-
-
@@ -366,7 +352,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-in, p
P. K. Paul, P. S. Aithal
-
+
+
+
+
+ PDF
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -961,6 +961,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1022,67 +1020,71 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
S Brown
-
-
- in
-
-
+
-
-
- Brown , S 2014 , ' Conceptualizing
-
-
- digital
-
-
- literacies and
-
-
- digital
-
-
- ethics for sustainability
-
-
- education
-
-
- ' International Journal of Sustainability in Higher
-
-
- Education
-
-
- , vol 15 , no. 3 , pp. 280-290 . DOI:10.1108/IJSHE-08-2012-0078
+
+ in
+
+
+
+
+ Brown , S 2014 , ' Conceptualizing
+
+
+ digital
+
+
+ literacies and
+
+
+ digital
+
+
+ ethics for sustainability
+
+
+ education
+
+
+ ' International Journal of Sustainability in Higher
+
+
+ Education
+
+
+ , vol 15 , no. 3 , pp. 280-290 . DOI:10.1108/IJSHE-08-2012-0078
+
-
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -1214,6 +1220,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1276,7 +1268,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
P. K. Paul, P. S. Aithal
-
+
+
+
+
+ PDF
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -1386,6 +1392,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1441,7 +1445,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Rachel Buchanan
-
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -1540,6 +1548,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1595,29 +1601,33 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Jenny M Lane
-
-
- in
-
-
+
-
-
- Australian Journal of Teacher
-
-
- Education
+
+ in
+
+
+
+
+ Australian Journal of Teacher
+
+
+ Education
+
-
+
+
Decision support, Digital food education, Education revolution
@@ -1727,6 +1741,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1794,7 +1806,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Jane Seale, E.A. Draffan, Mike Wald
-
+
+
Higher education institutions, Digital inclusion, Higher education students
@@ -1888,6 +1904,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -1944,29 +1958,33 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Jean D. COMEAU, Tung Lai CHENG
-
-
- in
-
-
+
-
-
- Volume: 14, Issue: 3 198-224 ; 1302-6488 ; Turkish Online Journal of Distance
-
-
- Education
+
+ in
+
+
+
+
+ Volume: 14, Issue: 3 198-224 ; 1302-6488 ; Turkish Online Journal of Distance
+
+
+ Education
+
-
+
+
Decision support, Digital food education, Education revolution
@@ -2076,6 +2098,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -2143,7 +2151,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Thamasan Suwanroj, Punnee Leekitchwatana, Paitoon Pimdee
-
+
+
+
+
+ PDF
+
+
Higher education institutions, Digital inclusion, Higher education students
@@ -2253,6 +2275,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -2320,34 +2328,38 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Christopher M. OWUSU-ANSAH, Antonio da Silva RODRIGUES, Thomas B. van der WALT
-
-
- in
-
-
+
-
-
- The Turkish Online Journal of Distance
-
-
- Education
-
-
- , Vol 20, Iss 2, Pp 89-104 (2019)
+
+ in
+
+
+
+
+ The Turkish Online Journal of Distance
+
+
+ Education
+
+
+ , Vol 20, Iss 2, Pp 89-104 (2019)
+
-
+
+
+
+
+ PDF
+
+
-
-
@@ -2552,23 +2558,27 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Melchor Gómez
-
-
- in
-
-
+
-
-
- Tendencias Pedagógicas; Vol. 29 (2017): Tecnologías, educación y brecha digital; 7-8 ; 1989-8614 ; 1133-2654 ; 10.15366/tp2017.29
+
+ in
+
+
+
+
+ Tendencias Pedagógicas; Vol. 29 (2017): Tecnologías, educación y brecha digital; 7-8 ; 1989-8614 ; 1133-2654 ; 10.15366/tp2017.29
+
-
+
+
+
+
+ PDF
+
+
Digital age, Academic dishonesty, Brecha digital
@@ -2678,6 +2702,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -2740,62 +2750,66 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Olga Vindača
-
-
+
- in
-
-
-
-
- Education
-
-
- Reform:
-
-
- Education
-
-
- Content Research and Implementation Problems; Vol 1 (2019):
-
-
- Education
-
-
- Reform:
-
-
- Education
-
-
- Content Research and Implementation Problems; 67-78 ; 2661-5266 ; 2661-5258
+
+ in
+
+
+
+
+ Education
+
+
+ Reform:
+
+
+ Education
+
+
+ Content Research and Implementation Problems; Vol 1 (2019):
+
+
+ Education
+
+
+ Reform:
+
+
+ Education
+
+
+ Content Research and Implementation Problems; 67-78 ; 2661-5266 ; 2661-5258
+
-
+
+
+
+
+ PDF
+
+
Higher education institutions, Digital inclusion, Higher education students
@@ -2894,6 +2922,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -2944,7 +2970,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Anna-Lena Godhe
-
+
+
Digital competence, Teacher education, Competencia digital
@@ -3076,6 +3106,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3132,23 +3148,27 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Simon Collin, Périne Brotcorne
-
-
- in
-
-
+
-
-
- The International Journal of Information and Learning Technology, Vol. 36, no.2, p. 169-18 (2019)
+
+ in
+
+
+
+
+ The International Journal of Information and Learning Technology, Vol. 36, no.2, p. 169-18 (2019)
+
-
+
+
+
+
+ PDF
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -3269,6 +3303,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3308,7 +3340,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Jean Edwards
-
+
+
Higher education institutions, Digital inclusion, Higher education students
@@ -3396,6 +3432,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3451,7 +3485,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Michael Gard, Eimear Enright
-
+
+
Decision support, Digital food education, Education revolution
@@ -3583,6 +3621,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3650,23 +3674,27 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Leila Kajee
-
-
+
- in
-
-
-
-
- South African Journal of Education; Vol 38, No 2 (2018); 1-9 ; 2076-3433 ; 0256-0100
+
+ in
+
+
+
+
+ South African Journal of Education; Vol 38, No 2 (2018); 1-9 ; 2076-3433 ; 0256-0100
+
-
+
+
+
+
+ PDF
+
+
Digital citizenship, Digital education revolution, Digital literacies
@@ -3754,6 +3796,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3787,56 +3827,60 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Ryan Garlick, Robert G. Akl
-
-
+
- in
-
-
-
-
- International Network for Engineering
-
-
- Education
-
-
- and Research (iNEER) Special Volume: Innovations 2007 - World Innovations in Engineering
-
-
- Education
-
-
- and Research, 2007, Arlington: International Network for Engineering
-
-
- Education
-
-
- and Research, pp. 1-9
+
+ in
+
+
+
+
+ International Network for Engineering
+
+
+ Education
+
+
+ and Research (iNEER) Special Volume: Innovations 2007 - World Innovations in Engineering
+
+
+ Education
+
+
+ and Research, 2007, Arlington: International Network for Engineering
+
+
+ Education
+
+
+ and Research, pp. 1-9
+
-
+
+
Information commons, Metadata education, Public education
@@ -3924,6 +3972,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -3991,7 +4025,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Agnes Chigona
-
+
+
+
+
+ PDF
+
+
-
-
@@ -4185,7 +4202,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Pilar Aristizabal Llorente, Esther Cruz Iglesias
-
+
+
+
+
+ PDF
+
+
Digital competence, Teacher education, Competencia digital
@@ -4284,6 +4315,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -4323,7 +4352,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Alicia Stewart, Krista Radspinner
-
+
+
Information commons, Metadata education, Public education
@@ -4422,6 +4455,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
>
-
-
@@ -4489,23 +4508,27 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
Agnieszka Wierzbicka
-
-
+
- in
-
-
-
-
- Acta Universitatis Lodziensis. Folia Litteraria Polonica, Vol 56, Iss 1, Pp 127-141 (2020)
+
+ in
+
+
+
+
+ Acta Universitatis Lodziensis. Folia Litteraria Polonica, Vol 56, Iss 1, Pp 127-141 (2020)
+
-
+
+
+
+
+ PDF
+
+
Decision support, Digital food education, Education revolution
From 85d44887ebba2f4fe83913b222c0e6fcc8e53aaf Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 16:18:49 +0100
Subject: [PATCH 13/34] improved abstract
---
vis/js/templates/listentry/Abstract.jsx | 20 ++++++++++++++++---
vis/js/templates/listentry/BasicListEntry.jsx | 8 +-------
.../listentry/ClassificationListEntry.jsx | 8 +-------
.../templates/listentry/StandardListEntry.jsx | 8 +-------
4 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/vis/js/templates/listentry/Abstract.jsx b/vis/js/templates/listentry/Abstract.jsx
index 65f39460e..b12480d79 100644
--- a/vis/js/templates/listentry/Abstract.jsx
+++ b/vis/js/templates/listentry/Abstract.jsx
@@ -1,18 +1,32 @@
import React from "react";
+import { connect } from "react-redux";
import { useLocalizationContext } from "../../components/LocalizationProvider";
import Highlight from "../../components/Highlight";
+import { shorten } from "../../utils/string";
-const Abstract = ({ text }) => {
+const Abstract = ({ text, maxLength }) => {
const loc = useLocalizationContext();
+ let finalContent = text;
+ if (!finalContent) {
+ finalContent = loc.default_abstract;
+ }
+ if (maxLength) {
+ finalContent = shorten(finalContent, maxLength);
+ }
+
return (
// html template starts here
- {text ? text : loc.default_abstract}
+ {finalContent}
// html template ends here
);
};
-export default Abstract;
+const mapStateToProps = (state) => ({
+ maxLength: state.selectedPaper ? null : state.list.abstractSize,
+});
+
+export default connect(mapStateToProps)(React.memo(Abstract));
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index 45991e573..782beb0e3 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -8,7 +8,6 @@ import {
getPaperPreviewLink,
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { shorten } from "../../utils/string";
import Abstract from "./Abstract";
import AccessIcons from "./AccessIcons";
@@ -26,7 +25,6 @@ import Title from "./Title";
*/
const BasicListEntry = ({
paper,
- abstractSize,
baseUnit,
handlePDFClick,
// deprecated
@@ -47,9 +45,6 @@ const BasicListEntry = ({
showPreviewImage,
previewImage: showRealPreviewImage ? getPaperPreviewImage(paper) : null,
};
- const abstract = abstractSize
- ? shorten(paper.paper_abstract, abstractSize)
- : paper.paper_abstract;
const readers = paper.num_readers;
return (
@@ -70,7 +65,7 @@ const BasicListEntry = ({
source={paper.published_in}
/>
-
+
{!!preview.showPreviewImage && !!preview.onClickPDF && (
({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
baseUnit: state.list.baseUnit,
showPreviewImage: !!state.selectedPaper,
showRealPreviewImage: state.list.showRealPreviewImage,
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index eb8d6ed63..fb05ff842 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -9,7 +9,6 @@ import {
getPaperTextLink,
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { shorten } from "../../utils/string";
import PaperButtons from "./PaperButtons";
import Abstract from "./Abstract";
@@ -30,7 +29,6 @@ import Title from "./Title";
const ClassificationListEntry = ({
paper,
linkType,
- abstractSize,
isStreamgraph,
showBacklink,
isInStreamBacklink,
@@ -46,9 +44,6 @@ const ClassificationListEntry = ({
};
const link = getPaperTextLink(paper, linkType);
const classification = getPaperClassification(paper, loc);
- const abstract = abstractSize
- ? shorten(paper.paper_abstract, abstractSize)
- : paper.paper_abstract;
const keywords = getPaperKeywords(paper, loc);
const backlink = {
show: showBacklink,
@@ -76,7 +71,7 @@ const ClassificationListEntry = ({
{classification}
{keywords}
-
+
{!isStreamgraph &&
}
{!!backlink.show && (
@@ -91,7 +86,6 @@ const ClassificationListEntry = ({
};
const mapStateToProps = (state) => ({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
linkType: state.list.linkType,
isStreamgraph: state.chartType === STREAMGRAPH_MODE,
showBacklink: state.chartType === STREAMGRAPH_MODE && !!state.selectedPaper,
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index f8a729ceb..ed654e5bb 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -10,7 +10,6 @@ import {
getPaperTextLink,
} from "../../utils/data";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
-import { shorten } from "../../utils/string";
import PaperButtons from "./PaperButtons";
import Abstract from "./Abstract";
@@ -37,7 +36,6 @@ const StandardListEntry = ({
paper,
linkType,
showDocumentType,
- abstractSize,
showKeywords,
showMetrics,
isContentBased,
@@ -59,9 +57,6 @@ const StandardListEntry = ({
const tags = getPaperTags(paper);
const link = getPaperTextLink(paper, linkType);
const documentType = showDocumentType ? paper.resulttype : null;
- const abstract = abstractSize
- ? shorten(paper.paper_abstract, abstractSize)
- : paper.paper_abstract;
const comments = getPaperComments(paper);
const keywords = showKeywords ? getPaperKeywords(paper, loc) : null;
const metrics = showMetrics
@@ -100,7 +95,7 @@ const StandardListEntry = ({
{!!documentType &&
}
-
+
{!!comments &&
}
{!!keywords &&
{keywords} }
{!!metrics && (
@@ -128,7 +123,6 @@ const StandardListEntry = ({
};
const mapStateToProps = (state) => ({
- abstractSize: state.selectedPaper ? null : state.list.abstractSize,
linkType: state.list.linkType,
showDocumentType: state.list.showDocumentType,
showMetrics: state.list.showMetrics,
From ba8c693302deade95fc3ba291c9bb03b043a93b5 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 17 Nov 2021 17:32:08 +0100
Subject: [PATCH 14/34] abbreviating authors too
---
vis/js/io.js | 45 ++-----------------
vis/js/templates/listentry/BasicListEntry.jsx | 7 +--
.../listentry/ClassificationListEntry.jsx | 7 +--
vis/js/templates/listentry/Details.jsx | 44 +++++++++++++++++-
.../templates/listentry/StandardListEntry.jsx | 7 +--
vis/js/utils/data.js | 32 +++++++++++++
6 files changed, 81 insertions(+), 61 deletions(-)
diff --git a/vis/js/io.js b/vis/js/io.js
index b0e024477..f4ad83fcd 100644
--- a/vis/js/io.js
+++ b/vis/js/io.js
@@ -5,6 +5,7 @@ import d3 from "d3";
import config from 'config';
import { mediator } from 'mediator';
+import { getAuthorsList } from "./utils/data";
var IO = function() {
this.test = 0;
@@ -47,43 +48,6 @@ IO.prototype = {
});
},
- convertToFirstNameLastName: function (all_authors) {
- const authors = all_authors.split(";");
-
- for(let i = authors.length - 1; i >= 0; i--) {
- if(authors[i] === "") {
- authors.splice(i, 1);
- }
- }
-
- let authors_string = "";
- let authors_short_string = "";
- for (let i = 0; i < authors.length; i++) {
- const names = authors[i].trim().split(",");
- const last_name = names[0].trim();
- if (names.length > 1) {
- var first_name = names[1].trim();
-
- if(config.convert_author_names === true) {
- authors_string += first_name + " " + last_name;
- authors_short_string += first_name.substr(0, 1) + ". " + last_name;
- } else {
- authors_string += last_name + ", " + first_name;
- authors_short_string += last_name + ", " + first_name.substr(0, 1) + ". ";
- }
- } else {
- authors_string += last_name;
- authors_short_string += last_name;
- }
-
- if (i < (authors.length - 1)) {
- authors_string += ", ";
- authors_short_string += ", ";
- }
- }
- return { string: authors_string, short_string: authors_short_string };
- },
-
setToStringIfNullOrUndefined: function (element, strng) {
if (element === null || typeof element === "undefined") {
return strng;
@@ -158,11 +122,8 @@ IO.prototype = {
}
}
- // convert authors to "[first name] [last name]"
- // var authors = d.authors.split(";");
- var authors = _this.convertToFirstNameLastName(d.authors);
- d.authors_string = authors.string;
- d.authors_short_string = authors.short_string;
+ var authorsList = getAuthorsList(d.authors, config.convert_author_names);
+ d.authors_string = authorsList.join(", ");
//replace "<" and ">" to avoid having HTML tags
for (let field in d) {
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index 782beb0e3..a84e8ac05 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -58,12 +58,7 @@ const BasicListEntry = ({
/>
-
+
{!!preview.showPreviewImage && !!preview.onClickPDF && (
diff --git a/vis/js/templates/listentry/ClassificationListEntry.jsx b/vis/js/templates/listentry/ClassificationListEntry.jsx
index fb05ff842..5fce03947 100644
--- a/vis/js/templates/listentry/ClassificationListEntry.jsx
+++ b/vis/js/templates/listentry/ClassificationListEntry.jsx
@@ -61,12 +61,7 @@ const ClassificationListEntry = ({
isDataset={access.isDataset}
/>
-
+
{classification}
diff --git a/vis/js/templates/listentry/Details.jsx b/vis/js/templates/listentry/Details.jsx
index 73de5debe..78c433934 100644
--- a/vis/js/templates/listentry/Details.jsx
+++ b/vis/js/templates/listentry/Details.jsx
@@ -2,13 +2,27 @@ import React from "react";
import { connect } from "react-redux";
import Highlight from "../../components/Highlight";
+import { useLocalizationContext } from "../../components/LocalizationProvider";
+import { getAuthorsList } from "../../utils/data";
+
+const MAX_AUTHORS_LENGTH = 100;
const Details = ({ authors, source, isSelected }) => {
+ const loc = useLocalizationContext();
+
+ const authorsList = getAuthorsList(authors);
+ const authorsString = getAuthorsString(
+ authorsList,
+ isSelected ? Number.POSITIVE_INFINITY : MAX_AUTHORS_LENGTH
+ );
+
return (
// html template starts here
- {authors}
+
+ {authorsString ? authorsString : loc.default_authors}
+
{!!source && (
@@ -30,3 +44,31 @@ const mapStateToProps = (state) => ({
});
export default connect(mapStateToProps)(React.memo(Details));
+
+const getAuthorsString = (authorsList, maxLength) => {
+ if (!authorsList || authorsList.length === 0) {
+ return "";
+ }
+
+ const ellipsis = "...";
+ const join = ", ";
+ let finalString = authorsList.shift();
+ while (authorsList.length > 0) {
+ const nextAuthor = authorsList.shift();
+ let nextPossibleLength =
+ finalString.length + join.length + nextAuthor.length;
+
+ if (authorsList.length !== 0) {
+ nextPossibleLength += ellipsis.length;
+ }
+
+ if (nextPossibleLength > maxLength) {
+ finalString += ellipsis;
+ break;
+ }
+
+ finalString += join + nextAuthor;
+ }
+
+ return finalString;
+};
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index ed654e5bb..6a4384291 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -86,12 +86,7 @@ const StandardListEntry = ({
tags={tags ? : null}
/>
-
+
{!!documentType &&
}
diff --git a/vis/js/utils/data.js b/vis/js/utils/data.js
index f79b9a011..66588766f 100644
--- a/vis/js/utils/data.js
+++ b/vis/js/utils/data.js
@@ -326,6 +326,38 @@ export const getPaperTags = (paper) => {
return null;
};
+/**
+ * Parses the paper's authors string.
+ *
+ * @param {string} authors semicolon-separated authors
+ *
+ * @returns list of authors names and surnames
+ */
+export const getAuthorsList = (authors, firstNameFirst = true) => {
+ if (typeof authors !== "string") {
+ return "";
+ }
+
+ return authors
+ .split(";")
+ .filter((a) => !!a)
+ .map((a) => {
+ const namesList = a.trim().split(",");
+ const lastName = namesList[0].trim();
+ if (namesList.length < 2) {
+ return lastName;
+ }
+
+ const firstName = namesList[1].trim();
+
+ if (firstNameFirst) {
+ return `${firstName} ${lastName}`;
+ }
+
+ return `${lastName} ${firstName}`;
+ });
+};
+
const ATTRS_TO_CHECK = [
"id",
"authors",
From 8a9f1cf03cf1168cc3f9bfa20c2633f2734cf6f0 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 18 Nov 2021 08:49:51 +0100
Subject: [PATCH 15/34] linter fixes
---
vis/js/templates/listentry/BasicListEntry.jsx | 3 ---
vis/js/utils/useMatomo.js | 1 +
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/vis/js/templates/listentry/BasicListEntry.jsx b/vis/js/templates/listentry/BasicListEntry.jsx
index a84e8ac05..38e1d0808 100644
--- a/vis/js/templates/listentry/BasicListEntry.jsx
+++ b/vis/js/templates/listentry/BasicListEntry.jsx
@@ -1,7 +1,6 @@
import React from "react";
import { connect } from "react-redux";
-import { useLocalizationContext } from "../../components/LocalizationProvider";
import {
getPaperPDFClickHandler,
getPaperPreviewImage,
@@ -31,8 +30,6 @@ const BasicListEntry = ({
showPreviewImage,
showRealPreviewImage,
}) => {
- const loc = useLocalizationContext();
-
const id = paper.safe_id;
const access = {
isOpenAccess: !!paper.oa,
diff --git a/vis/js/utils/useMatomo.js b/vis/js/utils/useMatomo.js
index b826fcd62..859dac6f5 100644
--- a/vis/js/utils/useMatomo.js
+++ b/vis/js/utils/useMatomo.js
@@ -1,3 +1,4 @@
+/* eslint-disable no-undef */
const useMatomo = () => {
const trackEvent = trackMatomoEvent;
From 26c402f56db89d477e74d048cb77326585fef11b Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 22 Nov 2021 09:58:02 +0100
Subject: [PATCH 16/34] fixed area css in combination with citations
---
vis/js/templates/listentry/Area.jsx | 2 ++
vis/js/templates/listentry/BasicListEntry.jsx | 6 +++---
vis/js/templates/listentry/Readers.jsx | 14 --------------
vis/js/templates/listentry/StandardListEntry.jsx | 15 +++++++++------
vis/stylesheets/modules/list/_entry.scss | 6 +++++-
5 files changed, 19 insertions(+), 24 deletions(-)
delete mode 100644 vis/js/templates/listentry/Readers.jsx
diff --git a/vis/js/templates/listentry/Area.jsx b/vis/js/templates/listentry/Area.jsx
index e0ba07318..0998da3f2 100644
--- a/vis/js/templates/listentry/Area.jsx
+++ b/vis/js/templates/listentry/Area.jsx
@@ -7,6 +7,7 @@ import useMatomo from "../../utils/useMatomo";
const Area = ({
paper,
+ isShort = false,
trackMouseOver,
disableClicks,
handleZoomIn,
@@ -35,6 +36,7 @@ const Area = ({
// html template starts here
)}
-
-
+
+
// html template ends here
);
diff --git a/vis/js/templates/listentry/Readers.jsx b/vis/js/templates/listentry/Readers.jsx
deleted file mode 100644
index 7e0fdcd4f..000000000
--- a/vis/js/templates/listentry/Readers.jsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import React from "react";
-
-const Readers = ({ number, label }) => {
- return (
- // html template starts here
-
- {label} {" "}
- {number}
-
- // html template ends here
- );
-};
-
-export default Readers;
diff --git a/vis/js/templates/listentry/StandardListEntry.jsx b/vis/js/templates/listentry/StandardListEntry.jsx
index 6a4384291..7d1a9028b 100644
--- a/vis/js/templates/listentry/StandardListEntry.jsx
+++ b/vis/js/templates/listentry/StandardListEntry.jsx
@@ -72,8 +72,13 @@ const StandardListEntry = ({
isInStream: isInStreamBacklink,
onClick: () => handleBacklinkClick(),
};
- const citations =
- !isContentBased && !!baseUnit && !showMetrics ? paper.num_readers : null;
+
+ const citations = paper.num_readers;
+ const showCitations =
+ !isContentBased &&
+ !!baseUnit &&
+ !showMetrics &&
+ (!!citations || parseInt(citations) === 0);
return (
// html template starts here
@@ -102,10 +107,8 @@ const StandardListEntry = ({
/>
)}
- {!isStreamgraph && }
- {(!!citations || parseInt(citations) === 0) && (
-
- )}
+ {!isStreamgraph && }
+ {showCitations && }
{!!backlink.show && (
Date: Mon, 22 Nov 2021 11:43:13 +0100
Subject: [PATCH 17/34] max length of authors string reduced to 90
---
vis/js/templates/listentry/Details.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis/js/templates/listentry/Details.jsx b/vis/js/templates/listentry/Details.jsx
index 78c433934..9b401984d 100644
--- a/vis/js/templates/listentry/Details.jsx
+++ b/vis/js/templates/listentry/Details.jsx
@@ -5,7 +5,7 @@ import Highlight from "../../components/Highlight";
import { useLocalizationContext } from "../../components/LocalizationProvider";
import { getAuthorsList } from "../../utils/data";
-const MAX_AUTHORS_LENGTH = 100;
+const MAX_AUTHORS_LENGTH = 90;
const Details = ({ authors, source, isSelected }) => {
const loc = useLocalizationContext();
From a6a80f88312ce78a3c21d9f8fe02c1ea2f9e52c3 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 22 Nov 2021 12:01:22 +0100
Subject: [PATCH 18/34] css fix: more info link is now span
---
vis/js/templates/contextfeatures/MoreInfoLink.jsx | 4 ++--
vis/stylesheets/modules/map/_header.scss | 10 ++++------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/vis/js/templates/contextfeatures/MoreInfoLink.jsx b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
index ec57661bd..f2753d3ff 100644
--- a/vis/js/templates/contextfeatures/MoreInfoLink.jsx
+++ b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
@@ -22,9 +22,9 @@ const MoreInfoLink = ({ onClick }) => {
return (
// html template starts here
-
+
{loc.intro_label}
-
+
// html template ends here
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 319283fa1..203dbf956 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -59,17 +59,15 @@
#context {
font-size: 11px;
color: $black;
- button {
- background: none!important;
- border: none;
- padding: 0!important;
- cursor: pointer!important;
- }
.context_moreinfo {
border-bottom: 1px solid $medium-blue;
cursor: help;
color: $medium-blue;
+ &.clickable {
+ cursor: pointer;
+ }
+
&:hover {
border-bottom: 2px solid $medium-blue;
}
From dc148283996960539c63eb93ea8bc2647c2cac93 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 22 Nov 2021 15:52:05 +0100
Subject: [PATCH 19/34] fixed covis comments css
---
vis/stylesheets/modules/list/_entry.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 3ab6856fe..547101c88 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -889,7 +889,7 @@ img#preview_page {
.comments .comment-text {
font-size: 12px;
- padding-right: 10px;
+ max-width: 95%;
background-color: #f1f1f1;
padding: 5px;
border-radius: 5px;
From b904d00d19fa279463d044f7234fa8d3919e7d90 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 22 Nov 2021 17:02:57 +0100
Subject: [PATCH 20/34] adjusted paper link length
---
vis/stylesheets/modules/list/_entry.scss | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 547101c88..665d5d381 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -200,6 +200,11 @@
}
}
}
+
+ .doi_outlink {
+ padding-right: 0;
+ max-width: 98%;
+ }
}
#list_abstract {
From 2a1a2b77c98a21bb36916ad7972059627b230d13 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Tue, 23 Nov 2021 12:24:54 +0100
Subject: [PATCH 21/34] fixed button->span tests
---
vis/test/component/contextline.test.js | 2 +-
.../__snapshots__/contextline.test.js.snap | 24 +++++++++----------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/vis/test/component/contextline.test.js b/vis/test/component/contextline.test.js
index 3db0767fa..82e807634 100644
--- a/vis/test/component/contextline.test.js
+++ b/vis/test/component/contextline.test.js
@@ -1138,7 +1138,7 @@ describe("Context line component", () => {
);
});
- const select = document.querySelector("#more-info-link button");
+ const select = document.querySelector("#more-info-link span");
act(() => {
const event = new Event("click", { bubbles: true });
select.dispatchEvent(event);
diff --git a/vis/test/snapshot/__snapshots__/contextline.test.js.snap b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
index 34f3c62b6..c86c93901 100644
--- a/vis/test/snapshot/__snapshots__/contextline.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
@@ -37,8 +37,8 @@ exports[`Context line component snapshot matches a covis snapshot 1`] = `
className="context_item"
id="more-info-link"
>
-
@@ -90,8 +90,8 @@ exports[`Context line component snapshot matches a linkedcat authorview snapshot
className="context_item"
id="more-info-link"
>
-
@@ -148,8 +148,8 @@ exports[`Context line component snapshot matches a linkedcat keywordview snapsho
className="context_item"
id="more-info-link"
>
-
@@ -242,8 +242,8 @@ exports[`Context line component snapshot matches a project website (base low qua
className="context_item"
id="more-info-link"
>
-
@@ -336,8 +336,8 @@ exports[`Context line component snapshot matches a project website (pubmed high
className="context_item"
id="more-info-link"
>
-
@@ -402,8 +402,8 @@ exports[`Context line component snapshot matches a viper snapshot 1`] = `
className="context_item"
id="more-info-link"
>
-
From 9c3083ed159ed2c8bfa8e74fbe993cadb2f4b05a Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Wed, 24 Nov 2021 17:28:05 +0100
Subject: [PATCH 22/34] changed project website color theme
---
.../contextfeatures/MoreInfoLink.jsx | 2 +-
vis/stylesheets/base/_colors.scss | 19 ++++++++++++----
vis/stylesheets/base/_default_settings.scss | 6 ++---
vis/stylesheets/components/_buttons.scss | 6 +++--
vis/stylesheets/modules/_footer.scss | 10 +++++----
vis/stylesheets/modules/_map.scss | 8 +++----
vis/stylesheets/modules/_modal.scss | 6 ++---
vis/stylesheets/modules/list/_entry.scss | 17 +++++++++-----
.../modules/list/_list-show-button.scss | 2 +-
vis/stylesheets/modules/map/_header.scss | 22 ++++++++++---------
10 files changed, 59 insertions(+), 39 deletions(-)
diff --git a/vis/js/templates/contextfeatures/MoreInfoLink.jsx b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
index f2753d3ff..8f1dba7c4 100644
--- a/vis/js/templates/contextfeatures/MoreInfoLink.jsx
+++ b/vis/js/templates/contextfeatures/MoreInfoLink.jsx
@@ -22,7 +22,7 @@ const MoreInfoLink = ({ onClick }) => {
return (
// html template starts here
-
+
{loc.intro_label}
diff --git a/vis/stylesheets/base/_colors.scss b/vis/stylesheets/base/_colors.scss
index d256f5403..fed895c49 100755
--- a/vis/stylesheets/base/_colors.scss
+++ b/vis/stylesheets/base/_colors.scss
@@ -14,7 +14,7 @@ $okm-blue: #2C3E52;
$okm-gray: #808B8D;
$okm-light-gray: #E1E5E6;
$okm-green: #51c9ae;
-$okm-clouds: #eff3f4;
+$okm-clouds: #F4F4F6;
// Text colors
$medium-blue: #4d7199;
@@ -22,13 +22,15 @@ $dark-red: #A70805;
$black: #444444;
$author-green: #216500;
$abstract-gray: #333; //#5c6d7f; //old: #444444
+$link-gray: #333;
$journal-gray: #4d7199; // old:#666666, 5c6d7f
-$list_metadata_title_paper: #4d7199;
-$list_show_hide_button: #4d7199; //#5c6d7f;
+$list_metadata_title_paper: #333;
+$list_show_hide_button: #2d3e52; //#5c6d7f;
$highlight-searchterm: #eff3f4;
+$modal-title: #2d3e52;
// Additional colors for buttons etc.
-$okm-modal-btn: #4d7199;
+$okm-modal-btn: #2d3e52;
$infolink: #E55137;
$framed-item: #4d7199;//gelb:#f1c500;
$dataset: #2C3E52;
@@ -58,10 +60,12 @@ $highlight: #e1e5e5;
$black: #444444;
$author-green: #216500;
$abstract-gray: #333; //#5c6d7f; //old: #444444
+ $link-gray : $medium-blue;
$journal-gray: #000000; // old:#666666
$list_metadata_title_paper: #3696e0;
$list_show_hide_button: #3696e0;
$highlight-searchterm: #F8F8F8;
+ $modal-title: $medium-blue;
// Additional colors
$okm-modal-btn: #3696e0;
@@ -81,11 +85,13 @@ $highlight: #e1e5e5;
$lower_value_tag: #2C316E;
$higher_value_tag: #DC2260;
$highlight-searchterm: #F4F4F6;
+ $modal-title: $medium-blue;
}
@if $skin == 'linkedcat' {
$dark-blue: #333;
$medium-blue: #0047bb;
+ $link-gray: $medium-blue;
$okm-clouds: #f1f1f1;
$okm-modal-btn: #0047bb;
$framed-item: #0047bb;
@@ -95,11 +101,13 @@ $highlight: #e1e5e5;
$okm-gray: #818181;
$paper-icon: #cbcbcb;
$highlight-searchterm: #dadada;
+ $modal-title: $medium-blue;
}
@if $skin == 'covis' {
$dark-blue: #333;
$medium-blue: #1e6662;
+ $link-gray: $medium-blue;
$okm-clouds: #f1f1f1;
$okm-modal-btn: #1e6662;
$framed-item: #1e6662;
@@ -111,11 +119,13 @@ $highlight: #e1e5e5;
$highlight-searchterm: #dadada;
$okm-red: #1e6662;
$infolink: #1e6662;
+ $modal-title: $medium-blue;
}
@if $skin == 'triple' {
$dark-blue: #666666;
$medium-blue: #622166;
+ $link-gray: $medium-blue;
$okm-clouds: #f1f1f1;
$okm-modal-btn: #622166;
$framed-item: #622166;
@@ -127,4 +137,5 @@ $highlight: #e1e5e5;
$highlight-searchterm: #EAEAEA;
$okm-red: #ed1c24;
$infolink: #622166;
+ $modal-title: $medium-blue;
}
\ No newline at end of file
diff --git a/vis/stylesheets/base/_default_settings.scss b/vis/stylesheets/base/_default_settings.scss
index 13eba6a7f..a49d281d8 100755
--- a/vis/stylesheets/base/_default_settings.scss
+++ b/vis/stylesheets/base/_default_settings.scss
@@ -15,10 +15,9 @@ $circle-zoom-unselected-fill: $dark-blue;
$circle-zoom-selected-fill: $white;
$circle-area: $white;
-$area-title-h2: $okm-blue;
+$area-title-h2: $link-gray;
//List colors
-$list_metadata_title_paper: $medium-blue;
$list_links: $okm-red;
$list_links_hover: $okm-blue;
$list_detail: $black;
@@ -28,13 +27,12 @@ $list_abstract: $abstract-gray;
$list_show_hide_button_hover: $okm-blue;
$list_explorer_header: $okm-clouds;
$list_show_hide_button_border: $okm-clouds;
-$list_metadata_title_paper: $medium-blue;
$list_metadata_border_color: $okm-light-gray; // unused
$list_abstract_border_left: $okm-light-gray; // unused
$multiplesview: $medium-blue;
-$papers_title: $medium-blue;
+$papers_title: $link-gray;
$papers_details: $black;
$papers_holder_a: $okm-red;
diff --git a/vis/stylesheets/components/_buttons.scss b/vis/stylesheets/components/_buttons.scss
index ffa94279a..c25a013f4 100755
--- a/vis/stylesheets/components/_buttons.scss
+++ b/vis/stylesheets/components/_buttons.scss
@@ -148,16 +148,18 @@ img#close-button {
}
.paper_buttons_row {
- margin: 10px 0px;
+ margin: 10px 0px 15px;
}
.paper_button {
color: white;
border: 1px solid #E55137;
background-color: #E55137;
- padding: 5px;
+ padding: 6px 4px;
border-radius: 5px;
cursor: pointer;
+ width: 100px;
+ font-weight: normal;
&:hover {
color: #E55137;
diff --git a/vis/stylesheets/modules/_footer.scss b/vis/stylesheets/modules/_footer.scss
index cdc5fbb63..7948f5267 100644
--- a/vis/stylesheets/modules/_footer.scss
+++ b/vis/stylesheets/modules/_footer.scss
@@ -5,11 +5,13 @@
}
.builtwith a {
- text-decoration: underline;
-}
-
-.builtwith a:hover {
text-decoration: none;
+ border-bottom: 1px solid $link-gray;
+ color: $link-gray;
+
+ &:hover {
+ border-bottom-width: 2px;
+ }
}
@media screen and (max-width: 640px) {
diff --git a/vis/stylesheets/modules/_map.scss b/vis/stylesheets/modules/_map.scss
index 7ab973094..61d094db8 100644
--- a/vis/stylesheets/modules/_map.scss
+++ b/vis/stylesheets/modules/_map.scss
@@ -133,8 +133,8 @@ text {
}
#filter_params, #sort {
- color: $okm-modal-btn;
- background-color: $white;
+ color: $white;
+ background-color: $okm-modal-btn;
border-color: $okm-modal-btn;
padding: 6px 4px !important;
}
@@ -145,8 +145,8 @@ text {
}
#filter_params:hover, #sort:hover {
- color: $white;
- background-color: $okm-modal-btn;
+ color: $okm-modal-btn;
+ background-color: $white;
border-color: $okm-modal-btn;
}
diff --git a/vis/stylesheets/modules/_modal.scss b/vis/stylesheets/modules/_modal.scss
index 11734d8fb..24029d59a 100644
--- a/vis/stylesheets/modules/_modal.scss
+++ b/vis/stylesheets/modules/_modal.scss
@@ -24,7 +24,7 @@
font-size: 16px;
font-family: $base-font-family;
margin: 20px 0px 10px;
- color: $medium-blue;
+ color: $modal-title;
}
.datasource-logo {
@@ -91,7 +91,7 @@
}
.modal-title {
- color: $medium-blue;
+ color: $modal-title;
font-size: 20px;
font-weight: $fontweight700;
font-family: $base-font-family;
@@ -188,7 +188,7 @@
}
.embed-modal-title, .cite-modal-title {
- color: $medium-blue;
+ color: $modal-title;
text-transform: uppercase;
margin: 0px;
font-size: 16px;
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 665d5d381..457b99669 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -153,12 +153,12 @@
}
.doi_outlink_link {
- color: $framed-item;
+ color: $link-gray;
text-decoration: none;
- border-bottom: 1px solid $framed-item;
+ border-bottom: 1px solid $link-gray;
&:hover {
- border-bottom: 3px solid $framed-item;
+ border-bottom: 3px solid $link-gray;
}
}
@@ -245,6 +245,11 @@ s.resulttype {
.area_tag, .keyword_tag {
font-weight: $fontweight700;
}
+
+ .keywords {
+ font-weight: normal;
+ color: #333;
+ }
}
#list_area {
@@ -264,13 +269,13 @@ s.resulttype {
}
.area_name {
- color: $medium-blue;
+ color: $link-gray;
cursor: pointer;
- border-bottom: 1px solid $medium-blue;
+ border-bottom: 1px solid $link-gray;
&:hover {
text-decoration: none;
- border-bottom: 2px solid $medium-blue;
+ border-bottom: 2px solid $link-gray;
}
}
}
diff --git a/vis/stylesheets/modules/list/_list-show-button.scss b/vis/stylesheets/modules/list/_list-show-button.scss
index 0da71f7d1..1e8bafbdc 100755
--- a/vis/stylesheets/modules/list/_list-show-button.scss
+++ b/vis/stylesheets/modules/list/_list-show-button.scss
@@ -19,7 +19,7 @@
}
#curr-filter-type, #curr-sort-type {
- font-weight: $fontweight700;
+ font-weight: normal;
}
.row {
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 203dbf956..1186a939f 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -32,12 +32,12 @@
height: 15px;
a {
- border-bottom: 1px solid $medium-blue;
- color: $medium-blue;
+ border-bottom: 1px solid $link-gray;
+ color: $link-gray;
text-decoration: none;
&:hover {
- border-bottom: 2px solid $medium-blue;
+ border-bottom: 2px solid $link-gray;
}
}
}
@@ -60,16 +60,18 @@
font-size: 11px;
color: $black;
.context_moreinfo {
- border-bottom: 1px solid $medium-blue;
+ border-bottom: 1px solid $link-gray;
cursor: help;
- color: $medium-blue;
+ color: $link-gray;
- &.clickable {
- cursor: pointer;
+ &:hover {
+ border-bottom-width: 2px;
}
- &:hover {
- border-bottom: 2px solid $medium-blue;
+ &.infolink {
+ cursor: pointer;
+ color: $infolink;
+ border-bottom-color: $infolink;
}
}
.modifier {
@@ -321,7 +323,7 @@
height: min-content; // 19.8px
overflow: hidden;
white-space: nowrap;
- max-width: 660px;
+ max-width: 800px;
}
.features {
From 8da0864e1c001c783d91bc4b322d8a1ef8240df5 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 25 Nov 2021 09:41:45 +0100
Subject: [PATCH 23/34] fixed area title color in other data integrations
---
vis/stylesheets/base/_colors.scss | 6 ++++++
vis/stylesheets/base/_default_settings.scss | 2 --
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/vis/stylesheets/base/_colors.scss b/vis/stylesheets/base/_colors.scss
index fed895c49..0c823137f 100755
--- a/vis/stylesheets/base/_colors.scss
+++ b/vis/stylesheets/base/_colors.scss
@@ -28,6 +28,7 @@ $list_metadata_title_paper: #333;
$list_show_hide_button: #2d3e52; //#5c6d7f;
$highlight-searchterm: #eff3f4;
$modal-title: #2d3e52;
+$area-title-h2: #333;
// Additional colors for buttons etc.
$okm-modal-btn: #2d3e52;
@@ -66,6 +67,7 @@ $highlight: #e1e5e5;
$list_show_hide_button: #3696e0;
$highlight-searchterm: #F8F8F8;
$modal-title: $medium-blue;
+ $area-title-h2: $okm-blue;
// Additional colors
$okm-modal-btn: #3696e0;
@@ -86,6 +88,7 @@ $highlight: #e1e5e5;
$higher_value_tag: #DC2260;
$highlight-searchterm: #F4F4F6;
$modal-title: $medium-blue;
+ $area-title-h2: $okm-blue;
}
@if $skin == 'linkedcat' {
@@ -102,6 +105,7 @@ $highlight: #e1e5e5;
$paper-icon: #cbcbcb;
$highlight-searchterm: #dadada;
$modal-title: $medium-blue;
+ $area-title-h2: $okm-blue;
}
@if $skin == 'covis' {
@@ -120,6 +124,7 @@ $highlight: #e1e5e5;
$okm-red: #1e6662;
$infolink: #1e6662;
$modal-title: $medium-blue;
+ $area-title-h2: $okm-blue;
}
@if $skin == 'triple' {
@@ -138,4 +143,5 @@ $highlight: #e1e5e5;
$okm-red: #ed1c24;
$infolink: #622166;
$modal-title: $medium-blue;
+ $area-title-h2: $okm-blue;
}
\ No newline at end of file
diff --git a/vis/stylesheets/base/_default_settings.scss b/vis/stylesheets/base/_default_settings.scss
index a49d281d8..c7de4be62 100755
--- a/vis/stylesheets/base/_default_settings.scss
+++ b/vis/stylesheets/base/_default_settings.scss
@@ -15,8 +15,6 @@ $circle-zoom-unselected-fill: $dark-blue;
$circle-zoom-selected-fill: $white;
$circle-area: $white;
-$area-title-h2: $link-gray;
-
//List colors
$list_links: $okm-red;
$list_links_hover: $okm-blue;
From b9329d9036285ff5239e253a99eca27df9fbc78d Mon Sep 17 00:00:00 2001
From: Jan Konstant <62649432+Konstiman@users.noreply.github.com>
Date: Thu, 25 Nov 2021 11:58:22 +0100
Subject: [PATCH 24/34] Create CHANGELOG.md
---
CHANGELOG.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..f272da46d
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,17 @@
+# Changelog
+
+## 2021-11-25
+
+### New features
+
+- zooming and selecting papers with browser's back/forward buttons
+- adding a zoomed bubble/selected paper name to the page title
+
+### Changes
+
+- improved hot reloading in webpack
+- urls of local examples have changed
+
+### Removed
+
+- dead tracking code (Google Analytics, our custom endpoint) and related config parameter
From 5ec288679bd8144c38935be96b75a31032a847df Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 25 Nov 2021 12:08:39 +0100
Subject: [PATCH 25/34] changed metadata quality to gray
---
vis/stylesheets/modules/map/_header.scss | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 1186a939f..65d68828c 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -309,10 +309,10 @@
//border-bottom-color: $okm-green !important;
//}
-.context_metadata_low {
- color: $okm-red !important;
- border-bottom-color: $okm-red !important;
-}
+//.context_metadata_low {
+ //color: $okm-red !important;
+ //border-bottom-color: $okm-red !important;
+//}
.heading-container {
display: flex;
From cad5d51dc124595b9c8d43fa30c558d9586c563b Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 25 Nov 2021 12:17:25 +0100
Subject: [PATCH 26/34] switched icon in pdf button to eye icon
---
vis/js/templates/listentry/PaperButtons.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis/js/templates/listentry/PaperButtons.jsx b/vis/js/templates/listentry/PaperButtons.jsx
index 03224891e..cd7e07f68 100644
--- a/vis/js/templates/listentry/PaperButtons.jsx
+++ b/vis/js/templates/listentry/PaperButtons.jsx
@@ -20,7 +20,7 @@ const PaperButtons = ({ paper, handlePDFClick }) => {
{!!onPDFClick && (
- PDF
+ PDF
)}
From 7b1625c5b66e6350559eee80bfc4cb1b030e099a Mon Sep 17 00:00:00 2001
From: tanteuschi
Date: Thu, 2 Dec 2021 19:30:23 +0100
Subject: [PATCH 27/34] Additional style changes
---
vis/js/templates/listentry/AccessIcons.jsx | 12 +++++------
vis/stylesheets/components/_buttons.scss | 24 ++++++++++++++++++----
vis/stylesheets/components/_input.scss | 1 +
vis/stylesheets/modules/_map.scss | 5 ++++-
vis/stylesheets/modules/_modal.scss | 6 ++++--
vis/stylesheets/modules/list/_entry.scss | 15 ++++++++------
vis/stylesheets/modules/list/_header.scss | 3 +++
vis/stylesheets/modules/map/_papers.scss | 12 +++++------
8 files changed, 53 insertions(+), 25 deletions(-)
diff --git a/vis/js/templates/listentry/AccessIcons.jsx b/vis/js/templates/listentry/AccessIcons.jsx
index d3989c684..2cb1c8452 100644
--- a/vis/js/templates/listentry/AccessIcons.jsx
+++ b/vis/js/templates/listentry/AccessIcons.jsx
@@ -8,20 +8,20 @@ const AccessIcons = ({ isOpenAccess, isFreeAccess, isDataset, tags }) => {
{!!isOpenAccess && (
- open access
-
+
+ open access
)}
{!!isFreeAccess && (
- free access
-
+
+ free access
)}
{!!isDataset && (
- dataset
-
+
+ dataset
)}
{tags}
diff --git a/vis/stylesheets/components/_buttons.scss b/vis/stylesheets/components/_buttons.scss
index c25a013f4..5eed903be 100755
--- a/vis/stylesheets/components/_buttons.scss
+++ b/vis/stylesheets/components/_buttons.scss
@@ -37,12 +37,15 @@ img#close-button {
}
#modals .btn {
- font-size: 16px;
- height: 43px;
- width: 43px;
+ font-size: 15px;
+ height: 46px;
+ width: 46px;
background-color: $okm-modal-btn;
border-color: $okm-modal-btn;
margin-bottom: 5px;
+ border-radius: 14px;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
padding: 0px;
-moz-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),0 3px 1px -2px rgba(0,0,0,0.12),0 1px 5px 0 rgba(0,0,0,0.2);
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),0 3px 1px -2px rgba(0,0,0,0.12),0 1px 5px 0 rgba(0,0,0,0.2);
@@ -73,6 +76,11 @@ img#close-button {
background-color: $okm-modal-btn;
border-color: $okm-modal-btn;
font-family: $link-font-family;
+ border-radius: 14px;
+ -moz-border-radius: 14px;
+ -webkit-border-radius: 14px;
+ padding: 10px 20px;
+ font-size: 12px;
}
.modal-content .btn-primary:hover {
@@ -81,6 +89,12 @@ img#close-button {
color: $okm-modal-btn;
}
+.modal-content .btn-primary:focus {
+ background-color: $okm-modal-btn;
+ border-color: $okm-modal-btn;
+ color: white;
+}
+
@if ($skin == "cris_vis") {
#searchclear {
right: 8px;
@@ -156,7 +170,9 @@ img#close-button {
border: 1px solid #E55137;
background-color: #E55137;
padding: 6px 4px;
- border-radius: 5px;
+ border-radius: 14px;
+ -moz-border-radius: 14px;
+ -webkit-border-radius: 14px;
cursor: pointer;
width: 100px;
font-weight: normal;
diff --git a/vis/stylesheets/components/_input.scss b/vis/stylesheets/components/_input.scss
index f97c915d6..c96052bad 100755
--- a/vis/stylesheets/components/_input.scss
+++ b/vis/stylesheets/components/_input.scss
@@ -14,4 +14,5 @@
opacity: 1;
font-weight: $fontweight400;
font-family: $link-font-family;
+ font-size: 11px;
}
\ No newline at end of file
diff --git a/vis/stylesheets/modules/_map.scss b/vis/stylesheets/modules/_map.scss
index 61d094db8..2d9e040da 100644
--- a/vis/stylesheets/modules/_map.scss
+++ b/vis/stylesheets/modules/_map.scss
@@ -137,6 +137,9 @@ text {
background-color: $okm-modal-btn;
border-color: $okm-modal-btn;
padding: 6px 4px !important;
+ border-radius: 14px;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
}
#filter_params {
@@ -166,7 +169,7 @@ text {
#filter_params, #sort {
width: 140px;
- font-size: 12px;
+ font-size: 11px;
}
#filter-menu-entries {
diff --git a/vis/stylesheets/modules/_modal.scss b/vis/stylesheets/modules/_modal.scss
index 24029d59a..fc4ea3d0f 100644
--- a/vis/stylesheets/modules/_modal.scss
+++ b/vis/stylesheets/modules/_modal.scss
@@ -347,8 +347,10 @@ h5 {
span {
border: 1px solid #adadad;
- border-radius: 4px;
- padding: 6px 12px 6px 12px;
+ border-radius: 14px;
+ -moz-border-radius: 14px;
+ -webkit-border-radius: 14px;
+ padding: 6px 22px;
font-size: 14px;
line-height: 20px;
font-weight: 400;
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 457b99669..9eee8f2e3 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -19,7 +19,7 @@
}
#oa {
- margin-bottom: 10px;
+ margin-bottom: 6px;
}
#open-access-logo_list, #free-access-logo_list {
@@ -27,12 +27,15 @@
color: $open-access;
border: 1px solid $open-access;
padding: 2px 4px;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
+ border-radius: 14px;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
font-size: 10px;
vertical-align: top;
font-weight: $fontweight400;
+ display: inline-block;
+ width: 100px;
+ text-align: center;
}
.tag {
@@ -73,8 +76,8 @@
font-family: $link-font-family;
.list_title {
- font-size: 14px;
- line-height:120%;
+ font-size: 15px;
+ line-height: 150%;
margin-bottom: 10px;
padding-right: 10px;
display: inline-block;
diff --git a/vis/stylesheets/modules/list/_header.scss b/vis/stylesheets/modules/list/_header.scss
index 9cf58564b..7b207cb2e 100755
--- a/vis/stylesheets/modules/list/_header.scss
+++ b/vis/stylesheets/modules/list/_header.scss
@@ -74,6 +74,9 @@
margin-bottom: 10px;
margin-right: 10px;
padding-left: 22px;
+ border-radius: 14px;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
}
@media screen and (max-width: 1650px) {
diff --git a/vis/stylesheets/modules/map/_papers.scss b/vis/stylesheets/modules/map/_papers.scss
index 370fb925e..4bdd5bcf8 100644
--- a/vis/stylesheets/modules/map/_papers.scss
+++ b/vis/stylesheets/modules/map/_papers.scss
@@ -147,20 +147,20 @@
color: white;
padding: 4px;
font-size: 6px;
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+ border-radius: 14px;
+ -moz-border-radius: 14px;
+ -webkit-border-radius: 14px;
&.large {
margin: 0 0 0 5px;
font-size: 12px;
- padding: 4px;
+ padding: 4px 10px;
}
&.larger {
font-size: 12px;
margin: 0 0 0 5px;
- padding: 4px;
+ padding: 4px 10px;
}
img {
@@ -325,5 +325,5 @@
}
.access_icon {
- margin-left: 3px;
+ margin-right: 3px;
}
\ No newline at end of file
From 2bfae968025064d803b4f1e5b5d582e14da28f85 Mon Sep 17 00:00:00 2001
From: tanteuschi
Date: Fri, 3 Dec 2021 14:54:06 +0100
Subject: [PATCH 28/34] Additional style changes
---
vis/stylesheets/base/_colors.scss | 2 +-
vis/stylesheets/components/_buttons.scss | 6 +++---
vis/stylesheets/modules/list/_entry.scss | 8 --------
3 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/vis/stylesheets/base/_colors.scss b/vis/stylesheets/base/_colors.scss
index 0c823137f..c7b56a85e 100755
--- a/vis/stylesheets/base/_colors.scss
+++ b/vis/stylesheets/base/_colors.scss
@@ -128,6 +128,7 @@ $highlight: #e1e5e5;
}
@if $skin == 'triple' {
+ $okm-red: #622166;
$dark-blue: #666666;
$medium-blue: #622166;
$link-gray: $medium-blue;
@@ -140,7 +141,6 @@ $highlight: #e1e5e5;
$okm-gray: #818181;
$paper-icon: #cbcbcb;
$highlight-searchterm: #EAEAEA;
- $okm-red: #ed1c24;
$infolink: #622166;
$modal-title: $medium-blue;
$area-title-h2: $okm-blue;
diff --git a/vis/stylesheets/components/_buttons.scss b/vis/stylesheets/components/_buttons.scss
index 5eed903be..833bc291a 100755
--- a/vis/stylesheets/components/_buttons.scss
+++ b/vis/stylesheets/components/_buttons.scss
@@ -167,8 +167,8 @@ img#close-button {
.paper_button {
color: white;
- border: 1px solid #E55137;
- background-color: #E55137;
+ border: 1px solid $okm-red;
+ background-color: $okm-red;
padding: 6px 4px;
border-radius: 14px;
-moz-border-radius: 14px;
@@ -178,7 +178,7 @@ img#close-button {
font-weight: normal;
&:hover {
- color: #E55137;
+ color: $okm-red;
background-color: white;
}
}
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 9eee8f2e3..578adea4f 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -861,13 +861,6 @@ img#preview_page {
@if $skin == "covis" {
#open-access-logo_list {
- background-color: $open-access;
- color: white;
- border: 1px solid $open-access;
- padding: 2px 4px;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
font-size: 10px;
vertical-align: top;
font-weight: $fontweight400;
@@ -940,7 +933,6 @@ img#preview_page {
}
#free-access-logo_list, #open-access-logo_list {
- display: inline;
margin-right: 3px;
}
From ddc2153c8dc3e0649bb985d101b923a81ff259f1 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 6 Dec 2021 14:38:32 +0100
Subject: [PATCH 29/34] minor UI changes
---
examples/project_website/data-config_base.js | 1 +
.../project_website/data-config_pubmed.js | 3 ++-
vis/js/components/Headstart.js | 2 +-
vis/js/default-config.js | 6 ++---
vis/js/templates/Paper.jsx | 25 +++++++++----------
vis/js/templates/listentry/Title.jsx | 6 ++---
vis/js/utils/dimensions.js | 2 +-
vis/stylesheets/modules/list/_entry.scss | 1 -
vis/stylesheets/modules/map/_header.scss | 3 ++-
9 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/examples/project_website/data-config_base.js b/examples/project_website/data-config_base.js
index 3907d6697..ae2732b34 100644
--- a/examples/project_website/data-config_base.js
+++ b/examples/project_website/data-config_base.js
@@ -48,4 +48,5 @@ var data_config = {
show_cite_button: true,
highlight_query_terms: true,
+ show_context_oa_number: false,
};
diff --git a/examples/project_website/data-config_pubmed.js b/examples/project_website/data-config_pubmed.js
index 97e4f8710..1862c85b0 100644
--- a/examples/project_website/data-config_pubmed.js
+++ b/examples/project_website/data-config_pubmed.js
@@ -46,6 +46,7 @@ var data_config = {
show_cite_button: true,
- highlight_query_terms: true
+ highlight_query_terms: true,
+ show_context_oa_number: false,
};
\ No newline at end of file
diff --git a/vis/js/components/Headstart.js b/vis/js/components/Headstart.js
index 5854b1076..fa34bf74c 100644
--- a/vis/js/components/Headstart.js
+++ b/vis/js/components/Headstart.js
@@ -48,10 +48,10 @@ const Headstart = ({
)}
{renderList &&
}
+
-
);
};
diff --git a/vis/js/default-config.js b/vis/js/default-config.js
index 2c136ad0d..e34a4e89d 100644
--- a/vis/js/default-config.js
+++ b/vis/js/default-config.js
@@ -548,10 +548,10 @@ var config = {
embed_button_text: 'Copy',
embed_title: 'embed map',
embed_body_text: 'You can use this code to embed the visualization on your own website or in a dashboard.',
- high_metadata_quality: "High metadata quality",
+ high_metadata_quality: "Data quality",
high_metadata_quality_desc_base: "This knowledge map only includes documents with an abstract (min. 300 characters). High metadata quality significantly improves the quality of your knowledge map.",
high_metadata_quality_desc_pubmed: "This knowledge map only includes documents with an abstract. High metadata quality significantly improves the quality of your knowledge map.",
- low_metadata_quality: "Low metadata quality",
+ low_metadata_quality: "Data quality",
low_metadata_quality_desc_base: "This knowledge map includes documents with and without an abstract. Low metadata quality may significantly reduce the quality of your knowledge map. ",
low_metadata_quality_desc_pubmed: "This knowledge map includes documents with and without an abstract. Low metadata quality may significantly reduce the quality of your knowledge map. ",
area_streamgraph: "Stream",
@@ -573,7 +573,7 @@ var config = {
search_placeholder: "Search within visualization...",
show_list: "Show list",
hide_list: "Hide list",
- intro_label: "more info",
+ intro_label: "More info",
relevance: "relevance",
readers: "readers",
tweets: "tweets",
diff --git a/vis/js/templates/Paper.jsx b/vis/js/templates/Paper.jsx
index e791b345a..c37927485 100644
--- a/vis/js/templates/Paper.jsx
+++ b/vis/js/templates/Paper.jsx
@@ -3,14 +3,14 @@ import Highlight from "../components/Highlight";
import Hyphenate from "../components/Hyphenate";
import { select } from "d3-selection";
+import { formatPaperDate } from "./listentry/Title";
class Paper extends React.Component {
constructor(props) {
super(props);
// TODO rewrite this using https://www.npmjs.com/package/core-decorators#autobind ?
- this.getCoordinatesAndDimensions = this.getCoordinatesAndDimensions.bind(
- this
- );
+ this.getCoordinatesAndDimensions =
+ this.getCoordinatesAndDimensions.bind(this);
this.isAnimated = this.isAnimated.bind(this);
this.animate = this.animate.bind(this);
this.animatePath = this.animatePath.bind(this);
@@ -104,10 +104,8 @@ class Paper extends React.Component {
const { x, y, width: baseWidth, height: baseHeight } = this.state;
const { path: basePath, dogEar: baseDogEar } = this.state;
- let {
- width: realWidth,
- height: realHeight,
- } = this.getCoordinatesAndDimensions();
+ let { width: realWidth, height: realHeight } =
+ this.getCoordinatesAndDimensions();
const handleMouseOver = () => {
let newEnlargeFactor = null;
@@ -227,7 +225,12 @@ class Paper extends React.Component {
{title}
+ {" "}
+ (
+
+ {formatPaperDate(year)}
+ )
@@ -248,10 +251,6 @@ class Paper extends React.Component {
>
)}
-
- {" "}
- ({year} )
-
{!!readersLabel &&
@@ -455,10 +454,10 @@ const getMetadataHeight = (realHeight, hasReaders, isZoomed) => {
}
const height = realHeight - readersHeight;
-
+
if (height >= 20) {
return height;
}
return 20;
-}
+};
diff --git a/vis/js/templates/listentry/Title.jsx b/vis/js/templates/listentry/Title.jsx
index ef1ead6f5..088a53a06 100644
--- a/vis/js/templates/listentry/Title.jsx
+++ b/vis/js/templates/listentry/Title.jsx
@@ -8,7 +8,7 @@ import { getDateFromTimestamp } from "../../utils/dates";
import { mapDispatchToListEntriesProps } from "../../utils/eventhandlers";
import useMatomo from "../../utils/useMatomo";
-const MAX_TITLE_LENGTH = 150;
+const MAX_TITLE_LENGTH = 160;
const Title = ({
paper,
@@ -37,7 +37,7 @@ const Title = ({
const rawTitle = paper.title ? paper.title : loc.default_paper_title;
- const formattedDate = ` (${formatDate(paper.year)})`;
+ const formattedDate = ` (${formatPaperDate(paper.year)})`;
const formattedTitle = isSelected
? rawTitle
: formatTitle(rawTitle, MAX_TITLE_LENGTH - formattedDate.length);
@@ -62,7 +62,7 @@ const mapStateToProps = (state) => ({
export default connect(mapStateToProps, mapDispatchToListEntriesProps)(Title);
-const formatDate = (date) => {
+export const formatPaperDate = (date) => {
const strDate = date.toString();
let format = "yyyy-mm-dd";
if (strDate.match(/^\d{4}(-\d{2})?$/)) {
diff --git a/vis/js/utils/dimensions.js b/vis/js/utils/dimensions.js
index c6dbba57f..43ef267e4 100644
--- a/vis/js/utils/dimensions.js
+++ b/vis/js/utils/dimensions.js
@@ -1,7 +1,7 @@
import $ from "jquery";
// these constants are hardcoded dimensions of various headstart parts
-const TITLE_HEIGHT = 54.7;
+const TITLE_HEIGHT = 57;
const TOOLBAR_HEIGHT = 66;
const TITLE_IMAGE_HEIGHT = 70;
const SHOW_HIDE_BTN_HEIGHT = 34;
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index 578adea4f..ec7a9b54d 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -572,7 +572,6 @@ img#preview_page {
.list_metadata .list_title {
font-size: 13px;
- max-width: 72%;
}
#list_abstract {
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 65d68828c..3e9641929 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -57,7 +57,7 @@
}
#context {
- font-size: 11px;
+ font-size: 12px;
color: $black;
.context_moreinfo {
border-bottom: 1px solid $link-gray;
@@ -302,6 +302,7 @@
display: inline-block;
margin-right: 1%;
height: 15px;
+ margin-bottom: 3px;
}
//.context_metadata_high {
From f11ed216067df0a2397303e6459cd7aa03dd5736 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Mon, 6 Dec 2021 15:23:57 +0100
Subject: [PATCH 30/34] backling height & font size adjustment
---
vis/stylesheets/modules/map/_header.scss | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index 3e9641929..ab2525a94 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -27,9 +27,9 @@
.backlink {
position: relative;
z-index: 3;
- font-size: 11px;
+ font-size: 12px;
cursor: pointer;
- height: 15px;
+ height: 18px;
a {
border-bottom: 1px solid $link-gray;
From bdb5df514ca72e1748089d18ad1fd43162a96658 Mon Sep 17 00:00:00 2001
From: tanteuschi
Date: Tue, 7 Dec 2021 17:44:39 +0100
Subject: [PATCH 31/34] fixed some smaller CSS issues including: - built with
line (removed height property) - appearance of dataset tag in Viper
---
vis/stylesheets/base/_colors.scss | 10 +++++-----
vis/stylesheets/modules/_footer.scss | 3 ++-
vis/stylesheets/modules/list/_entry.scss | 16 +++++++++++-----
vis/stylesheets/modules/map/_header.scss | 9 +++++++--
4 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/vis/stylesheets/base/_colors.scss b/vis/stylesheets/base/_colors.scss
index c7b56a85e..3c8db66cc 100755
--- a/vis/stylesheets/base/_colors.scss
+++ b/vis/stylesheets/base/_colors.scss
@@ -23,7 +23,7 @@ $black: #444444;
$author-green: #216500;
$abstract-gray: #333; //#5c6d7f; //old: #444444
$link-gray: #333;
-$journal-gray: #4d7199; // old:#666666, 5c6d7f
+$journal-gray: #2C3E52; // old:#666666, 5c6d7f
$list_metadata_title_paper: #333;
$list_show_hide_button: #2d3e52; //#5c6d7f;
$highlight-searchterm: #eff3f4;
@@ -33,7 +33,7 @@ $area-title-h2: #333;
// Additional colors for buttons etc.
$okm-modal-btn: #2d3e52;
$infolink: #E55137;
-$framed-item: #4d7199;//gelb:#f1c500;
+$framed-item: #2C3E52;//gelb:#f1c500;
$dataset: #2C3E52;
$lower_value_tag: #2C316E;
@@ -60,8 +60,8 @@ $highlight: #e1e5e5;
$dark-red: #A70805;
$black: #444444;
$author-green: #216500;
- $abstract-gray: #333; //#5c6d7f; //old: #444444
- $link-gray : $medium-blue;
+ $abstract-gray: #444; //#5c6d7f; //old: #444444
+ $link-gray : #444;
$journal-gray: #000000; // old:#666666
$list_metadata_title_paper: #3696e0;
$list_show_hide_button: #3696e0;
@@ -131,7 +131,7 @@ $highlight: #e1e5e5;
$okm-red: #622166;
$dark-blue: #666666;
$medium-blue: #622166;
- $link-gray: $medium-blue;
+ $link-gray: #622166;
$okm-clouds: #f1f1f1;
$okm-modal-btn: #622166;
$framed-item: #622166;
diff --git a/vis/stylesheets/modules/_footer.scss b/vis/stylesheets/modules/_footer.scss
index 7948f5267..5595d609e 100644
--- a/vis/stylesheets/modules/_footer.scss
+++ b/vis/stylesheets/modules/_footer.scss
@@ -1,7 +1,7 @@
.builtwith {
margin: 15px 10px 15px 50px;
font-size: 12px;
- height: 20px;
+ //height: 20px; might have to reintroduce this if it causes problems for embedded maps
}
.builtwith a {
@@ -17,6 +17,7 @@
@media screen and (max-width: 640px) {
.builtwith {
margin: 10px 0px 10px 20px;
+ font-size: 11px;
}
}
diff --git a/vis/stylesheets/modules/list/_entry.scss b/vis/stylesheets/modules/list/_entry.scss
index ec7a9b54d..905578b9f 100644
--- a/vis/stylesheets/modules/list/_entry.scss
+++ b/vis/stylesheets/modules/list/_entry.scss
@@ -31,7 +31,6 @@
-webkit-border-radius: 14px;
-moz-border-radius: 14px;
font-size: 10px;
- vertical-align: top;
font-weight: $fontweight400;
display: inline-block;
width: 100px;
@@ -61,9 +60,16 @@
border: 1px solid $dataset;
background-color: white;
padding: 2px 4px;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
+ border-radius: 14px;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
+ width: 100px;
+ text-align: center;
+ margin-left: 6px;
+}
+
+.fa-database {
+ margin-right: 3px;
}
.resulttype-dataset {
@@ -161,7 +167,7 @@
border-bottom: 1px solid $link-gray;
&:hover {
- border-bottom: 3px solid $link-gray;
+ border-bottom: 2px solid $link-gray;
}
}
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index ab2525a94..b4e32d34e 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -166,6 +166,10 @@
font-size: 14px;
}
}
+
+ #context {
+ font-size: 11px;
+ }
}
@if $skin == 'viper' {
@@ -174,7 +178,7 @@
}
#infolink:hover, #infolink:focus, #infolink:active {
- border-bottom: 3px solid $framed-item;
+ border-bottom: 2px solid $black;
}
}
@@ -302,7 +306,7 @@
display: inline-block;
margin-right: 1%;
height: 15px;
- margin-bottom: 3px;
+ margin-bottom: 6px;
}
//.context_metadata_high {
@@ -320,6 +324,7 @@
align-items: center;
.heading {
+ color: $area-title-h2;
text-overflow: ellipsis;
height: min-content; // 19.8px
overflow: hidden;
From ccc3d4e7f9f9dbf3f0956be5fe60ae2088403f45 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 9 Dec 2021 10:17:10 +0100
Subject: [PATCH 32/34] updated test snapshots
---
.../__snapshots__/contextline.test.js.snap | 12 ++---
.../__snapshots__/list-base.test.js.snap | 54 ++++++++++---------
2 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/vis/test/snapshot/__snapshots__/contextline.test.js.snap b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
index c86c93901..181a3ebec 100644
--- a/vis/test/snapshot/__snapshots__/contextline.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/contextline.test.js.snap
@@ -38,7 +38,7 @@ exports[`Context line component snapshot matches a covis snapshot 1`] = `
id="more-info-link"
>
@@ -91,7 +91,7 @@ exports[`Context line component snapshot matches a linkedcat authorview snapshot
id="more-info-link"
>
@@ -149,7 +149,7 @@ exports[`Context line component snapshot matches a linkedcat keywordview snapsho
id="more-info-link"
>
@@ -243,7 +243,7 @@ exports[`Context line component snapshot matches a project website (base low qua
id="more-info-link"
>
@@ -337,7 +337,7 @@ exports[`Context line component snapshot matches a project website (pubmed high
id="more-info-link"
>
@@ -403,7 +403,7 @@ exports[`Context line component snapshot matches a viper snapshot 1`] = `
id="more-info-link"
>
diff --git a/vis/test/snapshot/__snapshots__/list-base.test.js.snap b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
index 48c74987f..57697ad71 100644
--- a/vis/test/snapshot/__snapshots__/list-base.test.js.snap
+++ b/vis/test/snapshot/__snapshots__/list-base.test.js.snap
@@ -290,12 +290,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-in, p
- open access
+ open access
PDF
@@ -1206,12 +1206,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -2084,12 +2084,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -2261,12 +2261,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -2491,12 +2491,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
- Divide ; Presentación del Monográfico: Tecnologías, Educación y Bre...
+ Divide ; Presentación del Monográfico: Tecnologías, Educación y Brecha
+
+
+ Digital
@@ -2641,7 +2647,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
onClick={[Function]}
>
PDF
@@ -2688,12 +2694,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -3092,12 +3098,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -3607,12 +3613,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -3958,12 +3964,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
@@ -4135,12 +4141,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
- Competence...
+ Competence in the in...
@@ -4265,7 +4271,7 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
onClick={[Function]}
>
PDF
@@ -4441,12 +4447,12 @@ exports[`List entries component snapshot (BASE) matches a snapshot (zoomed-out)
- open access
+ open access
PDF
From e8ab0af3bdb71645756b0151c955c7040a065ec3 Mon Sep 17 00:00:00 2001
From: Jan Konstant <62649432+Konstiman@users.noreply.github.com>
Date: Thu, 9 Dec 2021 12:26:10 +0100
Subject: [PATCH 33/34] Update CHANGELOG.md
---
CHANGELOG.md | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f272da46d..48cc16c98 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Changelog
+## 2021-12-09
+
+### New features
+
+- added abbreviation to list entry items (heading, source, authors)
+
+### Changes
+
+- refactored list entries code
+- heading & list UI changes
+ - moved info button to the context line
+ - moved pdf button
+ - minor list changes
+- major CSS changes (restyled the whole Headstart)
+
+### Removed
+
+- link buttons from list
+
## 2021-11-25
### New features
From ed665a2e718a934de067a28d7c0bf22c60bfeb09 Mon Sep 17 00:00:00 2001
From: Jan Konstant
Date: Thu, 9 Dec 2021 15:29:17 +0100
Subject: [PATCH 34/34] embed & streamgraph css bugfix
---
vis/js/utils/dimensions.js | 2 +-
vis/stylesheets/modules/_footer.scss | 3 ++-
vis/stylesheets/modules/map/_header.scss | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/vis/js/utils/dimensions.js b/vis/js/utils/dimensions.js
index 43ef267e4..fd44925ea 100644
--- a/vis/js/utils/dimensions.js
+++ b/vis/js/utils/dimensions.js
@@ -1,7 +1,7 @@
import $ from "jquery";
// these constants are hardcoded dimensions of various headstart parts
-const TITLE_HEIGHT = 57;
+const TITLE_HEIGHT = 60;
const TOOLBAR_HEIGHT = 66;
const TITLE_IMAGE_HEIGHT = 70;
const SHOW_HIDE_BTN_HEIGHT = 34;
diff --git a/vis/stylesheets/modules/_footer.scss b/vis/stylesheets/modules/_footer.scss
index 5595d609e..221c33290 100644
--- a/vis/stylesheets/modules/_footer.scss
+++ b/vis/stylesheets/modules/_footer.scss
@@ -1,7 +1,8 @@
.builtwith {
margin: 15px 10px 15px 50px;
font-size: 12px;
- //height: 20px; might have to reintroduce this if it causes problems for embedded maps
+ // TODO this doesn't work on mobile (footer is unreadable)
+ height: 20px;
}
.builtwith a {
diff --git a/vis/stylesheets/modules/map/_header.scss b/vis/stylesheets/modules/map/_header.scss
index b4e32d34e..eb723c322 100644
--- a/vis/stylesheets/modules/map/_header.scss
+++ b/vis/stylesheets/modules/map/_header.scss
@@ -29,7 +29,7 @@
z-index: 3;
font-size: 12px;
cursor: pointer;
- height: 18px;
+ height: 21px;
a {
border-bottom: 1px solid $link-gray;