mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
reconfigures initial settings with a 30 year setting, more sensible defaults for zooms
This commit is contained in:
@@ -8,7 +8,6 @@ const CardTimestamp = ({ timelabel, language, precision }) => {
|
||||
// const estimatedLang = copy[language].cardstack.estimated
|
||||
const unknownLang = copy[language].cardstack.unknown_time
|
||||
|
||||
console.log(precision)
|
||||
if (isNotNullNorUndefined(timelabel)) {
|
||||
return (
|
||||
<div className='card-cell timestamp'>
|
||||
|
||||
@@ -78,6 +78,10 @@ const TimelineEvents = ({
|
||||
})
|
||||
}
|
||||
|
||||
// console.log(datetimes
|
||||
// .filter(d => d.events.some(e => e.category !== 'Legislation'))
|
||||
// )
|
||||
|
||||
return (
|
||||
<g
|
||||
clipPath={'url(#clip)'}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
function zoomIsActive (duration, extent) {
|
||||
if (duration > 1570000 && extent > 1570000) {
|
||||
function zoomIsActive (duration, extent, max) {
|
||||
if (duration >= max && extent >= max) {
|
||||
return true
|
||||
}
|
||||
return duration === extent
|
||||
@@ -9,7 +9,8 @@ function zoomIsActive (duration, extent) {
|
||||
|
||||
const TimelineZoomControls = ({ extent, zoomLevels, dims, onApplyZoom }) => {
|
||||
function renderZoom (zoom, idx) {
|
||||
const isActive = zoomIsActive(zoom.duration, extent)
|
||||
const max = zoomLevels.reduce((acc, vl) => acc.duration < vl.duration ? vl : acc)
|
||||
const isActive = zoomIsActive(zoom.duration, extent, max.duration)
|
||||
return (
|
||||
<text
|
||||
className={`zoom-level-button ${isActive ? 'active' : ''}`}
|
||||
|
||||
@@ -38,7 +38,7 @@ export const selectEvents = createSelector(
|
||||
[getEvents, getActiveTags, getActiveCategories, getTimeRange],
|
||||
(events, activeTags, activeCategories, timeRange) => {
|
||||
return events.reduce((acc, event) => {
|
||||
const isMatchingTag = event.tags && event.tags.map(tag => activeTags.includes(tag)).some(s => s)
|
||||
const isMatchingTag = (event.tags && event.tags.map(tag => activeTags.includes(tag)).some(s => s)) || activeTags.length === 0
|
||||
const isActiveTag = isMatchingTag || activeTags.length === 0
|
||||
const isActiveCategory = activeCategories.includes(event.category) || activeCategories.length === 0
|
||||
const isActiveTime = isTimeRangedIn(event, timeRange)
|
||||
|
||||
@@ -69,10 +69,12 @@ const initial = {
|
||||
trackHeight: 80
|
||||
},
|
||||
range: [
|
||||
new Date(2013, 2, 23, 12),
|
||||
new Date(2016, 2, 23, 12)
|
||||
new Date(1993, 2, 23, 12),
|
||||
new Date(2023, 2, 23, 12)
|
||||
],
|
||||
zoomLevels: [
|
||||
{ label: '30 years', duration: 15768000 },
|
||||
{ label: '3 years', duration: 1576800 },
|
||||
{ label: '3 months', duration: 129600 },
|
||||
{ label: '3 days', duration: 4320 },
|
||||
{ label: '12 hours', duration: 720 }
|
||||
|
||||
Reference in New Issue
Block a user