From 1111606128195e9c68fe3407951e71c06697bd25 Mon Sep 17 00:00:00 2001 From: Miguel Sozinho Ramalho <19508417+msramalho@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:45:31 +0000 Subject: [PATCH] updates to timeline and notice (#86) --- config.js | 11 ++++++----- src/components/time/Timeline.jsx | 13 ++++--------- src/components/time/atoms/Header.jsx | 5 ++++- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/config.js b/config.js index bbf6610..d669baa 100755 --- a/config.js +++ b/config.js @@ -36,10 +36,11 @@ const config = { }, zoomLevels: [ // { label: "Zoom to 2 weeks", duration: 14 * one_day }, - { label: "Zoom to 1 month", duration: 31 * one_day }, - { label: "Zoom to 6 months", duration: 6 * 31 * one_day }, + // { label: "Zoom to 1 month", duration: 31 * one_day }, + // { label: "Zoom to 6 months", duration: 6 * 31 * one_day }, { label: "Zoom to 1 year", duration: 12 * 31 * one_day }, - { label: "Zoom to 2 years", duration: 24 * 31 * one_day }, + { label: "Zoom to 2 years", duration: 2 * 12 * 31 * one_day }, + { label: "Zoom to 5 years", duration: 5 * 12 * 31 * one_day }, ], range: { /** @@ -47,7 +48,7 @@ const config = { * Use [start, end] (strings in ISO 8601 format) for a fixed range. * Use undefined for a dynamic initial range based on the browser time. */ - initial: undefined, + initial: ["2022-02-01T00:00:00.000Z", "2025-08-31T23:59:59.999Z"], /** The number of days to show when using a dynamic initial range */ initialDaysShown: 31*12, limits: { @@ -57,7 +58,7 @@ const config = { * The upper bound of the range that can be accessed on the map. * Defaults to current browser time if undefined. */ - upper: undefined, + upper: "2025-08-14T23:59:59.999Z", }, }, }, diff --git a/src/components/time/Timeline.jsx b/src/components/time/Timeline.jsx index 66ef24e..1ee3734 100644 --- a/src/components/time/Timeline.jsx +++ b/src/components/time/Timeline.jsx @@ -219,19 +219,14 @@ class Timeline extends Component { * @param {object} zoom: zoom level from zoomLevels */ onApplyZoom(zoom) { - const extent = this.getTimeScaleExtent(); - const newCentralTime = timeMinute.offset( - this.state.scaleX.domain()[0], - extent / 2 - ); + const now = new Date(); const { rangeLimits } = this.props.app.timeline; - let newDomain0 = timeMinute.offset(newCentralTime, -zoom.duration / 2); - let newDomainF = timeMinute.offset(newCentralTime, zoom.duration / 2); + // Calculate the start and end of the zoom window, ending at 'now' and going back zoom.duration minutes + let newDomainF = now; + let newDomain0 = timeMinute.offset(now, -zoom.duration); if (rangeLimits) { - // If the store contains absolute time limits, - // make sure the zoom doesn't go over them const minDate = rangeLimits[0]; const maxDate = rangeLimits[1]; diff --git a/src/components/time/atoms/Header.jsx b/src/components/time/atoms/Header.jsx index 2444555..92d9511 100644 --- a/src/components/time/atoms/Header.jsx +++ b/src/components/time/atoms/Header.jsx @@ -14,8 +14,11 @@ const TimelineHeader = ({ title, from, to, onClick, hideInfo, resetTest, resetCl
{d0} - {d1} - resetClick() }>{ resetTest } + resetClick()}>{resetTest}
+