mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
Make selectors compute narratives as arrays
This commit is contained in:
committed by
Lachlan Kermode
parent
0bc4ddc54e
commit
4423e792ec
@@ -95,16 +95,18 @@ export const selectNarratives = createSelector(
|
||||
events.forEach((evt) => {
|
||||
const isTagged = isTaggedIn(evt, tagFilters) || isNoTags(tagFilters);
|
||||
const isTimeRanged = isTimeRangedIn(evt, timeRange);
|
||||
const isInNarrative = evt.narrative;
|
||||
const isInNarrative = evt.narratives.length > 0;
|
||||
|
||||
if (!narratives[evt.narrative]) {
|
||||
narratives[evt.narrative] = { id: evt.narrative, steps: [], byId: {} };
|
||||
}
|
||||
evt.narratives.map(narrative => {
|
||||
if (!narratives[narrative]) {
|
||||
narratives[narrative] = { id: narrative, steps: [], byId: {} };
|
||||
}
|
||||
|
||||
if (/*isTimeRanged && isTagged && */isInNarrative) {
|
||||
narratives[evt.narrative].steps.push(evt);
|
||||
narratives[evt.narrative].byId[evt.id] = { next: null, prev: null };
|
||||
}
|
||||
if (isInNarrative) {
|
||||
narratives[narrative].steps.push(evt);
|
||||
narratives[narrative].byId[evt.id] = { next: null, prev: null };
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Object.keys(narratives).forEach((key) => {
|
||||
@@ -161,6 +163,7 @@ export const selectLocations = createSelector(
|
||||
export const selectSelected = createSelector(
|
||||
[getSelected, getSources],
|
||||
(selected, sources) => {
|
||||
console.log(selected, sources)
|
||||
if (selected.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user