feat(timeline): let the reader set the scale
One density cannot answer both questions the board is asked. A patch cycle is six weeks, a login campaign runs for months, and 13px a day is a compromise between "what am I in the middle of this week?" and "how do the next three months line up?" that serves neither well. A pair of controls steps through a ladder of day widths and the choice is remembered, on the same argument as the view tabs: a reader who has said how they want to read this should not say it again on the next load. Two things it had to get right. Zooming holds the middle of the view still — rescaling around the left edge of a three-month board throws away whatever they had scrolled to, and re-opening at today would undo the scrolling that got them there. And the dated ticks thin out as the scale shrinks, because a week is 42px at the widest setting and the dates would sit on top of each other; the gridlines stay weekly, since they carry the rhythm rather than the reading. The scale is stored as the measurement, not a step number, and read through `snapDayWidth`. An export written against a different ladder then opens on something close to what its reader chose, and a corrupt value opens on the default rather than a board one pixel wide. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d5dbe72e17
commit
ba39ad2bce
+12
-1
@@ -18,6 +18,7 @@ import { useMarkSet } from "./state/useMarkSet.ts";
|
||||
import { useProgress } from "./state/useProgress.ts";
|
||||
import { useDailyLog, type DailyLogMap } from "./state/useDailyLog.ts";
|
||||
import { adoptNewLanes, usePrefs, type View } from "./state/usePrefs.ts";
|
||||
import { snapDayWidth } from "./state/zoom.ts";
|
||||
import { useCustom } from "./state/useCustom.ts";
|
||||
import { compareRows, SORT_MODES, type Activity, type SortMode } from "./state/sort.ts";
|
||||
import {
|
||||
@@ -509,7 +510,17 @@ export function App() {
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Timeline rows={visible} now={now} onOpen={setOpenId} isDone={isDone} />
|
||||
<Timeline
|
||||
rows={visible}
|
||||
now={now}
|
||||
// Snapped here rather than trusted: a stored number arrives from an
|
||||
// export written by another version of the ladder, or from a file a
|
||||
// reader edited, and a board one pixel wide is not a preference.
|
||||
dayWidth={snapDayWidth(prefs.timelineDayWidth)}
|
||||
onZoom={(timelineDayWidth) => update({ timelineDayWidth })}
|
||||
onOpen={setOpenId}
|
||||
isDone={isDone}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Controls
|
||||
|
||||
Reference in New Issue
Block a user