refactor: delete the section hint nothing could reach
The "Running now" header had a hint reading "next after this ends in …", and the commit before this one fixed a real defect in the string it produced — an unannounced end became the word "ended". Both were beside the point: the branch cannot render at all. `Section` shows `action ?? hint`. The hint needed a second live row to have anything to say, and two live rows are two visible rows, which is exactly the condition that puts the sort control in the same slot. So the action was present whenever the hint was, and won every time. What it would have said is already on the page. The headline panel's "Then" list names the deadlines behind the closest one and counts each of them down, which is the same answer with more room. So the hint slot goes, `followingDeadlineMs` goes with it as its only caller, and `Section` is left with the one control slot it actually uses. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
026b1315d3
commit
0b5aa12173
+11
-18
@@ -24,7 +24,6 @@ import { compareRows, SORT_MODES, type Activity, type SortMode } from "./state/s
|
||||
import {
|
||||
advanceFocus,
|
||||
countByGame,
|
||||
followingDeadlineMs,
|
||||
nextToExpire,
|
||||
outstanding,
|
||||
resolveFocus,
|
||||
@@ -301,15 +300,6 @@ export function App() {
|
||||
|
||||
const live = visible.filter((r) => r.clock.live);
|
||||
const upcoming = visible.filter((r) => r.clock.upcoming);
|
||||
/**
|
||||
* What falls due after the row at the top of "Running now".
|
||||
*
|
||||
* Read off the deadlines rather than off the list, because the list is in
|
||||
* whichever order the reader chose — see `followingDeadlineMs`. Null when
|
||||
* there is no second dated end, and the header then says nothing rather than
|
||||
* counting down to a placeholder.
|
||||
*/
|
||||
const following = followingDeadlineMs(live);
|
||||
/**
|
||||
* The unstarted events the checklist actually lists.
|
||||
*
|
||||
@@ -522,11 +512,6 @@ export function App() {
|
||||
<Section
|
||||
legend
|
||||
title="Running now"
|
||||
hint={
|
||||
following === null
|
||||
? undefined
|
||||
: `next after this ends in ${formatRemaining(following)}`
|
||||
}
|
||||
action={
|
||||
visible.length > 1 ? (
|
||||
<SortControl
|
||||
@@ -724,15 +709,23 @@ function Shell({ children }: { children: React.ReactNode }) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A titled block of the checklist, with room for one control on the right.
|
||||
*
|
||||
* There was a `hint` slot beside `action` — a line of prose for a section with
|
||||
* no control — rendered as `action ?? hint`. Nothing could ever reach it: its
|
||||
* only caller was "Running now", whose hint needed two live rows, and two live
|
||||
* rows are two visible rows, which is exactly when the sort control appears and
|
||||
* wins. What it would have said is on the page anyway, in the "Then" list of the
|
||||
* headline panel, which names those deadlines and counts them down.
|
||||
*/
|
||||
function Section({
|
||||
title,
|
||||
hint,
|
||||
legend,
|
||||
action,
|
||||
children,
|
||||
}: {
|
||||
title: string;
|
||||
hint?: string | undefined;
|
||||
legend?: boolean | undefined;
|
||||
/** A control that belongs to this section, e.g. how it is ordered. */
|
||||
action?: React.ReactNode | undefined;
|
||||
@@ -742,7 +735,7 @@ function Section({
|
||||
<section className="pt-5">
|
||||
<div className="flex items-baseline justify-between gap-3 px-4 pb-2">
|
||||
<h2 className="eyebrow">{title}</h2>
|
||||
{action ?? (hint !== undefined && <p className="text-xs text-faint">{hint}</p>)}
|
||||
{action}
|
||||
</div>
|
||||
{legend === true && <Legend />}
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user