feat(timeline): let a lane be one deadline queue, started or not
`endingSoonestFirst` holds every unstarted event behind every running one. That is right for a checklist — you cannot do a thing that has not opened — and it is one answer of two for a board, which is asked what runs out first. An event opening on Friday and closing on Sunday is a nearer deadline than one running now until October, and that order can never show it. So `byDeadline` is the same comparator with that clause removed, and `timelineLanes` takes a `split` flag choosing between them. It defaults to the old behaviour, so nothing moves yet. The flag is also the one case where lane mode reorders inside a lane, which the module otherwise refuses to do. Deliberate: the given order is live-first whatever the reader chose in the list, so honouring it would draw exactly the block this was asked not to draw. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c0e523bdc4
commit
6029e9ef10
@@ -344,6 +344,30 @@ export function endingSoonestFirst(
|
||||
return a.clock.msRemaining - b.clock.msRemaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort key: soonest deadline first, and nothing else.
|
||||
*
|
||||
* The other half of the timeline's "put them all together" (PRD F1). Where
|
||||
* `endingSoonestFirst` holds every unstarted event behind every running one —
|
||||
* which is what a *checklist* wants, since you cannot do a thing that has not
|
||||
* opened — this asks the one question a Gantt board is for: what runs out
|
||||
* first. An event opening on Friday and closing on Sunday is a nearer deadline
|
||||
* than one running now until October, and a reader looking at a calendar rather
|
||||
* than a to-do list is entitled to see it in that order.
|
||||
*
|
||||
* The `endsAt: null` rule is the same in both: an unannounced end is real but is
|
||||
* not a deadline, so it sorts behind every dated row rather than claiming a
|
||||
* place in the queue.
|
||||
*/
|
||||
export function byDeadline(
|
||||
a: { clock: EventClock },
|
||||
b: { clock: EventClock },
|
||||
): number {
|
||||
if (a.clock.msRemaining === null) return b.clock.msRemaining === null ? 0 : 1;
|
||||
if (b.clock.msRemaining === null) return -1;
|
||||
return a.clock.msRemaining - b.clock.msRemaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* A plain-language caption for an event's window.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user