From 8d2879e2271fa249c204bfd88bb3f6a7e220bd34 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Sun, 31 May 2020 17:34:35 +0200 Subject: [PATCH] USE_TAGS -> USE_FILTERS --- src/actions/index.js | 2 +- src/components/Toolbar/Layout.js | 47 +++++++++++++++----------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index dc14b2a..8d7a462 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -50,7 +50,7 @@ export function fetchDomain () { } let tagsPromise = Promise.resolve([]) - if (features.USE_TAGS) { + if (features.USE_FILTERS) { if (!TAGS_URL) { tagsPromise = Promise.resolve(handleError('USE_TAGS is true, but you have not provided a TAGS_EXT')) } else { diff --git a/src/components/Toolbar/Layout.js b/src/components/Toolbar/Layout.js index 817dc91..8ef6288 100644 --- a/src/components/Toolbar/Layout.js +++ b/src/components/Toolbar/Layout.js @@ -87,21 +87,18 @@ class Toolbar extends React.Component { } } - renderToolbarTagPanel () { - if (this.props.features.USE_TAGS && - this.props.tags.children) { - return ( - - - - ) - } - return null + renderToolbarFilterPanel () { + console.log(this.props) + return ( + + + + ) } renderToolbarTab (_selected, label, iconKey) { @@ -117,14 +114,15 @@ class Toolbar extends React.Component { } renderToolbarPanels () { + const { features } = this.props let classes = (this.state._selected >= 0) ? 'toolbar-panels' : 'toolbar-panels folded' return (
{this.renderClosePanel()} - {this.renderToolbarNarrativePanel()} - {this.renderToolbarCategoriesPanel()} - {this.renderToolbarTagPanel()} + {features.USE_NARRATIVES ? this.renderToolbarNarrativePanel() : null} + {features.CATEGORIES_AS_TAGS ? this.renderToolbarCategoriesPanel() : null} + {features.USE_FILTERS ? this.renderToolbarFilterPanel() : null}
) @@ -148,21 +146,20 @@ class Toolbar extends React.Component { } renderToolbarTabs () { + const { features } = this.props let title = copy[this.props.language].toolbar.title if (process.env.display_title) title = process.env.display_title const narrativesLabel = copy[this.props.language].toolbar.narratives_label const tagsLabel = copy[this.props.language].toolbar.tags_label const categoriesLabel = 'Categories' // TODO: - const isTags = this.props.tags && this.props.tags.children - const isCategories = this.props.features.CATEGORIES_AS_TAGS return (

{title}

- {this.renderToolbarTab(0, narrativesLabel, 'timeline')} - {(isCategories) ? this.renderToolbarTab(1, categoriesLabel, 'widgets') : null} - {(isTags) ? this.renderToolbarTab(2, tagsLabel, 'filter_list') : null} + {features.USE_NARRATIVES ? this.renderToolbarTab(0, narrativesLabel, 'timeline') : null} + {features.CATEGORIES_AS_TAGS ? this.renderToolbarTab(1, categoriesLabel, 'widgets') : null} + {features.USE_FILTERS ? this.renderToolbarTab(2, tagsLabel, 'filter_list') : null}