Select only updateNarrative as action to pass to Toolbar

This commit is contained in:
Franc Camps-Febrer
2018-12-13 11:37:57 +01:00
committed by Lachlan Kermode
parent 58aaadc5d4
commit 6dee9fee2f
4 changed files with 18 additions and 28 deletions

View File

@@ -36,17 +36,6 @@ class CardStack extends React.Component {
return '';
}
renderLocation() {
let locationName = copy[this.props.language].cardstack.unknown_location;
if (this.props.selected.length > 0) {
if (isNotNullNorUndefined(this.props.selected[0].location)) {
locationName = this.props.selected[0].location;
}
return (<p className="header-copy">in:<b>{` ${locationName}`}</b></p>)
}
return '';
}
renderCardStackHeader() {
const header_lang = copy[this.props.language].cardstack.header;

View File

@@ -76,23 +76,17 @@ class Dashboard extends React.Component {
render() {
return (
<div>
<Toolbar
onFilter={this.handleTagFilter}
onSelectNarrative={(narrative) => { this.props.actions.updateNarrative(narrative); }}
actions={this.props.actions}
/>
<Viewport
methods={{
onSelect: this.handleSelect,
getCategoryColor: category => this.getCategoryColor(category)
}}
/>
<Toolbar
onFilter={this.handleTagFilter}
actions={this.props.actions}
/>
<CardStack
onSelect={this.handleSelect}
onHighlight={this.handleHighlight}
onToggleCardstack={() => this.props.actions.updateSelected([])}
getNarrativeLinks={event => this.getNarrativeLinks(event)}
getCategoryColor={category => this.getCategoryColor(category)}
/>
<Timeline
methods={{
onSelect: this.handleSelect,
@@ -100,15 +94,22 @@ class Dashboard extends React.Component {
getCategoryColor: category => this.getCategoryColor(category)
}}
/>
<NarrativeCard
onSelect={this.handleSelect}
onSelectNarrative={(narrative) => { this.props.actions.updateNarrative(narrative); }}
/>
<CardStack
onSelect={this.handleSelect}
onHighlight={this.handleHighlight}
onToggleCardstack={() => this.props.actions.updateSelected([])}
getNarrativeLinks={event => this.getNarrativeLinks(event)}
getCategoryColor={category => this.getCategoryColor(category)}
/>
<InfoPopUp
ui={this.props.ui}
app={this.props.app}
toggle={() => this.props.actions.toggleInfoPopup()}
/>
<NarrativeCard
onSelect={this.handleSelect}
actions={this.props.actions}
/>
<Notification
isNotification={this.props.app.flags.isNotification}
notifications={this.props.domain.notifications}

View File

@@ -51,7 +51,7 @@ class Toolbar extends React.Component {
this.setState({
tabNum: -1
}, () => {
this.props.actions.updateNarrative(narrative);
this.props.onSelectNarrative(narrative);
});
}

View File

@@ -43,7 +43,7 @@ function updateNarrative(appState, action) {
// Add some margin to the datetime extent
minDate = minDate - ((maxDate - minDate) / 20);
maxDate = maxDate + ((maxDate - minDate) / 20);
return appState;
return Object.assign({}, appState, {
narrative: action.narrative,
filters: Object.assign({}, appState.filters, {