mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
simplified component logic
This commit is contained in:
@@ -110,9 +110,6 @@ function MapEvents ({
|
||||
|
||||
// in narrative mode, only render events in narrative
|
||||
// TODO: move this to a selector
|
||||
// Gets around if block scope
|
||||
let narrativeIdx = -1
|
||||
|
||||
if (narrative) {
|
||||
const { steps } = narrative
|
||||
const onlyIfInNarrative = e => steps.map(s => s.id).includes(e.id)
|
||||
@@ -120,11 +117,6 @@ function MapEvents ({
|
||||
|
||||
if (eventsInNarrative.length <= 0) {
|
||||
return null
|
||||
} else {
|
||||
// choose the first event at a given location
|
||||
const locationEventId = eventsInNarrative[0].id
|
||||
const narrativeIdxObj = steps.find(s => s.id === locationEventId)
|
||||
narrativeIdx = steps.indexOf(narrativeIdxObj)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +135,7 @@ function MapEvents ({
|
||||
<g
|
||||
className={`location-event ${narrative ? 'no-hover' : ''}`}
|
||||
transform={`translate(${x}, ${y})`}
|
||||
onClick={(!narrative) ? () => onSelect(location.events) : () => { onSelect(narrativeIdx); onSelect(location.events) }}
|
||||
onClick={() => onSelect(location.events)}
|
||||
>
|
||||
{renderLocationSlicesByCategory(location)}
|
||||
{extraRender ? extraRender() : null}
|
||||
|
||||
Reference in New Issue
Block a user