diff --git a/src/actions/index.js b/src/actions/index.js index 7f39a6d..da6fe64 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -244,6 +244,13 @@ export function updateSource(source) { // UI +export const TOGGLE_SITES = 'TOGGLE_SITES' +export function toggleSites() { + return { + type: TOGGLE_SITES + } +} + export const TOGGLE_FETCHING_DOMAIN = 'TOGGLE_FETCHING_DOMAIN' export function toggleFetchingDomain() { return { diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 7ced231..36608ba 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -43,13 +43,13 @@ class Map extends React.Component { this.map.setView([eventPoint.latitude, eventPoint.longitude]); } } - } + } initializeMap() { /** * Creates a Leaflet map and a tilelayer for the map background */ - const map = + const map = L.map(this.props.mapId) .setView(this.props.app.mapAnchor, 14) .setMinZoom(10) @@ -95,7 +95,7 @@ class Map extends React.Component { .getComputedStyle(mapNode) .getPropertyValue('transform'); - // Offset with leaflet map transform boundaries + // Offset with leaflet map transform boundaries this.setState({ mapTransformX: +transform.split(',')[4], mapTransformY: +transform.split(',')[5].split(')')[0] @@ -126,7 +126,7 @@ class Map extends React.Component { > - ); + ); } renderSites() { @@ -197,6 +197,7 @@ class Map extends React.Component { render() { + const { isShowingSites } = this.props.app.flags const classes = this.props.app.narrative ? 'map-wrapper narrative-mode' : 'map-wrapper'; return ( @@ -204,7 +205,7 @@ class Map extends React.Component {
{(this.map !== null) ? this.renderSVG() : ''} {(this.map !== null) ? this.renderMarkers() : ''} - {(this.map !== null) ? this.renderSites() : ''} + {(this.map !== null) && isShowingSites ? this.renderSites() : ''} {(this.map !== null) ? this.renderEvents() : ''} {(this.map !== null) ? this.renderNarratives() : ''} {(this.map !== null) ? this.renderSelected() : ''} @@ -226,7 +227,10 @@ function mapStateToProps(state) { selected: state.app.selected, highlighted: state.app.highlighted, mapAnchor: state.app.mapAnchor, - narrative: state.app.narrative + narrative: state.app.narrative, + flags: { + isShowingSites: state.app.flags.isShowingSites + } }, ui: { dom: state.ui.dom, diff --git a/src/components/Toolbar.jsx b/src/components/Toolbar.jsx index 542456f..ea526f9 100644 --- a/src/components/Toolbar.jsx +++ b/src/components/Toolbar.jsx @@ -1,11 +1,13 @@ import React from 'react'; import { connect } from 'react-redux' +import { bindActionCreators } from 'redux' +import * as actions from '../actions' import * as selectors from '../selectors' import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; import Search from './Search.jsx'; import TagListPanel from './TagListPanel.jsx'; -// import ToolbarBottomActions from './ToolbarBottomActions.jsx'; +import ToolbarBottomActions from './ToolbarBottomActions.jsx'; import copy from '../js/data/copy.json'; import { trimAndEllipse } from '../js/utilities.js'; @@ -112,7 +114,6 @@ class Toolbar extends React.Component { {this.renderToolbarTab(0, 'Focus stories')} {this.renderToolbarTab(1, 'Explore freely')} - {/*