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 <noreply@anthropic.com>
This commit is contained in:
@@ -40,12 +40,12 @@ export function TelemetryStrip({
|
||||
useScreenTransition(strip, bigScreen, reducedMotion, undefined, true);
|
||||
return (
|
||||
<dl ref={strip} className="vault-telemetry">
|
||||
<div><dt>Orbits</dt><dd><TelemetryValue value={orbitCount} /></dd></div>
|
||||
<div><dt>Failed</dt><dd className={failedCount ? "telemetry-alert" : ""}>
|
||||
<div data-metric="orbits"><dt>Orbits</dt><dd><TelemetryValue value={orbitCount} /></dd></div>
|
||||
<div data-metric="failed" data-state={failedCount ? "alert" : "ok"}><dt>Failed</dt><dd className={failedCount ? "telemetry-alert" : ""}>
|
||||
<TelemetryValue value={orbitCount === undefined ? undefined : failedCount} />
|
||||
</dd></div>
|
||||
<div><dt>Snapshots</dt><dd><TelemetryValue value={snapCount} /></dd></div>
|
||||
<div><dt>Payload</dt><dd><TelemetryValue value={snapCount === undefined ? undefined : totalBytes} bytes /></dd></div>
|
||||
<div data-metric="snapshots"><dt>Snapshots</dt><dd><TelemetryValue value={snapCount} /></dd></div>
|
||||
<div data-metric="payload"><dt>Payload</dt><dd><TelemetryValue value={snapCount === undefined ? undefined : totalBytes} bytes /></dd></div>
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
@@ -76,8 +76,8 @@ export function OrbitRegister({
|
||||
<motion.section className="vault-console orbit-register" aria-labelledby="register-title" inert={bigScreen}
|
||||
initial={false} animate={{ opacity: bigScreen ? 0 : 1 }}>
|
||||
<header className="console-heading">
|
||||
<p className="instrument-label">Flight register</p>
|
||||
<h2 id="register-title">Orbits</h2>
|
||||
<p className="instrument-label">Orbit register · L</p>
|
||||
<h2 id="register-title">{orbits.length === 1 ? "1 orbit" : `${orbits.length} orbits`}</h2>
|
||||
</header>
|
||||
{message && <p className="console-empty" role="status">{message}</p>}
|
||||
<motion.ul className="register-list" layoutScroll>
|
||||
@@ -132,7 +132,7 @@ export function OrbitInspector({
|
||||
<motion.section className="vault-console orbit-inspector" aria-labelledby="inspector-title" inert={bigScreen}
|
||||
initial={false} animate={{ opacity: bigScreen ? 0 : 1 }}>
|
||||
<header className="console-heading">
|
||||
<p className="instrument-label">Orbit detail</p>
|
||||
<p className="instrument-label">Orbit inspector · R</p>
|
||||
<h2 id="inspector-title">{orbit?.name ?? "Select an orbit"}</h2>
|
||||
{orbit && <p className={`inspector-state tone-${status.tone}`}><span className={`register-signal signal-${status.tone}`} />{status.label}</p>}
|
||||
</header>
|
||||
|
||||
@@ -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 }}
|
||||
>
|
||||
<header className="dialog-heading">
|
||||
<div>
|
||||
<p className="instrument-label">Vault console</p>
|
||||
<p className="instrument-label">{label}</p>
|
||||
<h2 id={labelId} ref={heading} tabIndex={-1}>{display.title}</h2>
|
||||
{display.subtitle && <p id={descriptionId}>{display.subtitle}</p>}
|
||||
</div>
|
||||
<button type="button" className="console-control" onClick={onClose}>
|
||||
Close <span aria-hidden="true">×</span>
|
||||
<button type="button" className="console-control dialog-close" aria-label="Close console" title="Close (Esc)" onClick={onClose}>
|
||||
<span aria-hidden="true">ESC</span>
|
||||
<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" aria-hidden="true"><path d="m3 3 10 10M13 3 3 13" /></svg>
|
||||
</button>
|
||||
</header>
|
||||
<div className="dialog-content"><div className="spring-stack">{children}</div></div>
|
||||
<div className={flush ? "dialog-content dialog-content--flush" : "dialog-content"}><div className="spring-stack">{children}</div></div>
|
||||
</motion.aside>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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<Record<HUDMode, boolean>>;
|
||||
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}
|
||||
|
||||
@@ -123,7 +123,7 @@ export function VaultSearch({ open, reducedMotion, orbits, snapshots, orbitStatu
|
||||
<input ref={input} type="text" role="combobox" aria-label="Search vault"
|
||||
aria-autocomplete="list" aria-expanded={!!results.length} aria-controls={`${id}-results`}
|
||||
aria-activedescendant={activeOption}
|
||||
autoComplete="off" autoCapitalize="none" spellCheck={false} placeholder="Search the vault…"
|
||||
autoComplete="off" autoCapitalize="none" spellCheck={false} placeholder="Search orbits, snapshots, consoles…"
|
||||
value={query} onChange={event => {
|
||||
setQuery(event.currentTarget.value);
|
||||
setActiveId(undefined);
|
||||
@@ -152,19 +152,31 @@ export function VaultSearch({ open, reducedMotion, orbits, snapshots, orbitStatu
|
||||
<span>{result.label}</span>
|
||||
{result.detail && <small>{result.detail}</small>}
|
||||
</span>
|
||||
<span className="search-result-hint" aria-hidden="true">
|
||||
{result.kind === "navigation" ? "Console" : result.kind === "orbit" ? "Orbit" : "Snapshot"}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<p className="search-status" role="status">
|
||||
<span>{results.length ? `${results.length} ${query.trim() ? "results shown" : "destinations"}` : "No matching results."}</span>
|
||||
{orbitStatus && <span>{orbitStatus}</span>}
|
||||
{snapshotStatus && <span>{snapshotStatus}</span>}
|
||||
</p>
|
||||
{!results.length && (
|
||||
<div className="search-empty" aria-hidden="true">
|
||||
<p>No signal</p>
|
||||
<span>Nothing matches that. Try an orbit name, ID, provider, or a capture date.</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</motion.div>
|
||||
<footer className="search-footer">
|
||||
<span className="search-keys" aria-hidden="true"><span>↑↓ Move</span><span>↵ Open</span><span>Esc Close</span></span>
|
||||
<p className="search-status" role="status">
|
||||
<span>{results.length ? `${results.length} ${query.trim() ? "results shown" : "destinations"}` : "No matching results."}</span>
|
||||
{orbitStatus && <span>{orbitStatus}</span>}
|
||||
{snapshotStatus && <span>{snapshotStatus}</span>}
|
||||
</p>
|
||||
</footer>
|
||||
</motion.section>
|
||||
</motion.div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user