Stagger a rectangular panel's new dashboard by rail order

Changing dashboard kept the grid mounted, so every new tile rose at once.
The grid is drawn afresh per dashboard and its tiles come in row by row:
from below, top row first, for one further down the rail, and from above,
bottom row first, for one further up, as a round panel's dashboards slide.

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:12:38 +02:00
co-authored by Claude Opus 5.5
parent fb889a9e10
commit 17d58697c4
5 changed files with 57 additions and 19 deletions
+12 -1
View File
@@ -1,6 +1,6 @@
import { keepPreviousData, useQuery } from "@tanstack/react-query"
import { createFileRoute, redirect } from "@tanstack/react-router"
import { useCallback, useMemo } from "react"
import { useCallback, useMemo, useState } from "react"
import type { Dashboard } from "@/components/Dashboard/DashboardView"
import { PanelRail } from "@/components/Dashboard/PanelRail"
@@ -84,6 +84,16 @@ function PanelRoute() {
},
[panel, current, navigate],
)
// Which way along the rail the dashboard shown was reached, so its tiles
// come in from that side: further down it (1) from below, as a round
// panel's next dashboard rises, and further up (-1) from above.
const shown = dashboard?.name
const [turned, setTurned] = useState({ name: shown, by: 1 })
if (shown !== turned.name) {
const by =
dashboards.indexOf(shown ?? "") - dashboards.indexOf(turned.name ?? "")
setTurned({ name: shown, by: by < 0 ? -1 : 1 })
}
// Said by the panel rather than by the dashboard: this is the screen, and
// whether it is touched or pointed at is a fact about the screen. A document
// hanging on a hallway tablet and on a desk browser is one document either
@@ -131,6 +141,7 @@ function PanelRoute() {
dashboard={dashboard as Dashboard}
stacked={stacked}
touch={touch}
turned={turned.by}
onDashboard={rail && round ? step : undefined}
around={rail && round ? around : undefined}
// Drawn on the panel rather than beside it: a screen showing four