diff --git a/src/actions/index.js b/src/actions/index.js index 6bb8f0b..5352f20 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -246,10 +246,10 @@ export function updateNarrative (narrative) { } } -export const SELECT_NARRATIVE_IDX = 'SELECT_NARRATIVE_IDX' +export const UPDATE_NARRATIVE_STEP_IDX = 'UPDATE_NARRATIVE_STEP_IDX' export function selectNarrativeIdx (idx) { return { - type: SELECT_NARRATIVE_IDX, + type: UPDATE_NARRATIVE_STEP_IDX, idx } } diff --git a/src/components/presentational/Map/Events.jsx b/src/components/presentational/Map/Events.jsx index d21efe3..a3802af 100644 --- a/src/components/presentational/Map/Events.jsx +++ b/src/components/presentational/Map/Events.jsx @@ -111,7 +111,7 @@ function MapEvents ({ // in narrative mode, only render events in narrative // TODO: move this to a selector // Gets around if block scope - var narrativeIdx = false + let narrativeIdx = -1 if (narrative) { const { steps } = narrative diff --git a/src/reducers/app.js b/src/reducers/app.js index f9b1cdd..9a36058 100644 --- a/src/reducers/app.js +++ b/src/reducers/app.js @@ -9,7 +9,7 @@ import { UPDATE_TIMERANGE, UPDATE_DIMENSIONS, UPDATE_NARRATIVE, - SELECT_NARRATIVE_IDX, + UPDATE_NARRATIVE_STEP_IDX, UPDATE_SOURCE, TOGGLE_LANGUAGE, TOGGLE_SITES, @@ -97,7 +97,7 @@ function updateNarrative (appState, action) { } } -function selectNarrativeIdx (appState, action) { +function updateNarrativeStepIdx (appState, action) { appState.narrativeState.current = action.idx return { @@ -233,8 +233,8 @@ function app (appState = initial.app, action) { return updateDimensions(appState, action) case UPDATE_NARRATIVE: return updateNarrative(appState, action) - case SELECT_NARRATIVE_IDX: - return selectNarrativeIdx(appState, action) + case UPDATE_NARRATIVE_STEP_IDX: + return updateNarrativeStepIdx(appState, action) case UPDATE_SOURCE: return updateSource(appState, action) /* toggles */