Draw each dashboard on a round panel's track in its own look

The canvas states the look of the dashboard shown, so a neighbour beside it
and the one a turn leaves wore that look too. Each page now restates its own
look, theme and palette. The ring's paint moves from rules under
[data-look] to variables each look sets on its root, which stop at the
nearer root where a descendant rule reached into both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 16:00:10 +02:00
co-authored by Claude Opus 5.5
parent c2adc2c526
commit 4ae8535cbb
6 changed files with 107 additions and 86 deletions
@@ -15,6 +15,7 @@ import type { WidgetDef } from "@/client"
import { slotsFor } from "@/components/Common/UplotChart"
import { fadeIn } from "@/lib/motion"
import { useShortcuts } from "@/lib/shortcuts"
import { cn } from "@/lib/utils"
import { useClock } from "./ClockWidget"
import type { Dashboard } from "./DashboardView"
import { useBoundValue, useBoundValues } from "./dataContext"
@@ -40,7 +41,7 @@ import {
text,
} from "./ui/core/config"
import { TESTID } from "./ui/core/contract"
import { useLook } from "./ui/core/look"
import { LookProvider, useCanvasRoot, useLook } from "./ui/core/look"
import { LOOK } from "./ui/core/motion"
import {
ANNOUNCE_MS,
@@ -334,12 +335,7 @@ export function RoundPanel({
return (
// Keyed by name, so a neighbour becomes the one shown, and back,
// without being drawn afresh: its own face memory and all.
<div
key={page.name}
className="absolute inset-0"
style={{ translate: `0 ${at * size}px` }}
inert={at !== 0}
>
<TrackPage key={page.name} dashboard={page} at={at} size={size}>
<PaletteProvider dashboard={page}>
{editing ? (
view
@@ -347,13 +343,52 @@ export function RoundPanel({
<LockedProvider dashboard={page}>{view}</LockedProvider>
)}
</PaletteProvider>
</div>
</TrackPage>
)
})}
</motion.div>
)
}
/**
* One dashboard on a round panel's track, in its own look.
*
* The canvas states the look, theme and palette of the dashboard shown, so a
* neighbour beside it, or the one a turn is leaving, would wear those too.
* Each page restates its own instead. The ground stays the canvas's, which
* changes over as soon as the turn begins.
*/
function TrackPage({
dashboard,
at,
size,
children,
}: {
dashboard: Dashboard
/** Its place on the track, in screens from the one shown. */
at: number
size: number
children: React.ReactNode
}) {
// Touch belongs to the screen, so it is the canvas's whichever page this is.
const { touch } = useLook()
const root = useCanvasRoot(dashboard, touch)
return (
<LookProvider dashboard={dashboard} touch={touch}>
<div
data-look={root["data-look"]}
data-touch={root["data-touch"]}
data-palette={root["data-palette"]}
className={cn("absolute inset-0 text-foreground", root.className)}
style={{ ...root.style, translate: `0 ${at * size}px` }}
inert={at !== 0}
>
{children}
</div>
</LookProvider>
)
}
/** A dashboard's icon and title: what a panel shows for a moment of a
* dashboard it has just landed on. Opaque, so the face under it does not
* read through the name. */