mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 21:08:36 +03:00
apply narratives only if FILTERS_AS_NARRATIVES set
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* global alert */
|
||||
import React from 'react'
|
||||
|
||||
import { bindActionCreators } from 'redux'
|
||||
@@ -149,6 +150,7 @@ class Dashboard extends React.Component {
|
||||
id: name,
|
||||
label: name,
|
||||
description: '',
|
||||
withLines: withSteps,
|
||||
steps: evs
|
||||
})
|
||||
}
|
||||
@@ -223,7 +225,7 @@ class Dashboard extends React.Component {
|
||||
getCategoryColor={this.getCategoryColor}
|
||||
/>
|
||||
<StateOptions
|
||||
showing={!app.narrative && app.filters.filters.length > 0}
|
||||
showing={features.FILTERS_AS_NARRATIVES && !app.narrative && app.filters.filters.length > 0}
|
||||
timelineDims={app.timeline.dimensions}
|
||||
onClickHandler={this.setNarrativeFromFilters}
|
||||
/>
|
||||
|
||||
@@ -10,7 +10,15 @@ const defaultStyles = {
|
||||
stroke: 'none'
|
||||
}
|
||||
|
||||
function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives, projectPoint, features }) {
|
||||
function MapNarratives ({
|
||||
styles,
|
||||
onSelectNarrative,
|
||||
svg,
|
||||
narrative,
|
||||
narratives,
|
||||
projectPoint,
|
||||
features
|
||||
}) {
|
||||
function getNarrativeStyle (narrativeId) {
|
||||
const styleName = (narrativeId && narrativeId in styles)
|
||||
? narrativeId
|
||||
@@ -133,29 +141,32 @@ function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives,
|
||||
|
||||
let lastMarked = null
|
||||
|
||||
for (let idx = 0; idx < n.steps.length; idx += 1) {
|
||||
const step = n.steps[idx]
|
||||
if (lastMarked) {
|
||||
arrows.push(renderBetweenSteps(lastMarked, step, {
|
||||
strokeWidth: '1px',
|
||||
stroke: step.colour
|
||||
}))
|
||||
if (features.FILTERS_AS_NARRATIVES) {
|
||||
for (let idx = 0; idx < n.steps.length; idx += 1) {
|
||||
const step = n.steps[idx]
|
||||
if (lastMarked) {
|
||||
arrows.push(renderBetweenSteps(
|
||||
lastMarked,
|
||||
step,
|
||||
n.withLines ? { strokeWidth: '1px', stroke: step.colour } : {})
|
||||
)
|
||||
}
|
||||
lastMarked = step
|
||||
}
|
||||
lastMarked = step
|
||||
}
|
||||
} else {
|
||||
for (let idx = 0; idx < n.steps.length; idx += 1) {
|
||||
const step = n.steps[idx]
|
||||
const _idx = step.narratives.indexOf(n.id)
|
||||
const stepStyle = step.narrative___stepStyles[_idx]
|
||||
|
||||
// for (let idx = 0; idx < n.steps.length; idx += 1) {
|
||||
// const step = n.steps[idx]
|
||||
// const _idx = step.narratives.indexOf(n.id)
|
||||
// const stepStyle = step.narrative___stepStyles[_idx]
|
||||
//
|
||||
// if (stepStyle !== 'None') {
|
||||
// if (lastMarked) {
|
||||
// arrows.push(renderBetweenSteps(lastMarked, step, styles.stepStyles[stepStyle]))
|
||||
// }
|
||||
// lastMarked = step
|
||||
// }
|
||||
// }
|
||||
if (stepStyle !== 'None') {
|
||||
if (lastMarked) {
|
||||
arrows.push(renderBetweenSteps(lastMarked, step, styles.stepStyles[stepStyle]))
|
||||
}
|
||||
lastMarked = step
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return arrows
|
||||
}
|
||||
@@ -163,13 +174,15 @@ function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives,
|
||||
function renderNarrative (n) {
|
||||
const narrativeId = `narrative-${n.id.replace(/ /g, '_')}`
|
||||
|
||||
const body = features.FILTERS_AS_NARRATIVES
|
||||
? renderBetweenMarked(n)
|
||||
: (features.NARRATIVE_STEP_STYLES
|
||||
? renderBetweenMarked(n)
|
||||
: renderFullNarrative(n))
|
||||
|
||||
return (
|
||||
<g id={narrativeId} className='narrative'>
|
||||
{renderBetweenMarked(n)}
|
||||
{/* {(features.NARRATIVE_STEP_STYLES */}
|
||||
{/* ? renderBetweenMarked(n) */}
|
||||
{/* : renderFullNarrative(n) */}
|
||||
{/* )} */}
|
||||
{body}
|
||||
</g>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user