Skip to content

Commit ef602e0

Browse files
committed
Merge branch 'interface-changes-export-new' of https://github.com/OpenKnowledgeMaps/Headstart into interface-changes-export-new
2 parents 74b71c7 + 0b30afb commit ef602e0

5 files changed

Lines changed: 25 additions & 6 deletions

File tree

vis/js/default-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,10 @@ var config = {
177177
faqs_button: false,
178178
//url for link to faqs
179179
faqs_url: "",
180-
// show citation button
180+
// show citation button for the whole map
181181
show_cite_button: false,
182+
// show citation button for each paper
183+
cite_papers: false,
182184

183185
/*** streamgraph settings ***/
184186
//streamgraph color definition

vis/js/reducers/list.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const list = (
1717
showKeywords: false,
1818
hideUnselectedKeywords: true,
1919
height: null,
20+
citePapers: false,
21+
exportPapers: false,
2022
},
2123
action
2224
) => {
@@ -47,6 +49,8 @@ const list = (
4749
hideUnselectedKeywords: config.hide_keywords_overview,
4850
disableClicks: !config.render_map,
4951
height: action.listHeight,
52+
citePapers: config.cite_papers,
53+
exportPapers: config.export_papers,
5054
};
5155
case "TOGGLE_LIST":
5256
return {

vis/js/templates/listentry/PaperButtons.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ const PaperButtons = ({
3838
<div className="paper_buttons_row">
3939
{!!onPDFClick && (
4040
<button className="paper_button main" onClick={handlePDFButtonClick}>
41-
<i className="far fa-file-pdf"></i>&nbsp;&nbsp;<Highlight>PDF</Highlight>
41+
<i className="far fa-file-pdf"></i>&nbsp;&nbsp;
42+
<Highlight>PDF</Highlight>
4243
</button>
4344
)}
4445
{showCiteButton && (
@@ -57,8 +58,12 @@ const PaperButtons = ({
5758
};
5859

5960
const mapStateToProps = (state) => ({
60-
showCiteButton: ["base", "pubmed"].includes(state.service),
61-
showExportButton: ["base", "pubmed"].includes(state.service),
61+
// showCiteButton: ["base", "pubmed", "triple_km", "triple_sg"].includes(
62+
// state.service
63+
// ),
64+
showCiteButton: state.list.citePapers,
65+
// showExportButton: ["base", "pubmed"].includes(state.service),
66+
showExportButton: state.list.exportPapers,
6267
});
6368

6469
export default connect(

vis/js/utils/usePaperExport.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState, useEffect } from "react";
22

3-
export const PAPER_EXPORT_ENDPOINT = "services/exportMetadata.php?format=bibtex";
3+
export const PAPER_EXPORT_ENDPOINT =
4+
"services/exportMetadata.php?format=bibtex";
45

56
const DATA_FALLBACK = "No data available.";
67

@@ -35,7 +36,12 @@ const loadPaperExport = (paper, serverUrl, callback) => {
3536
body: "paper=" + encodeURIComponent(JSON.stringify(paper)),
3637
})
3738
.then((response) => response.text())
38-
.then((data) => callback((prev) => ({ ...prev, [paper.safe_id]: data })))
39+
.then((data) =>
40+
callback((prev) => ({
41+
...prev,
42+
[paper.safe_id]: data ? data : DATA_FALLBACK,
43+
}))
44+
)
3945
.catch((error) => {
4046
console.error(error);
4147
callback((prev) => ({

vis/stylesheets/modules/_modal.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ h5 {
396396
border-radius: 3px;
397397
-moz-border-radius: 3px;
398398

399+
word-break: break-word;
400+
399401
&.code {
400402
white-space: pre-wrap;
401403
}

0 commit comments

Comments
 (0)