Float the dashboard rail along the bottom on a phone
Below md a dashboard stacks to one column and dropped its rail. The rail is
now a horizontal row in the dashboard's own look, floated over the bottom
of the screen on /panel/{id} and above the dock in the app's view, with
44px items, sideways scrolling when it overflows, and padding so the last
tile clears it; a panel's read-only notice moves up out of its way. The
three looks share the geometry from ui/core.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
@@ -361,6 +361,20 @@ export function DashboardEditor({
|
||||
(panel.dashboards ?? []).includes(draft.name),
|
||||
)?.dashboards ?? null
|
||||
const hasRail = Boolean(railDashboards) && !stacked
|
||||
const rail = railDashboards ? (
|
||||
<PanelRail
|
||||
dashboards={railDashboards}
|
||||
current={draft.name}
|
||||
horizontal={stacked}
|
||||
// Editing one dashboard of a panel and editing its neighbour are the
|
||||
// same job, so the rail keeps whichever mode this one is in.
|
||||
linkFor={(name) => ({
|
||||
to: "/dashboards/$name",
|
||||
params: { name },
|
||||
search: edit ? { edit: true } : {},
|
||||
})}
|
||||
/>
|
||||
) : null
|
||||
// What the arrangement is laid out in: the canvas less its margin, and less
|
||||
// the rail's column when the panel carries one.
|
||||
const area = areaOf(draft, hasRail)
|
||||
@@ -453,38 +467,29 @@ export function DashboardEditor({
|
||||
data-touch={root["data-touch"]}
|
||||
data-palette={root["data-palette"]}
|
||||
className={cn(
|
||||
"h-full overflow-y-auto bg-background text-foreground",
|
||||
"relative h-full bg-background text-foreground",
|
||||
root.className,
|
||||
)}
|
||||
style={root.style}
|
||||
>
|
||||
<DashboardView
|
||||
dashboard={draft}
|
||||
stacked
|
||||
editing={edit}
|
||||
renderWidget={edit ? pickable : undefined}
|
||||
/>
|
||||
<div className={cn("h-full overflow-y-auto", rail && "pb-20")}>
|
||||
<DashboardView
|
||||
dashboard={draft}
|
||||
stacked
|
||||
editing={edit}
|
||||
renderWidget={edit ? pickable : undefined}
|
||||
/>
|
||||
</div>
|
||||
{rail ? (
|
||||
// No column to spare on a phone, so the rail is a row floating over
|
||||
// the bottom of the stack, just above the dock.
|
||||
<div className="pointer-events-none absolute inset-x-0 bottom-3 z-10 flex justify-center">
|
||||
{rail}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : (
|
||||
<CanvasSurface
|
||||
dashboard={draft}
|
||||
dots={edit}
|
||||
rail={
|
||||
railDashboards ? (
|
||||
<PanelRail
|
||||
dashboards={railDashboards}
|
||||
current={draft.name}
|
||||
// Editing one dashboard of a panel and editing its neighbour are
|
||||
// the same job, so the rail keeps whichever mode this one is in.
|
||||
linkFor={(name) => ({
|
||||
to: "/dashboards/$name",
|
||||
params: { name },
|
||||
search: edit ? { edit: true } : {},
|
||||
})}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
<CanvasSurface dashboard={draft} dots={edit} rail={rail}>
|
||||
{(scale) =>
|
||||
!edit ? (
|
||||
<DashboardView dashboard={draft} rail={hasRail} />
|
||||
|
||||
Reference in New Issue
Block a user