diff --git a/src/actions/types.js b/src/actions/types.js index edf3cd5bb..10a71d8db 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -28,8 +28,7 @@ export const ADD_NOTIFICATION = "ADD_NOTIFICATION"; export const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION"; export const CHANGE_PANEL_LAYOUT = "CHANGE_PANEL_LAYOUT"; export const TOGGLE_PANEL_DISPLAY = "TOGGLE_PANEL_DISPLAY"; -export const TRIGGER_DOWNLOAD_MODAL = "TRIGGER_DOWNLOAD_MODAL"; -export const DISMISS_DOWNLOAD_MODAL = "DISMISS_DOWNLOAD_MODAL"; +export const SET_MODAL = "SET_MODAL"; export const ADD_EXTRA_METADATA = "ADD_EXTRA_METADATA"; export const CHANGE_TREE_ROOT_IDX = "CHANGE_TREE_ROOT_IDX"; export const TOGGLE_NARRATIVE = "TOGGLE_NARRATIVE"; diff --git a/src/components/download/downloadModal.js b/src/components/download/downloadModal.js index 4dbc2f688..93d1705b6 100644 --- a/src/components/download/downloadModal.js +++ b/src/components/download/downloadModal.js @@ -1,10 +1,7 @@ import React from "react"; -import Mousetrap from "mousetrap"; import { connect } from "react-redux"; import { withTranslation } from 'react-i18next'; -import { TRIGGER_DOWNLOAD_MODAL, DISMISS_DOWNLOAD_MODAL } from "../../actions/types"; import { infoPanelStyles } from "../../globalStyles"; -import { stopProp } from "../tree/infoPanels/click"; import { getAcknowledgments} from "../framework/footer"; import { datasetSummary } from "../info/datasetSummary"; import { DownloadButtons } from "./downloadButtons"; @@ -43,7 +40,6 @@ export const publications = { @connect((state) => ({ browserDimensions: state.browserDimensions.browserDimensions, - show: state.controls.showDownload, colorBy: state.controls.colorBy, distanceMeasure: state.controls.distanceMeasure, metadata: state.metadata, @@ -54,58 +50,7 @@ export const publications = { panelsToDisplay: state.controls.panelsToDisplay, panelLayout: state.controls.panelLayout })) -class DownloadModal extends React.Component { - constructor(props) { - super(props); - this.getStyles = (bw, bh) => { - return { - behind: { /* covers the screen */ - position: "absolute", - top: 0, - left: 0, - width: "100%", - height: "100%", - pointerEvents: "all", - zIndex: 2000, - backgroundColor: "rgba(80, 80, 80, .20)", - display: "flex", - justifyContent: "center", - alignItems: "center", - wordWrap: "break-word", - wordBreak: "break-word" - }, - title: { - fontWeight: 500, - fontSize: 32, - marginTop: "20px", - marginBottom: "20px" - }, - secondTitle: { - fontWeight: 500, - marginTop: "0px", - marginBottom: "20px" - }, - modal: { - marginLeft: 200, - marginTop: 130, - width: bw - (2 * 200), - height: bh - (2 * 130), - borderRadius: 2, - backgroundColor: "rgba(250, 250, 250, 1)", - overflowY: "auto" - }, - break: { - marginBottom: "10px" - } - }; - }; - this.dismissModal = this.dismissModal.bind(this); - } - componentDidMount() { - Mousetrap.bind('d', () => { - this.props.dispatch({type: this.props.show ? DISMISS_DOWNLOAD_MODAL : TRIGGER_DOWNLOAD_MODAL}); - }); - } +class DownloadModalContents extends React.Component { getRelevantPublications() { const x = [publications.nextstrain, publications.treetime]; if (["cTiter", "rb", "ep", "ne"].indexOf(this.props.colorBy) !== -1) { @@ -128,75 +73,53 @@ class DownloadModal extends React.Component { ); } - dismissModal() { - this.props.dispatch({ type: DISMISS_DOWNLOAD_MODAL }); - } render() { - const { t } = this.props; - - if (!this.props.show) { - return null; - } - const panelStyle = {...infoPanelStyles.panel}; - panelStyle.width = this.props.browserDimensions.width * 0.66; - panelStyle.maxWidth = panelStyle.width; - panelStyle.maxHeight = this.props.browserDimensions.height * 0.66; - panelStyle.fontSize = 14; - panelStyle.lineHeight = 1.4; - + const { t, metadata } = this.props; const relevantPublications = this.getRelevantPublications(); - - const meta = this.props.metadata; return ( -
- ({t("click outside this box to return to the app")}) -
- -+ Clicking on the following links will take you to an external site which will attempt to + load the underlying data JSON which you are currently viewing. + These sites are not part of Nextstrain and as such are not under our control, but we + highly encourage interoperability across platforms like these. +
+ + + + {linkouts.map((d) => ( ++ ({t("click outside this box to return to the app")}) +
+