Home mosaic, multi-select delete, offline banner and loading states

- Home puts the dashboards beside the flows: two equal-height columns,
  capped and scrollable, most recently worked on first. Each tile is a
  schematic footprint built from the stored widget placements.
- Flows and dashboards can be picked by long press or ctrl-click; the
  create button becomes a trash and one dialog covers the batch.
- The offline banner is drawn on the body so it centres on the viewport,
  and the live socket now releases the offline latch a stray 503 set.
- A boot spinner before React's first commit, a router pending screen for
  code-split pages, and skeletons where an empty list used to flash.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tULRZJUkZsw7rMJ3h4xvu
This commit is contained in:
2026-08-22 12:02:14 +02:00
co-authored by Claude Opus 5
parent 6d84316ce5
commit f17d51c12f
13 changed files with 837 additions and 89 deletions
+50 -25
View File
@@ -1,11 +1,14 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router"
import { createFileRoute, useNavigate } from "@tanstack/react-router"
import { Workflow } from "lucide-react"
import { useState } from "react"
import { FlowsService } from "@/client"
import { OverviewCard, useSelection } from "@/components/Common/OverviewCard"
import {
ConfirmDelete,
OverviewToolbar,
useDeleteSelected,
usePublishAll,
} from "@/components/Common/OverviewToolbar"
import { flowKeys, flowsQueryOptions } from "@/components/Flow/queries"
@@ -19,6 +22,7 @@ import {
DialogTitle,
} from "@/components/ui/dialog"
import { Input } from "@/components/ui/input"
import { Skeleton } from "@/components/ui/skeleton"
import useCustomToast from "@/hooks/useCustomToast"
import { handleError } from "@/utils"
@@ -31,13 +35,14 @@ export const Route = createFileRoute("/_layout/flows/")({
const NAME = /^[a-z][a-z0-9_]*$/
function Flows() {
const { data } = useQuery(flowsQueryOptions())
const { data, isPending } = useQuery(flowsQueryOptions())
const queryClient = useQueryClient()
const navigate = useNavigate()
const { showErrorToast } = useCustomToast()
const [name, setName] = useState("")
const [search, setSearch] = useState("")
const [dialogOpen, setDialogOpen] = useState(false)
const [deleteOpen, setDeleteOpen] = useState(false)
const create = useMutation({
mutationFn: (flow: string) =>
@@ -79,6 +84,13 @@ function Flows() {
.filter((flow) => flow.has_draft)
.map((flow) => flow.name)
const selection = useSelection(flows.map((flow) => flow.name))
const remove = useDeleteSelected(
(flow) => FlowsService.deleteFlow({ name: flow }),
"flow",
() => queryClient.invalidateQueries({ queryKey: flowKeys.all }),
)
return (
<div className="grid gap-6">
<div className="grid gap-1">
@@ -100,6 +112,8 @@ function Flows() {
draftCount={drafts.length}
publishing={publishAll.isPending}
onPublishAll={() => publishAll.mutate(drafts)}
selectedCount={selection.selected.length}
onDeleteSelected={() => setDeleteOpen(true)}
/>
<DialogContent>
<form
@@ -136,7 +150,25 @@ function Flows() {
</DialogContent>
</Dialog>
{flows.length === 0 ? (
<ConfirmDelete
open={deleteOpen}
onOpenChange={setDeleteOpen}
names={selection.selected}
noun="flow"
pending={remove.isPending}
onConfirm={() => {
setDeleteOpen(false)
remove.mutate(selection.selected)
}}
/>
{isPending ? (
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="h-[5.5rem] rounded-lg" />
))}
</div>
) : flows.length === 0 ? (
<p className="text-sm text-muted-foreground">
{needle
? "No flow matches that."
@@ -145,29 +177,22 @@ function Flows() {
) : (
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{flows.map((flow) => (
<Link
<OverviewCard
key={flow.name}
to="/flows/$flowName"
params={{ flowName: flow.name }}
className="grid gap-1 rounded-lg border border-border bg-card p-4 shadow-e1 transition-colors hover:bg-accent/50"
data-testid="flow-card"
>
<span className="flex items-center gap-2">
<Workflow className="size-4 text-muted-foreground" />
{flow.title || flow.name}
{flow.has_draft ? (
<span className="size-1.5 shrink-0 rounded-full bg-primary">
<span className="sr-only">Unpublished changes</span>
</span>
) : null}
</span>
<span className="text-sm text-muted-foreground">
{flow.node_count ?? 0} node
{flow.node_count === 1 ? "" : "s"} ·{" "}
{flow.enabled === false ? "stopped" : "running"}
{flow.error_count ? ` · ${flow.error_count} to fix` : ""}
</span>
</Link>
link={{ to: "/flows/$flowName", params: { flowName: flow.name } }}
icon={Workflow}
title={flow.title || flow.name}
draft={flow.has_draft}
detail={`${flow.node_count ?? 0} node${
flow.node_count === 1 ? "" : "s"
} · ${flow.enabled === false ? "stopped" : "running"}${
flow.error_count ? ` · ${flow.error_count} to fix` : ""
}`}
selecting={selection.selecting}
selected={selection.selected.includes(flow.name)}
onToggle={() => selection.toggle(flow.name)}
testId="flow-card"
/>
))}
</div>
)}