From c74694cf1fb6114a0a1ef119ddb46c47346b5c53 Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Sat, 14 Nov 2026 12:23:31 +0700 Subject: [PATCH] feat: restyle the web UI as a spaceship cockpit The map is a canopy with a bezel, an inset window and a sill carrying a Window | Radar view switch. Consoles open as centered screens; Orbits, Outposts, Activity and the snapshot sheet follow one vocabulary of recessed fields, bevelled keys and lamps that stay distinct by shape. - Activity replaces the Restore tab with one log of backups and restores. Rows lead to a snapshot or an orbit; restores and exports start from the snapshot. The model is a pure function with tests. - Restore opens from a snapshot as a two column screen: choose and confirm on the left, job progress or countdown on the right. - Add Segmented and a themed Select (portal list, keyboard and form support). - Add a spotlight-style search panel. Co-Authored-By: Claude Sonnet 5.5 --- docs/UI.md | 18 +- web/scripts/activity.test.mjs | 80 +++ web/src/App.tsx | 60 +- web/src/api.ts | 9 + web/src/components/activity/ActivityView.tsx | 122 ++++ web/src/components/hud/DiegeticHUD.tsx | 14 +- web/src/components/hud/HUDPanel.tsx | 22 +- web/src/components/hud/HUDRail.tsx | 10 +- web/src/components/hud/VaultSearch.tsx | 24 +- .../components/orbits/CaptureProfileForm.tsx | 7 +- web/src/components/orbits/JobHistory.tsx | 21 +- web/src/components/orbits/OrbitsView.tsx | 288 ++++----- web/src/components/orbits/RetentionFields.tsx | 13 +- web/src/components/outposts/OutpostField.tsx | 5 +- web/src/components/outposts/WormholeView.tsx | 212 ++++--- .../reconstitute/DatabaseRestore.tsx | 177 ++++-- .../reconstitute/ReconstituteWizard.tsx | 266 ++++---- .../reconstitute/RestoreTargetForm.tsx | 4 +- web/src/components/scene/VaultScene.tsx | 108 ++-- web/src/components/ui/Button.tsx | 13 +- web/src/components/ui/EmptyState.tsx | 2 +- web/src/components/ui/Segmented.tsx | 36 ++ web/src/components/ui/Select.tsx | 188 ++++++ web/src/components/vault/SnapshotSheet.tsx | 125 +++- web/src/hooks/useActivity.ts | 26 + web/src/index.css | 576 ++++++++++++++++-- web/src/lib/activity.ts | 173 ++++++ 27 files changed, 1971 insertions(+), 628 deletions(-) create mode 100644 web/scripts/activity.test.mjs create mode 100644 web/src/components/activity/ActivityView.tsx create mode 100644 web/src/components/ui/Segmented.tsx create mode 100644 web/src/components/ui/Select.tsx create mode 100644 web/src/hooks/useActivity.ts create mode 100644 web/src/lib/activity.ts diff --git a/docs/UI.md b/docs/UI.md index db24cf5..f86028e 100644 --- a/docs/UI.md +++ b/docs/UI.md @@ -12,7 +12,18 @@ The persistent viewport maps backup jobs and recovery points. The black hole rep - **Big Screen** expands the map and keeps summary counts, motion controls, and a floating navigation dock. The map and dock spring into position within the current browser viewport. Use **Exit big screen** or Escape to return to the workspace. - Drag the active navbar item sideways and release to open the destination. The regular navbar uses text and a sliding underline. The Big Screen dock uses labeled icons and a liquid highlight. - The navbar stays available above the side panel so you can switch directly between consoles. In the regular workspace it becomes a floating text dock in the same top position. Big Screen keeps its icon dock at the bottom. -- Use **Search**, **⌘K**, or **Ctrl+K** from the vault, a console, or Big Screen. An empty field shows navigation shortcuts. Type to find destinations, orbits by name, ID, or provider, and snapshots by orbit name, ID, or displayed capture date. Search uses the summaries already loaded by the vault. Use the arrow keys and Enter, or select a result with a pointer. Escape closes search and returns focus to its button. +- Use **Search**, **⌘K**, or **Ctrl+K** from the vault, a console, or Big Screen. An empty field shows navigation shortcuts. Type to find destinations, orbits by name, ID, or provider, and snapshots by orbit name, ID, or displayed capture date. Search uses the summaries already loaded by the vault. Use the arrow keys and Enter, or select a result with a pointer. Escape closes search and returns focus to its button. Search is a spotlight panel over a dimmed, lightly blurred deck: a large input, grouped results with a kind label on the right (the active row adds an Enter mark), a footer of key hints and the result count, and a "No signal" message when nothing matches. + +## Consoles + +- Orbits, Outposts, Activity and Snapshot open as console screens, and Restore opens from a snapshot: a centered panel under the navbar with an engraved label, a title and an Esc key, sized per console (`panelWidths` in `App.tsx`). They fade and rise with the shared spring, and the map behind is inert while one is open. +- Orbits is two columns. The left holds the outpost job history and one card per orbit (a failed orbit gets an ember edge; Capture is the single amber key). The right is the permanent New orbit form: Folder | Database and Via hub | Via outpost are `Segmented` switches, fields are recessed, and Cancel resets the form. Below 860 px the form stacks under the list. +- Outposts is a gate. With no code it shows a dark eye inside violet rings and one key, Open a wormhole. With a code it shows the code in large mono, a burn bar and a ticking time left (the bar counts down from the time the code was first seen, since the hub sends only the expiry), the agent command with a Copy key, and Generate fresh code. Outpost health is a roster with a lamp, last activity and an Online or Silent label; an outpost is online if it was seen in the last two minutes. +- Selects are themed (`ui/Select.tsx`, a drop-in for ` { setQuery(event.target.value); setShown(PAGE); }} /> + + { setKind(value); setShown(PAGE); }} + options={[{ value: "all", label: "All" }, { value: "backup", label: "Backups" }, { value: "restore", label: "Restores" }]} /> + {age === undefined ? "Loading…" : `Updated ${age} s ago`} + + {(restoresUnavailable || capturesUnavailable) && ( +

+ {restoresUnavailable ? "Restore history is unavailable. This hub may be too old to list restore jobs." : "Outpost backup jobs are unavailable."} + {" "}The rest of the log is still shown. +

+ )} +
+ {sections.map((section) => ( +
+

{section.label}

+ {section.items.map((entry) => )} +
+ ))} + {!sections.length && ( +
+

{entries.length ? "No entries" : "Nothing yet"}

+ {entries.length ? "Nothing in the log matches that filter." : "Backups and restores will appear here as they run."} +
+ )} + {matching.length > visible.length && ( + + )} +
+ + ); +} diff --git a/web/src/components/hud/DiegeticHUD.tsx b/web/src/components/hud/DiegeticHUD.tsx index 3ea66b6..4e42535 100644 --- a/web/src/components/hud/DiegeticHUD.tsx +++ b/web/src/components/hud/DiegeticHUD.tsx @@ -40,12 +40,12 @@ export function TelemetryStrip({ useScreenTransition(strip, bigScreen, reducedMotion, undefined, true); return (
-
Orbits
-
Failed
+
Orbits
+
Failed
-
Snapshots
-
Payload
+
Snapshots
+
Payload
); } @@ -76,8 +76,8 @@ export function OrbitRegister({
-

Flight register

-

Orbits

+

Orbit register · L

+

{orbits.length === 1 ? "1 orbit" : `${orbits.length} orbits`}

{message &&

{message}

} @@ -132,7 +132,7 @@ export function OrbitInspector({
-

Orbit detail

+

Orbit inspector · R

{orbit?.name ?? "Select an orbit"}

{orbit &&

{status.label}

}
diff --git a/web/src/components/hud/HUDPanel.tsx b/web/src/components/hud/HUDPanel.tsx index ed0ddd0..5ff5859 100644 --- a/web/src/components/hud/HUDPanel.tsx +++ b/web/src/components/hud/HUDPanel.tsx @@ -1,11 +1,17 @@ import { motion } from "motion/react"; -import { useEffect, useId, useLayoutEffect, useRef, type ReactNode } from "react"; +import { useEffect, useId, useLayoutEffect, useRef, type CSSProperties, type ReactNode } from "react"; export function HUDPanel({ - open, title, subtitle, onClose, children, inert, + open, title, label = "Vault console", width = 640, flush = false, subtitle, onClose, children, inert, }: { open: boolean; title: string; + /** Engraved line above the title, e.g. "Console 02 · Orbit management". */ + label?: string; + /** Console screen width in px; it never exceeds the viewport. */ + width?: number; + /** Drop the content padding so a view can lay out its own columns. */ + flush?: boolean; subtitle?: string; onClose: () => void; children: ReactNode; @@ -64,19 +70,21 @@ export function HUDPanel({ aria-hidden={!open} inert={!open || inert} initial={false} - animate={{ x: open ? "0%" : "100%" }} + style={{ "--console-width": `${width}px` } as CSSProperties} + animate={{ opacity: open ? 1 : 0, y: open ? 0 : 18 }} >
-

Vault console

+

{label}

{display.title}

{display.subtitle &&

{display.subtitle}

}
-
-
{children}
+
{children}
); diff --git a/web/src/components/hud/HUDRail.tsx b/web/src/components/hud/HUDRail.tsx index d3bd14e..21bd565 100644 --- a/web/src/components/hud/HUDRail.tsx +++ b/web/src/components/hud/HUDRail.tsx @@ -3,22 +3,24 @@ import { useCallback, useId, useLayoutEffect, useRef, type PointerEvent } from " import { useScreenTransition } from "../../hooks/useScreenTransition"; import { uiSpring } from "../../lib/motion"; -export type HUDMode = "scene" | "orbits" | "wormhole" | "reconstitute" | "snapshot"; +export type HUDMode = "scene" | "orbits" | "wormhole" | "activity" | "reconstitute" | "snapshot"; export const hudItems = [ { id: "scene", label: "Vault", icon: "M4 9l8-4 8 4v6l-8 4-8-4z M4 9l8 4 8-4 M12 13v6" }, { id: "orbits", label: "Orbits", icon: "M21 12a9 5 0 1 1-18 0 9 5 0 1 1 18 0z M12 10.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 1 1 0-3z M18 5h.01" }, { id: "wormhole", label: "Outposts", icon: "M12 3v3 M4.2 7.5l2.6 1.5 M4.2 16.5 6.8 15 M12 18v3 M17.2 15l2.6 1.5 M17.2 9l2.6-1.5 M15.5 12a3.5 3.5 0 1 1-7 0 3.5 3.5 0 1 1 7 0z" }, - { id: "reconstitute", label: "Restore", icon: "M4 12a8 8 0 1 1 2.3 5.7 M4 6v6h6 M12 8v4l3 2" }, + { id: "activity", label: "Activity", icon: "M3 12h4l3-7 4 14 3-7h4" }, ] as const; type Slot = { center: number; width: number }; type Gesture = { pointer: number; x: number; y: number; origin?: number }; export function HUDRail({ - active, floating, panelOpen, reducedMotion, onSelect, + active, floating, panelOpen, reducedMotion, alerts, onSelect, }: { active: HUDMode; + /** Tabs with something that needs a person: their lamp turns ember even when they are not the active tab. */ + alerts?: Partial>; floating: boolean; panelOpen: boolean; reducedMotion: boolean; @@ -169,6 +171,8 @@ export function HUDRail({ key={id} type="button" aria-label={label} + data-tab={id} + data-alert={alerts?.[id] ? "true" : undefined} title={floating ? label : undefined} onClick={() => onSelect(id)} aria-current={active === id ? "page" : undefined} diff --git a/web/src/components/hud/VaultSearch.tsx b/web/src/components/hud/VaultSearch.tsx index a5e8c60..a58b215 100644 --- a/web/src/components/hud/VaultSearch.tsx +++ b/web/src/components/hud/VaultSearch.tsx @@ -123,7 +123,7 @@ export function VaultSearch({ open, reducedMotion, orbits, snapshots, orbitStatu { setQuery(event.currentTarget.value); setActiveId(undefined); @@ -152,19 +152,31 @@ export function VaultSearch({ open, reducedMotion, orbits, snapshots, orbitStatu {result.label} {result.detail && {result.detail}} + ); })} ))} -

- {results.length ? `${results.length} ${query.trim() ? "results shown" : "destinations"}` : "No matching results."} - {orbitStatus && {orbitStatus}} - {snapshotStatus && {snapshotStatus}} -

+ {!results.length && ( + + )} +
+ +

+ {results.length ? `${results.length} ${query.trim() ? "results shown" : "destinations"}` : "No matching results."} + {orbitStatus && {orbitStatus}} + {snapshotStatus && {snapshotStatus}} +

+
); diff --git a/web/src/components/orbits/CaptureProfileForm.tsx b/web/src/components/orbits/CaptureProfileForm.tsx index 8e7b3b0..e5cbf27 100644 --- a/web/src/components/orbits/CaptureProfileForm.tsx +++ b/web/src/components/orbits/CaptureProfileForm.tsx @@ -4,8 +4,9 @@ import { registerCaptureProfile, type BackupSource, type CaptureProfile } from " import { OutpostField } from "../outposts/OutpostField"; import { Button } from "../ui/Button"; import { Hint } from "../ui/EmptyState"; +import { Select } from "../ui/Select"; -const field = "mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"; +const field = "field"; const uuidPattern = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"; export function CaptureProfileForm({ orbitId, source, onClose }: { orbitId: string; source: BackupSource | null; onClose: () => void }) { @@ -45,10 +46,10 @@ export function CaptureProfileForm({ orbitId, source, onClose }: { orbitId: stri {source !== "filesystem" && }