mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
Merging in develop branch
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
export const FILTER_MODE = 'FILTER'
|
||||
export const NARRATIVE_MODE = 'NARRATIVE'
|
||||
export const ASSOCIATION_MODES = {
|
||||
CATEGORY: 'CATEGORY',
|
||||
NARRATIVE: 'NARRATIVE',
|
||||
FILTER: 'FILTER'
|
||||
}
|
||||
|
||||
@@ -63,6 +63,18 @@ export function trimAndEllipse (string, stringNum) {
|
||||
return string
|
||||
}
|
||||
|
||||
export function getEventCategories (event, categories) {
|
||||
const matchedCategories = []
|
||||
if (event.associations && event.associations.length > 0) {
|
||||
event.associations.reduce((acc, val) => {
|
||||
const foundCategory = categories.find(cat => cat.id === val)
|
||||
if (foundCategory) acc.push(foundCategory)
|
||||
return acc
|
||||
}, matchedCategories)
|
||||
}
|
||||
return matchedCategories
|
||||
}
|
||||
|
||||
/**
|
||||
* Inset the full source represenation from 'allSources' into an event. The
|
||||
* function is 'curried' to allow easy use with maps. To use for a single
|
||||
|
||||
Reference in New Issue
Block a user