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