@@ -145,7 +145,8 @@ class Toolbar extends React.Component {
}
renderToolbarTabs () {
- const { features } = this.props
+ const { features, narratives } = this.props
+ const narrativesExist = narratives && narratives.length !== 0
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
@@ -153,15 +154,15 @@ class Toolbar extends React.Component {
const categoriesLabel = 'Categories' // TODO:
const narrativesIdx = 0
- const categoriesIdx = features.USE_NARRATIVES ? 1 : 0
- const filtersIdx = (features.USE_NARRATIVES && features.CATEGORIES_AS_FILTERS) ? 2 : (
- features.USE_NARRATIVES || features.CATEGORIES_AS_FILTERS ? 1 : 0
+ const categoriesIdx = narrativesExist ? 1 : 0
+ const filtersIdx = (narrativesExist && features.CATEGORIES_AS_FILTERS) ? 2 : (
+ narrativesExist || features.CATEGORIES_AS_FILTERS ? 1 : 0
)
return (
- {features.USE_NARRATIVES ? this.renderToolbarTab(narrativesIdx, narrativesLabel, 'timeline') : null}
+ {narrativesExist ? this.renderToolbarTab(narrativesIdx, narrativesLabel, 'timeline') : null}
{features.CATEGORIES_AS_FILTERS ? this.renderToolbarTab(categoriesIdx, categoriesLabel, 'widgets') : null}
{features.USE_ASSOCIATIONS ? this.renderToolbarTab(filtersIdx, filtersLabel, 'filter_list') : null}
diff --git a/src/components/presentational/Card/Filters.js b/src/components/presentational/Card/Filters.js
deleted file mode 100644
index 0b90de4..0000000
--- a/src/components/presentational/Card/Filters.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import React from 'react'
-
-import copy from '../../../common/data/copy.json'
-
-const CardFilters = ({ filters, language }) => {
- const filtersLang = copy[language].cardstack.filters
- const noFiltersLang = copy[language].cardstack.nofilters
-
- if (filters.length > 0) {
- return (
-
-
{filtersLang}:
-
- {filters.map((filter, idx) => {
- return (
-
- {filter.name}
- {(idx < filters.length - 1)
- ? ','
- : ''}
-
- )
- })}
-
-
- )
- }
- return (
-
-
{filtersLang}
-
{noFiltersLang}
-
- )
-}
-
-export default CardFilters
diff --git a/src/components/presentational/Card/Narrative.js b/src/components/presentational/Card/Narrative.js
deleted file mode 100644
index 150180f..0000000
--- a/src/components/presentational/Card/Narrative.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react'
-
-import CardNarrativeLink from './NarrativeLink'
-
-const CardNarrative = (props) => (
-
-)
-
-export default CardNarrative
diff --git a/src/components/presentational/Card/NarrativeLink.js b/src/components/presentational/Card/NarrativeLink.js
deleted file mode 100644
index b292e16..0000000
--- a/src/components/presentational/Card/NarrativeLink.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react'
-
-const CardNarrativeLink = ({ event, makeTimelabel, select }) => {
- if (event !== null) {
- const timelabel = makeTimelabel(event.timestamp)
-
- return (
-
select(event)}>
- {`${timelabel} / ${event.location}`}
-
- )
- }
-
- return (
None)
-}
-
-export default CardNarrativeLink
diff --git a/src/components/presentational/Map/Narratives.js b/src/components/presentational/Map/Narratives.js
index 8e0aefa..cbae8c7 100644
--- a/src/components/presentational/Map/Narratives.js
+++ b/src/components/presentational/Map/Narratives.js
@@ -26,6 +26,8 @@ function MapNarratives ({
return styles[styleName]
}
+ const narrativesExist = narratives && narratives.length !== 0
+
function hasNoLocation (step) {
return (step.latitude === '' || step.longitude === '')
}
@@ -141,7 +143,7 @@ function MapNarratives ({
let lastMarked = null
- if (features.FILTERS_AS_NARRATIVES) {
+ if (narrativesExist) {
for (let idx = 0; idx < n.steps.length; idx += 1) {
const step = n.steps[idx]
if (lastMarked) {
@@ -174,7 +176,7 @@ function MapNarratives ({
function renderNarrative (n) {
const narrativeId = `narrative-${n.id.replace(/ /g, '_')}`
- const body = features.FILTERS_AS_NARRATIVES
+ const body = narrativesExist
? renderBetweenMarked(n)
: (features.NARRATIVE_STEP_STYLES
? renderBetweenMarked(n)
diff --git a/src/selectors/index.js b/src/selectors/index.js
index d5f319c..c8ad30e 100644
--- a/src/selectors/index.js
+++ b/src/selectors/index.js
@@ -76,7 +76,7 @@ export const selectEvents = createSelector(
export const selectNarratives = createSelector(
[getEvents, getNarratives, getSources, getFeatures],
(events, narrativesMeta, sources, features) => {
- if (!features.USE_NARRATIVES) {
+ if (Array.isArray(narrativesMeta) && narrativesMeta.length === 0) {
return []
}
const narratives = {}