diff --git a/src/components/CardStack.jsx b/src/components/CardStack.jsx index 1f6c371..65fd3f9 100644 --- a/src/components/CardStack.jsx +++ b/src/components/CardStack.jsx @@ -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) { diff --git a/src/components/Layout.js b/src/components/Layout.js index fe7c0e7..3c10a57 100644 --- a/src/components/Layout.js +++ b/src/components/Layout.js @@ -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) } diff --git a/src/components/Toolbar/FilterListPanel.js b/src/components/Toolbar/FilterListPanel.js index ff67fa6..9e4eb4b 100644 --- a/src/components/Toolbar/FilterListPanel.js +++ b/src/components/Toolbar/FilterListPanel.js @@ -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)