Touch is a panel setting, and the rail grows with it
Docs / docs (push) Successful in 22s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m9s
Playwright Tests / test-playwright (2, 2) (push) Failing after 11s
pre-commit / pre-commit (push) Failing after 1m59s
Test Backend / test-backend (push) Failing after 2m28s
Compose Smoke Test / test-compose (push) Failing after 11s
Playwright Tests / merge-reports (push) Failing after 2m19s
Docs / docs (push) Successful in 22s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m9s
Playwright Tests / test-playwright (2, 2) (push) Failing after 11s
pre-commit / pre-commit (push) Failing after 1m59s
Test Backend / test-backend (push) Failing after 2m28s
Compose Smoke Test / test-compose (push) Failing after 11s
Playwright Tests / merge-reports (push) Failing after 2m19s
It described the wrong object. A dashboard is a document that may hang on a
hallway tablet and in a desk browser at the same time, and only one of those
has fingers on it — so the flag moves off `DashboardDef.settings` and onto
`PanelDef` as a plain bool, ticked in the Panels dialog. `useCanvasRoot` takes
it as an argument rather than reading the document, and `/panel/{id}` is the
only surface with a panel to ask.
Dropping the message binding with it is deliberate: nothing drove it, and a
flow deciding whether a screen has fingers on it was never the point. A stored
`settings.touch` is inert rather than migrated, which `_check_settings`
skipping unknown names already guaranteed.
The rail was the other half. It had no touch behaviour at all and its 40px
buttons met neither branch of the 44/32 rule. `[data-touch] .dui-rail{-item}`
in `ui/core/core.css` spends the padding and the gap on the buttons instead,
so they reach the 44px target and the rail comes out taller at exactly the
same width — `RAIL_INSET` never moves, and the arrangement under it does not
either.
Also closes the panels-dialog icon gap: `DashboardSummary` carries the `icon`
now, so the dialog draws each assigned dashboard's rail glyph beside its
checkbox. `initials()` went from three identical copies in the looks to one in
`Dashboard/icons.ts`, so the dialog and the rail fall back the same way.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Va7ExQDtuwKN7kNpHhWWNQ
This commit is contained in:
@@ -56,6 +56,33 @@
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
/*
|
||||
* The rail grows into the column it already has rather than taking a wider one.
|
||||
*
|
||||
* `RAIL_INSET` reserves the same 72px either way — the arrangement must not
|
||||
* move because a screen was told it has fingers on it — so the padding and the
|
||||
* gap pay for the buttons, and the rail comes out taller rather than wider.
|
||||
* 48px of width less two 2px margins is the 44px target the guidelines ask for.
|
||||
*
|
||||
* Geometry here, paint in each look: the sizes are Tailwind literals on the
|
||||
* three `Rail`s, which this beats because the file lands unlayered.
|
||||
*/
|
||||
[data-touch] .dui-rail {
|
||||
padding: 0.125rem;
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
[data-touch] .dui-rail-item {
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
[data-touch] .dui-rail-item svg {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pulled up half a step, so the title reads from the centre of the corner
|
||||
* radius rather than from below it — and the body, which is what anyone is
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* Which look is being drawn, and what the canvas it is drawn on carries.
|
||||
*
|
||||
* A dashboard states its look, its colours and whether it is touched on one
|
||||
* element — the canvas root — and everything below reads them from there:
|
||||
* the tokens by inheritance, the look and the touch flag through this context.
|
||||
* A dashboard states its look and its colours, and the panel it hangs on says
|
||||
* whether it is touched, on one element — the canvas root — and everything
|
||||
* below reads them from there: the tokens by inheritance, the look and the
|
||||
* touch flag through this context.
|
||||
*
|
||||
* The style is carried in the context as well as on the element, because a
|
||||
* menu is portalled to `body` and lands outside the canvas. A surface that
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
useDashboardLook,
|
||||
useDashboardPalette,
|
||||
useDashboardTheme,
|
||||
useDashboardTouch,
|
||||
} from "../../settings"
|
||||
import { rolesOf, tokenStyle } from "./theme"
|
||||
|
||||
@@ -47,13 +47,21 @@ export const useLook = () => useContext(LookContext)
|
||||
* for a dashboard that follows the device: the sets state their own colours
|
||||
* per theme, and a chart canvas has to be told which one it is drawing in.
|
||||
* Restating the app's own resolved theme changes nothing when they agree.
|
||||
*
|
||||
* `touch` is passed in rather than read off the document, because it belongs to
|
||||
* the screen rather than to the dashboard: the same document may hang on a
|
||||
* hallway tablet and on a desk browser. Only `/panel/{id}` has a panel to ask,
|
||||
* so everywhere else takes the default — a phone still gets the finger-sized
|
||||
* ladder from the width query in `core.css`.
|
||||
*/
|
||||
export function useCanvasRoot(dashboard: DashboardDef_Output | undefined) {
|
||||
export function useCanvasRoot(
|
||||
dashboard: DashboardDef_Output | undefined,
|
||||
touch = false,
|
||||
) {
|
||||
const { resolvedTheme } = useTheme()
|
||||
const stated = useDashboardTheme(dashboard)
|
||||
const roles = rolesOf(useDashboardPalette(dashboard))
|
||||
const look = useDashboardLook(dashboard)
|
||||
const touch = useDashboardTouch(dashboard)
|
||||
return {
|
||||
className: stated || (resolvedTheme === "dark" ? "dark" : "light"),
|
||||
style: (roles ? tokenStyle(roles) : {}) as React.CSSProperties,
|
||||
@@ -72,12 +80,15 @@ export function useCanvasRoot(dashboard: DashboardDef_Output | undefined) {
|
||||
*/
|
||||
export function LookProvider({
|
||||
dashboard,
|
||||
touch,
|
||||
children,
|
||||
}: {
|
||||
dashboard: DashboardDef_Output | undefined
|
||||
/** Whether the panel this is drawn on is touched. See `useCanvasRoot`. */
|
||||
touch?: boolean
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const root = useCanvasRoot(dashboard)
|
||||
const root = useCanvasRoot(dashboard, touch)
|
||||
return (
|
||||
<LookContext.Provider
|
||||
value={{
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ICONS } from "../../icons"
|
||||
import { ICONS, initials } from "../../icons"
|
||||
import type {
|
||||
BackdropProps,
|
||||
FrameProps,
|
||||
@@ -110,21 +110,13 @@ export function Frame({
|
||||
)
|
||||
}
|
||||
|
||||
/** Two letters off the title, so a rail of four reads as four different things. */
|
||||
function initials(label: string): string {
|
||||
const words = label.split(/[\s_-]+/).filter(Boolean)
|
||||
if (words.length === 0) return "?"
|
||||
if (words.length === 1) return words[0].slice(0, 2).toUpperCase()
|
||||
return (words[0][0] + words[1][0]).toUpperCase()
|
||||
}
|
||||
|
||||
export function Rail({ entries }: RailProps) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Dashboards on this panel"
|
||||
data-testid={TESTID.rail}
|
||||
className={cn(
|
||||
"fx-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
"dui-rail fx-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
// As tall as what it carries, centred in the column it reserves: a
|
||||
// rail of two stretched to the height of the panel is mostly empty
|
||||
// pill. More dashboards than the panel is tall still scroll, but no
|
||||
@@ -142,7 +134,7 @@ export function Rail({ entries }: RailProps) {
|
||||
aria-label={entry.label}
|
||||
aria-current={entry.active ? "page" : undefined}
|
||||
data-testid={`panel-rail-${entry.name}`}
|
||||
className="fx-rail-item relative flex size-10 shrink-0 items-center justify-center text-xs font-medium"
|
||||
className="dui-rail-item fx-rail-item relative flex size-10 shrink-0 items-center justify-center text-xs font-medium"
|
||||
>
|
||||
{entry.active ? (
|
||||
<motion.span
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ICONS } from "../../icons"
|
||||
import { ICONS, initials } from "../../icons"
|
||||
import type {
|
||||
BackdropProps,
|
||||
FrameProps,
|
||||
@@ -143,21 +143,13 @@ export function Frame({
|
||||
)
|
||||
}
|
||||
|
||||
/** Two letters off the title, so a rail of four reads as four different things. */
|
||||
function initials(label: string): string {
|
||||
const words = label.split(/[\s_-]+/).filter(Boolean)
|
||||
if (words.length === 0) return "?"
|
||||
if (words.length === 1) return words[0].slice(0, 2).toUpperCase()
|
||||
return (words[0][0] + words[1][0]).toUpperCase()
|
||||
}
|
||||
|
||||
export function Rail({ entries }: RailProps) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Dashboards on this panel"
|
||||
data-testid={TESTID.rail}
|
||||
className={cn(
|
||||
"gl-surface gl-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
"dui-rail gl-surface gl-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
// As tall as what it carries, centred in the column it reserves: a
|
||||
// rail of two stretched to the height of the panel is mostly empty
|
||||
// pill. More dashboards than the panel is tall still scroll, but no
|
||||
@@ -176,7 +168,7 @@ export function Rail({ entries }: RailProps) {
|
||||
aria-current={entry.active ? "page" : undefined}
|
||||
data-testid={`panel-rail-${entry.name}`}
|
||||
className={cn(
|
||||
"gl-pressable relative flex size-10 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
||||
"dui-rail-item gl-pressable relative flex size-10 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
||||
entry.active ? "text-foreground" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ICONS } from "../../icons"
|
||||
import { ICONS, initials } from "../../icons"
|
||||
import type {
|
||||
BackdropProps,
|
||||
FrameProps,
|
||||
@@ -109,21 +109,13 @@ export function Frame({
|
||||
)
|
||||
}
|
||||
|
||||
/** Two letters off the title, so a rail of four reads as four different things. */
|
||||
function initials(label: string): string {
|
||||
const words = label.split(/[\s_-]+/).filter(Boolean)
|
||||
if (words.length === 0) return "?"
|
||||
if (words.length === 1) return words[0].slice(0, 2).toUpperCase()
|
||||
return (words[0][0] + words[1][0]).toUpperCase()
|
||||
}
|
||||
|
||||
export function Rail({ entries }: RailProps) {
|
||||
return (
|
||||
<nav
|
||||
aria-label="Dashboards on this panel"
|
||||
data-testid={TESTID.rail}
|
||||
className={cn(
|
||||
"m3-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
"dui-rail m3-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
|
||||
// As tall as what it carries, centred in the column it reserves: a
|
||||
// rail of two stretched to the height of the panel is mostly empty
|
||||
// pill. More dashboards than the panel is tall still scroll, but no
|
||||
@@ -142,7 +134,7 @@ export function Rail({ entries }: RailProps) {
|
||||
aria-current={entry.active ? "page" : undefined}
|
||||
data-testid={`panel-rail-${entry.name}`}
|
||||
className={cn(
|
||||
"m3-pressable relative flex size-10 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
||||
"dui-rail-item m3-pressable relative flex size-10 shrink-0 items-center justify-center rounded-full text-xs font-medium",
|
||||
entry.active
|
||||
? "text-card-foreground"
|
||||
: "text-muted-foreground",
|
||||
|
||||
Reference in New Issue
Block a user