Clean store fields, add narrative cards and some changes to toolbar

This commit is contained in:
Franc Camps-Febrer
2018-12-03 16:40:27 +00:00
parent 051620a49e
commit 62b8908d03
4 changed files with 55 additions and 3 deletions

View File

@@ -180,6 +180,14 @@ export function updateTimeRange(timerange) {
}
}
export const UPDATE_NARRATIVE = 'UPDATE_NARRATIVE';
export function updateNarrative(narrative) {
return {
type: UPDATE_NARRATIVE,
narrative
}
}
export const RESET_ALLFILTERS = 'RESET_ALLFILTERS'
export function resetAllFilters() {
return {
@@ -256,3 +264,11 @@ export function fetchSourceError(msg) {
msg
}
}
export const TOGGLE_MAPVIEW = 'TOGGLE_MAPVIEW';
export function toggleMapView(layer) {
return {
type: TOGGLE_MAPVIEW,
layer
}
}

View File

@@ -109,6 +109,9 @@ class Dashboard extends React.Component {
onSelect={this.handleSelect}
actions={this.props.actions}
/>
<NarrativeCard
onSelect={this.handleSelect}
/>
<Notification
isNotification={this.props.app.flags.isNotification}
notifications={this.props.domain.notifications}

View File

@@ -113,8 +113,8 @@ class Toolbar extends React.Component {
<div className="toolbar-header"><p>{title}</p></div>
<div className="toolbar-tabs">
{/*this.renderToolbarTab(0, 'search')*/}
{this.renderToolbarTab(0, 'Narratives')}
{(isTags) ? this.renderToolbarTab(1, 'Explore by tag') : ''}
{this.renderToolbarTab(0, 'Focus stories')}
{this.renderToolbarTab(1, 'Explore freely')}
</div>
<ToolbarBottomActions
actions={this.props.actions}
@@ -137,6 +137,39 @@ class Toolbar extends React.Component {
)
}
renderToolbarNavs() {
if (this.props.narratives) {
return this.props.narratives.map((nar, idx) => {
const isActive = (idx === this.state.tab);
let classes = (isActive) ? 'toolbar-tab active' : 'toolbar-tab';
return (
<div className={classes} onClick={() => { this.toggleTab(idx); }}>
<div className="tab-caption">{nar.label}</div>
</div>
);
})
}
return '';
}
renderToolbarTabs() {
const title = copy[this.props.language].toolbar.title;
return (
<div className="toolbar">
<div className="toolbar-header"><p>{title}</p></div>
<div className="toolbar-tabs">
{/*this.renderToolbarTab(0, 'search')*/}
{(this.props.isModeGuided)
? this.renderToolbarNavs()
: this.renderToolbarTagRoot()}
</div>
{/* {this.renderBottomActions()} */}
</div>
)
}
render() {
return (
<div id="toolbar-wrapper" className="toolbar-wrapper">

View File

@@ -1,7 +1,7 @@
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const userConfig = require('./config');
const userConfig = require('./dev.config');
const userConfigJSON = {};
const devMode = process.env.NODE_ENV !== 'production';