Touch is a panel setting, and the rail grows with it
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.
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
type PanelsConfig,
|
||||
PanelsService,
|
||||
} from "@/client"
|
||||
import { initials, resolveIcon } from "@/components/Dashboard/icons"
|
||||
import {
|
||||
dashboardsQueryOptions,
|
||||
panelsQueryOptions,
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
} from "@/components/ui/dialog"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { Switch } from "@/components/ui/switch"
|
||||
import useAuth from "@/hooks/useAuth"
|
||||
import useCustomToast from "@/hooks/useCustomToast"
|
||||
import { cn } from "@/lib/utils"
|
||||
@@ -120,6 +122,7 @@ export function PanelsDialog() {
|
||||
dashboards={known.map((dashboard) => ({
|
||||
name: dashboard.name,
|
||||
title: dashboard.title || dashboard.name,
|
||||
icon: dashboard.icon ?? "",
|
||||
}))}
|
||||
onChange={(next) => replace(panel.id, next)}
|
||||
onRemove={() =>
|
||||
@@ -196,7 +199,7 @@ function PanelRow({
|
||||
* links — worth seeing — with the writes turned off rather than a 403.
|
||||
*/
|
||||
canEdit: boolean
|
||||
dashboards: { name: string; title: string }[]
|
||||
dashboards: { name: string; title: string; icon: string }[]
|
||||
onChange: (next: PanelDef) => void
|
||||
onRemove: () => void
|
||||
}) {
|
||||
@@ -294,6 +297,25 @@ function PanelRow({
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<label
|
||||
htmlFor={`touch-${panel.id}`}
|
||||
className="flex items-center gap-2 text-sm"
|
||||
>
|
||||
<span className="flex-1">Touch friendly</span>
|
||||
<InfoTip label="Touch friendly">
|
||||
Bigger controls and a bigger rail, and nothing that only happens on
|
||||
hover. Set here rather than on a dashboard because it describes the
|
||||
screen: the same dashboard may also hang somewhere with a mouse.
|
||||
</InfoTip>
|
||||
<Switch
|
||||
id={`touch-${panel.id}`}
|
||||
checked={panel.touch === true}
|
||||
disabled={!canEdit}
|
||||
data-testid={`panel-touch-${panel.id}`}
|
||||
onCheckedChange={(touch) => onChange({ ...panel, touch })}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{dashboards.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
No dashboards to assign yet.
|
||||
@@ -303,6 +325,10 @@ function PanelRow({
|
||||
{dashboards.map((dashboard) => {
|
||||
const position = assigned.indexOf(dashboard.name)
|
||||
const id = `assign-${panel.id}-${dashboard.name}`
|
||||
// What this dashboard draws on the rail. Shown rather than set: the
|
||||
// icon belongs to the document, and this dialog has no draft to put
|
||||
// a change into.
|
||||
const Glyph = resolveIcon(dashboard.icon)
|
||||
return (
|
||||
<label
|
||||
key={dashboard.name}
|
||||
@@ -316,6 +342,16 @@ function PanelRow({
|
||||
disabled={!canEdit}
|
||||
onCheckedChange={() => toggle(dashboard.name)}
|
||||
/>
|
||||
<span
|
||||
aria-hidden
|
||||
className="flex size-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground"
|
||||
>
|
||||
{Glyph ? (
|
||||
<Glyph className="size-4" />
|
||||
) : (
|
||||
initials(dashboard.title)
|
||||
)}
|
||||
</span>
|
||||
<span className="flex-1 truncate">{dashboard.title}</span>
|
||||
{position >= 0 ? (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
|
||||
Reference in New Issue
Block a user