Skip to content

Commit

Permalink
Merge pull request #881 from nextstrain/narrative-explore-data-button
Browse files Browse the repository at this point in the history
Narrative: explore data & leave narrative
  • Loading branch information
jameshadfield authored Feb 1, 2020
2 parents 31771d0 + cd5cf77 commit ee4014b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ class Main extends React.Component {
navBarHandler={() => {this.setState({sidebarOpen: !this.state.sidebarOpen});}}
/>
<PanelsContainer width={availableWidth} height={availableHeight} left={this.state.sidebarOpen ? sidebarWidth : 0}>
{this.props.narrativeIsLoaded ? renderNarrativeToggle(this.props.dispatch, this.props.displayNarrative) : null}
{this.props.narrativeIsLoaded && !this.props.panelsToDisplay.includes("EXPERIMENTAL_MainDisplayMarkdown") ?
renderNarrativeToggle(this.props.dispatch, this.props.displayNarrative) : null
}
{this.props.displayNarrative ? null : <Info width={calcUsableWidth(availableWidth, 1)} />}
{this.props.panelsToDisplay.includes("tree") ? <Tree width={big.width} height={big.height} /> : null}
{this.props.panelsToDisplay.includes("map") ? <Map width={big.width} height={big.height} justGotNewDatasetRenderNewMap={false} /> : null}
Expand Down
3 changes: 1 addition & 2 deletions src/components/narrative/MobileNarrativeDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React from "react";
import { connect } from "react-redux";
import queryString from "query-string";
import { changePage, EXPERIMENTAL_showMainDisplayMarkdown } from "../../actions/navigation";
import { TOGGLE_NARRATIVE } from "../../actions/types";
import {
linkStyles,
MobileBannerTop,
Expand Down Expand Up @@ -61,7 +60,7 @@ class MobileNarrativeDisplay extends React.Component {
};

this.exitNarrativeMode = () => {
this.props.dispatch({type: TOGGLE_NARRATIVE, display: false});
this.props.dispatch(changePage({ path: this.props.blocks[0].dataset, query: true }));
};

this.goToNextPage = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/narrative/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './styles';
import ReactPageScroller from "./ReactPageScroller";
import { changePage, EXPERIMENTAL_showMainDisplayMarkdown } from "../../actions/navigation";
import { CHANGE_URL_QUERY_BUT_NOT_REDUX_STATE, TOGGLE_NARRATIVE } from "../../actions/types";
import { CHANGE_URL_QUERY_BUT_NOT_REDUX_STATE } from "../../actions/types";
import { narrativeNavBarHeight } from "../../util/globals";

/* regarding refs: https://reactjs.org/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components */
Expand All @@ -41,7 +41,7 @@ class Narrative extends React.Component {
super(props);
this.state = {showingEndOfNarrativePage: false};
this.exitNarrativeMode = () => {
this.props.dispatch({type: TOGGLE_NARRATIVE, display: false});
this.props.dispatch(changePage({ path: this.props.blocks[0].dataset, query: true }));
};
this.changeAppStateViaBlock = (reactPageScrollerIdx) => {
const idx = reactPageScrollerIdx-1;
Expand Down

0 comments on commit ee4014b

Please sign in to comment.