mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 04:48:36 +03:00
Debugging issues with broken sources
This commit is contained in:
@@ -136,7 +136,6 @@ class CardStack extends React.Component {
|
||||
|
||||
render () {
|
||||
const { isCardstack, selected, narrative, timelineDims } = this.props
|
||||
|
||||
// TODO: make '237px', which is the narrative header, less hard-coded
|
||||
const height = `calc(100% - 237px - ${timelineDims.height}px)`
|
||||
if (selected.length > 0) {
|
||||
|
||||
@@ -71,6 +71,16 @@ class Dashboard extends React.Component {
|
||||
)
|
||||
}
|
||||
|
||||
filterEventDuplicates (events) {
|
||||
const seen = Set()
|
||||
const filteredEvents = events.filter(evt => {
|
||||
if (!(seen.has(evt.id))) {
|
||||
seen.add(evt.id)
|
||||
return evt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleSelect (selected, axis) {
|
||||
const matchedEvents = []
|
||||
const TIMELINE_AXIS = 0
|
||||
@@ -86,8 +96,8 @@ class Dashboard extends React.Component {
|
||||
ptr >= 0 &&
|
||||
(events[idx].datetime).getTime() === (events[ptr].datetime).getTime()
|
||||
) {
|
||||
matchedEvents.push(events[ptr])
|
||||
ptr -= 1
|
||||
matchedEvents.push(events[ptr])
|
||||
ptr -= 1
|
||||
}
|
||||
// check events after
|
||||
ptr = idx + 1
|
||||
@@ -96,14 +106,15 @@ class Dashboard extends React.Component {
|
||||
ptr < events.length &&
|
||||
(events[idx].datetime).getTime() === (events[ptr].datetime).getTime()
|
||||
) {
|
||||
matchedEvents.push(events[ptr])
|
||||
ptr += 1
|
||||
matchedEvents.push(events[ptr])
|
||||
ptr += 1
|
||||
}
|
||||
} else { // Map...
|
||||
const std = { ...selected }
|
||||
delete std.sources
|
||||
Object.values(std).forEach(ev => matchedEvents.push(ev))
|
||||
}
|
||||
console.info(matchedEvents)
|
||||
this.props.actions.updateSelected(matchedEvents)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,23 +20,8 @@ function childrenToToggle (filter, activeFilters, parentOn) {
|
||||
return childKeys
|
||||
}
|
||||
|
||||
// function aggregatePaths (filters) {
|
||||
// let aggregated = {}
|
||||
|
||||
// filters.forEach(item => {
|
||||
// let currentDepth = aggregated
|
||||
// item.filter_paths.forEach(path => {
|
||||
// if (!(path in aggregated)) {
|
||||
// currentDepth[path] = {}
|
||||
// }
|
||||
// currentDepth = currentDepth[path]
|
||||
// })
|
||||
// })
|
||||
// return aggregated
|
||||
// }
|
||||
function aggregatePaths (filters) {
|
||||
function insertPath (children = {}, [headOfPath, ...remainder]) {
|
||||
console.info(children, headOfPath, remainder)
|
||||
let childKey = Object.keys(children).find(key => key === headOfPath)
|
||||
if (!childKey) children[headOfPath] = {}
|
||||
if (remainder.length > 0) insertPath(children[headOfPath], remainder)
|
||||
|
||||
Reference in New Issue
Block a user