Game UI: diegetic HUD over persistent vault scene
Space Engine-style viewport with cockpit frame, glyph rail, console overlays for orbits/wormhole/decay/reconstitute.
This commit is contained in:
47
docs/UI.md
47
docs/UI.md
@@ -1,22 +1,39 @@
|
||||
# Tessera canvas — screen map
|
||||
# Tessera canvas — Space Engine mode
|
||||
|
||||
One viewport (`100dvh`) with bottom tabs; detail flows use sheets (Labuh-style).
|
||||
Diegetic **cockpit HUD** over a persistent **vault viewport**. No admin tabs — systems open as translucent console overlays.
|
||||
|
||||
| Tab | Purpose |
|
||||
|-----|---------|
|
||||
| **Vault** | Starfield + orbital SVG ring; snapshot tiles; Capture now; entry to reconstitute sheet |
|
||||
| **Orbits** | Orbit cards (status dot, schedule phrase, rehearse badge); add orbit editor; capture; telemetry |
|
||||
| **Wormhole** | Pairing code for outposts; placeholder outpost health (grey = offline) |
|
||||
| **Decay** | Preset library with “in use” from orbit metadata |
|
||||
## Viewport (always on)
|
||||
|
||||
### Sheets (overlays)
|
||||
- Starfield + nebula wash, orbital snapshot ring (SVG)
|
||||
- Corner brackets, scanlines, vignette
|
||||
- Telemetry strip: link status, tile count, stored mass
|
||||
- Left rail: last four snapshot targets (mono labels)
|
||||
- Center action: **CAPTURE NOW**
|
||||
|
||||
- **Snapshot tile** — evidence (time, size), reconstitute CTA, snapshot ID telemetry
|
||||
- **Reconstitute** — pick snapshot/target, 12s grace ring + abort, state copy per SPEC
|
||||
## HUD rail (glyph console)
|
||||
|
||||
### API wiring
|
||||
| Glyph | System | Overlay |
|
||||
|-------|--------|---------|
|
||||
| ◎ | Viewport | Dismiss overlays — pure scene |
|
||||
| ⟳ | Orbits | Right console — schedules, rehearse, create |
|
||||
| ◉ | Wormhole | Outpost pairing uplink |
|
||||
| ◇ | Decay | Retention presets in use |
|
||||
| ↩ | Restore | Bottom console — reconstitute + 12s grace |
|
||||
|
||||
- `GET /api/v1/snapshots`, `/orbits`, `/health`
|
||||
- `POST /api/v1/orbits`, `/orbits/:id/run`, `/reconstitute`, `/wormhole/pairing`
|
||||
**Esc** closes an open console.
|
||||
|
||||
See `web/README.md` for dev commands.
|
||||
## Overlays (not pages)
|
||||
|
||||
- **Snapshot tile** — slides from left when a ring tile is selected on viewport
|
||||
- **Orbit / Wormhole / Decay / Reconstitute** — HUD panels with console chrome
|
||||
|
||||
## API
|
||||
|
||||
Unchanged — see prior polish notes; TanStack Query on `/api/v1/*` and `/health`.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
cd web && npm run build
|
||||
cargo build --release -p tessera-hub # embeds dist
|
||||
```
|
||||
|
||||
199
web/src/App.tsx
199
web/src/App.tsx
@@ -1,6 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { AnimatePresence } from "motion/react";
|
||||
import {
|
||||
abortReconstitute,
|
||||
fetchHealth,
|
||||
@@ -12,24 +11,22 @@ import {
|
||||
} from "./api";
|
||||
import { vaultStatusFromOrbits } from "./lib/format";
|
||||
import { DecayView } from "./components/decay/DecayView";
|
||||
import { AppHeader, NavBar, type Tab } from "./components/layout/NavBar";
|
||||
import { OrbitsView } from "./components/orbits/OrbitsView";
|
||||
import { WormholeView } from "./components/outposts/WormholeView";
|
||||
import { ReconstituteWizard } from "./components/reconstitute/ReconstituteWizard";
|
||||
import { Starfield } from "./components/scene/Starfield";
|
||||
import { VaultScene } from "./components/scene/VaultScene";
|
||||
import { SnapshotSheet } from "./components/vault/SnapshotSheet";
|
||||
import { VaultRing } from "./components/vault/VaultRing";
|
||||
import {
|
||||
CockpitFrame,
|
||||
SnapshotsMiniList,
|
||||
TelemetryStrip,
|
||||
} from "./components/hud/DiegeticHUD";
|
||||
import { HUDPanel, SceneAction } from "./components/hud/HUDPanel";
|
||||
import { HUDRail, type HUDMode } from "./components/hud/HUDRail";
|
||||
import { EmptyState } from "./components/ui/EmptyState";
|
||||
import { QueryGate } from "./components/ui/QueryGate";
|
||||
import { Sheet } from "./components/ui/Sheet";
|
||||
import { StatusDot } from "./components/ui/StatusDot";
|
||||
import { Button } from "./components/ui/Button";
|
||||
|
||||
type Overlay = "none" | "snapshot" | "reconstitute";
|
||||
|
||||
export default function App() {
|
||||
const [tab, setTab] = useState<Tab>("vault");
|
||||
const [overlay, setOverlay] = useState<Overlay>("none");
|
||||
const [mode, setMode] = useState<HUDMode>("scene");
|
||||
const [selectedSnap, setSelectedSnap] = useState<string | null>(null);
|
||||
const [pairing, setPairing] = useState<{ code: string; expires_at: string } | null>(null);
|
||||
const qc = useQueryClient();
|
||||
@@ -40,13 +37,11 @@ export default function App() {
|
||||
refetchInterval: 30_000,
|
||||
retry: 1,
|
||||
});
|
||||
|
||||
const snaps = useQuery({
|
||||
queryKey: ["snapshots"],
|
||||
queryFn: fetchSnapshots,
|
||||
refetchInterval: 8_000,
|
||||
});
|
||||
|
||||
const orbits = useQuery({
|
||||
queryKey: ["orbits"],
|
||||
queryFn: fetchOrbits,
|
||||
@@ -55,108 +50,147 @@ export default function App() {
|
||||
|
||||
const vaultStatus = vaultStatusFromOrbits(orbits.data ?? []);
|
||||
const hubOnline = health.isSuccess;
|
||||
const totalBytes = useMemo(
|
||||
() => (snaps.data ?? []).reduce((a, s) => a + s.size_bytes, 0),
|
||||
[snaps.data],
|
||||
);
|
||||
|
||||
const capturing =
|
||||
orbits.data?.some((o) => o.last_status === "running") ?? false;
|
||||
|
||||
const capture = useMutation({
|
||||
mutationFn: async () => {
|
||||
const list = orbits.data ?? [];
|
||||
const target = list[0];
|
||||
const target = orbits.data?.[0];
|
||||
if (!target) throw new Error("no-orbit");
|
||||
await runOrbit(target.id);
|
||||
},
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: ["snapshots", "orbits"] });
|
||||
},
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ["snapshots", "orbits"] }),
|
||||
});
|
||||
|
||||
const selectedSnapshot = snaps.data?.find((s) => s.id === selectedSnap);
|
||||
|
||||
return (
|
||||
<div className="h-[100dvh] flex flex-col bg-space-950 text-star-100 overflow-hidden relative">
|
||||
<Starfield />
|
||||
<AppHeader
|
||||
statusDot={<StatusDot status={hubOnline ? vaultStatus : "grey"} size="lg" />}
|
||||
subtitle={hubOnline ? "Orbital backup vault" : "Hub unreachable"}
|
||||
/>
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" && mode !== "scene") setMode("scene");
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [mode]);
|
||||
|
||||
<main className="flex-1 min-h-0 relative z-[1]">
|
||||
{tab === "vault" && (
|
||||
const snapshotPanel = selectedSnapshot && mode === "scene";
|
||||
|
||||
return (
|
||||
<div className="h-[100dvh] w-full overflow-hidden bg-space-950 text-star-100 relative">
|
||||
{/* Scene always visible */}
|
||||
<QueryGate
|
||||
query={snaps}
|
||||
empty={
|
||||
<EmptyState
|
||||
title="Quiet vault"
|
||||
body="No snapshots on the ring yet. Add an orbit or capture now."
|
||||
action={{
|
||||
label: "Go to orbits",
|
||||
onClick: () => setTab("orbits"),
|
||||
}}
|
||||
/>
|
||||
<VaultScene snapshots={[]} onSelect={() => {}} capturing={capturing} />
|
||||
}
|
||||
>
|
||||
{(data) => (
|
||||
<VaultRing
|
||||
<VaultScene
|
||||
snapshots={data}
|
||||
capturing={capture.isPending || orbits.data?.some((o) => o.last_status === "running")}
|
||||
capturing={capturing || capture.isPending}
|
||||
onCapture={() => {
|
||||
if (!(orbits.data?.length ?? 0)) setTab("orbits");
|
||||
if (!(orbits.data?.length ?? 0)) setMode("orbits");
|
||||
else capture.mutate();
|
||||
}}
|
||||
onSelect={(id) => {
|
||||
setSelectedSnap(id);
|
||||
setOverlay("snapshot");
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</QueryGate>
|
||||
)}
|
||||
{tab === "orbits" && (
|
||||
<QueryGate
|
||||
query={orbits}
|
||||
empty={<OrbitsView orbits={[]} />}
|
||||
>
|
||||
{(data) => <OrbitsView orbits={data} />}
|
||||
</QueryGate>
|
||||
)}
|
||||
{tab === "outposts" && (
|
||||
<WormholeView
|
||||
pairing={pairing}
|
||||
onPaired={(p) => setPairing(p)}
|
||||
|
||||
<CockpitFrame>
|
||||
<TelemetryStrip
|
||||
status={vaultStatus}
|
||||
online={hubOnline}
|
||||
snapCount={snaps.data?.length ?? 0}
|
||||
totalBytes={totalBytes}
|
||||
/>
|
||||
)}
|
||||
{tab === "decay" && (
|
||||
<DecayView appliedPresets={(orbits.data ?? []).map((o) => o.decay_preset ?? "week-of-dailies")} />
|
||||
)}
|
||||
<SnapshotsMiniList
|
||||
snapshots={snaps.data ?? []}
|
||||
selected={selectedSnap}
|
||||
onSelect={(id) => setSelectedSnap(id)}
|
||||
/>
|
||||
</CockpitFrame>
|
||||
|
||||
{tab === "vault" && (
|
||||
<div className="absolute bottom-20 inset-x-0 flex justify-center px-4 pointer-events-none">
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="pointer-events-auto text-xs shadow-lg backdrop-blur-md"
|
||||
onClick={() => setOverlay("reconstitute")}
|
||||
>
|
||||
Reconstitute…
|
||||
</Button>
|
||||
<div className="absolute bottom-24 left-1/2 -translate-x-1/2 z-30 flex gap-3 pointer-events-none">
|
||||
<SceneAction
|
||||
label={capture.isPending ? "ORBIT ACTIVE…" : "CAPTURE NOW"}
|
||||
disabled={capture.isPending}
|
||||
onClick={() => {
|
||||
if (!(orbits.data?.length ?? 0)) setMode("orbits");
|
||||
else capture.mutate();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
|
||||
<NavBar active={tab} onChange={setTab} />
|
||||
<HUDRail active={mode} onSelect={setMode} capturing={capturing} />
|
||||
|
||||
<AnimatePresence>
|
||||
{overlay === "snapshot" && selectedSnapshot && (
|
||||
<Sheet
|
||||
open
|
||||
<HUDPanel
|
||||
open={!!snapshotPanel}
|
||||
title="Snapshot tile"
|
||||
onClose={() => setOverlay("none")}
|
||||
subtitle="Point-in-time mass on the ring"
|
||||
side="left"
|
||||
onClose={() => setSelectedSnap(null)}
|
||||
>
|
||||
{selectedSnapshot && (
|
||||
<SnapshotSheet
|
||||
snap={selectedSnapshot}
|
||||
onReconstitute={() => setOverlay("reconstitute")}
|
||||
onReconstitute={() => setMode("reconstitute")}
|
||||
/>
|
||||
</Sheet>
|
||||
)}
|
||||
{overlay === "reconstitute" && (
|
||||
<Sheet open title="Reconstitute" onClose={() => setOverlay("none")}>
|
||||
</HUDPanel>
|
||||
|
||||
<HUDPanel
|
||||
open={mode === "orbits"}
|
||||
title="Orbit console"
|
||||
subtitle="Schedule circles — not a spreadsheet"
|
||||
onClose={() => setMode("scene")}
|
||||
>
|
||||
<QueryGate query={orbits} empty={<OrbitsView orbits={[]} />}>
|
||||
{(data) => <OrbitsView orbits={data} />}
|
||||
</QueryGate>
|
||||
</HUDPanel>
|
||||
|
||||
<HUDPanel
|
||||
open={mode === "wormhole"}
|
||||
title="Wormhole uplink"
|
||||
subtitle="Pair an outpost once"
|
||||
onClose={() => setMode("scene")}
|
||||
>
|
||||
<WormholeView pairing={pairing} onPaired={setPairing} />
|
||||
</HUDPanel>
|
||||
|
||||
<HUDPanel
|
||||
open={mode === "decay"}
|
||||
title="Decay field"
|
||||
subtitle="What fades, on purpose"
|
||||
onClose={() => setMode("scene")}
|
||||
>
|
||||
<DecayView
|
||||
appliedPresets={(orbits.data ?? []).map(
|
||||
(o) => o.decay_preset ?? "week-of-dailies",
|
||||
)}
|
||||
/>
|
||||
</HUDPanel>
|
||||
|
||||
<HUDPanel
|
||||
open={mode === "reconstitute"}
|
||||
title="Reconstitute"
|
||||
subtitle="12s grace — abort restores nothing"
|
||||
side="bottom"
|
||||
onClose={() => setMode("scene")}
|
||||
>
|
||||
{(snaps.data?.length ?? 0) === 0 ? (
|
||||
<EmptyState
|
||||
title="No tiles to restore"
|
||||
body="Capture an orbit first, then return here."
|
||||
/>
|
||||
) : (
|
||||
<ReconstituteWizard
|
||||
snapshots={snaps.data ?? []}
|
||||
selected={selectedSnap}
|
||||
@@ -164,13 +198,12 @@ export default function App() {
|
||||
onPoll={pollReconstitute}
|
||||
onAbort={abortReconstitute}
|
||||
/>
|
||||
</Sheet>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</HUDPanel>
|
||||
|
||||
{capture.isError && (
|
||||
<p className="absolute top-14 inset-x-0 text-center text-xs text-orbit-amber pointer-events-none">
|
||||
Add an orbit first, then capture.
|
||||
<p className="absolute top-24 inset-x-0 text-center text-[10px] font-mono text-orbit-amber z-30">
|
||||
NO ORBIT — OPEN ⟳ CONSOLE
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
89
web/src/components/hud/DiegeticHUD.tsx
Normal file
89
web/src/components/hud/DiegeticHUD.tsx
Normal file
@@ -0,0 +1,89 @@
|
||||
import type { ReactNode } from "react";
|
||||
import type { VaultStatus } from "../../lib/format";
|
||||
import { StatusDot } from "../ui/StatusDot";
|
||||
import { formatBytes } from "../../lib/format";
|
||||
import type { Snapshot } from "../../api";
|
||||
|
||||
export function CockpitFrame({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<div className="absolute inset-0 pointer-events-none z-20">
|
||||
<motionBorder />
|
||||
<p className="absolute top-3 left-4 text-[10px] font-mono tracking-[0.35em] text-star-400/80 uppercase">
|
||||
Tessera · orbital vault
|
||||
</p>
|
||||
<p className="absolute top-3 right-4 text-[10px] font-mono text-star-400/60">
|
||||
SYS // VAULT-01
|
||||
</p>
|
||||
<div className="absolute bottom-3 left-4 right-4 h-px bg-gradient-to-r from-transparent via-wormhole-violet/40 to-transparent" />
|
||||
<div className="vignette" />
|
||||
<div className="scanlines" />
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function motionBorder() {
|
||||
return (
|
||||
<>
|
||||
<span className="absolute top-8 left-6 w-12 h-12 border-l-2 border-t-2 border-wormhole-violet/50 rounded-tl" />
|
||||
<span className="absolute top-8 right-6 w-12 h-12 border-r-2 border-t-2 border-wormhole-violet/50 rounded-tr" />
|
||||
<span className="absolute bottom-16 left-6 w-16 h-10 border-l-2 border-b-2 border-star-400/25 rounded-bl" />
|
||||
<span className="absolute bottom-16 right-6 w-16 h-10 border-r-2 border-b-2 border-star-400/25 rounded-br" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function TelemetryStrip({
|
||||
status,
|
||||
online,
|
||||
snapCount,
|
||||
totalBytes,
|
||||
}: {
|
||||
status: VaultStatus;
|
||||
online: boolean;
|
||||
snapCount: number;
|
||||
totalBytes: number;
|
||||
}) {
|
||||
return (
|
||||
<div className="pointer-events-none absolute top-12 left-4 right-4 flex justify-between items-start gap-2 text-[11px] font-mono">
|
||||
<div className="flex items-center gap-2 bg-space-950/50 backdrop-blur-sm border border-space-700/50 rounded px-2 py-1">
|
||||
<StatusDot status={online ? status : "grey"} size="sm" />
|
||||
<span className="text-star-300">{online ? "LINK OK" : "NO LINK"}</span>
|
||||
</div>
|
||||
<div className="text-right text-star-400/90 bg-space-950/40 px-2 py-1 rounded border border-space-800/40">
|
||||
<div>TILES {snapCount}</div>
|
||||
<div className="text-[10px] opacity-70">{formatBytes(totalBytes)} mass</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SnapshotsMiniList({
|
||||
snapshots,
|
||||
selected,
|
||||
onSelect,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
selected: string | null;
|
||||
onSelect: (id: string) => void;
|
||||
}) {
|
||||
if (!snapshots.length) return null;
|
||||
return (
|
||||
<div className="pointer-events-auto absolute left-4 bottom-24 max-w-[140px] space-y-1">
|
||||
{snapshots.slice(0, 4).map((s, i) => (
|
||||
<button
|
||||
key={s.id}
|
||||
type="button"
|
||||
onClick={() => onSelect(s.id)}
|
||||
className={`w-full text-left text-[10px] font-mono px-2 py-1 rounded border transition-colors ${
|
||||
selected === s.id
|
||||
? "border-orbit-green/60 bg-orbit-green/10 text-orbit-green"
|
||||
: "border-space-700/50 bg-space-950/60 text-star-400 hover:border-star-400/40"
|
||||
}`}
|
||||
>
|
||||
{String(i + 1).padStart(2, "0")} · {s.orbit_name.slice(0, 12)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
96
web/src/components/hud/HUDPanel.tsx
Normal file
96
web/src/components/hud/HUDPanel.tsx
Normal file
@@ -0,0 +1,96 @@
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function HUDPanel({
|
||||
open,
|
||||
title,
|
||||
subtitle,
|
||||
onClose,
|
||||
children,
|
||||
side = "right",
|
||||
}: {
|
||||
open: boolean;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
onClose: () => void;
|
||||
children: ReactNode;
|
||||
side?: "left" | "right" | "bottom";
|
||||
}) {
|
||||
const pos =
|
||||
side === "left"
|
||||
? "left-0 top-12 bottom-20 w-[min(100%,380px)] border-r"
|
||||
: side === "bottom"
|
||||
? "inset-x-0 bottom-20 top-auto max-h-[55dvh] border-t"
|
||||
: "right-0 top-12 bottom-20 w-[min(100%,400px)] border-l";
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<>
|
||||
<motion.button
|
||||
type="button"
|
||||
aria-label="Dismiss overlay"
|
||||
className="fixed inset-0 z-40 bg-space-950/50 backdrop-blur-[2px]"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={onClose}
|
||||
/>
|
||||
<motion.aside
|
||||
className={`fixed z-50 ${pos} border-wormhole-violet/20 bg-space-900/92 backdrop-blur-xl overflow-y-auto scrollbar-none`}
|
||||
initial={{ opacity: 0, x: side === "right" ? 40 : side === "left" ? -40 : 0, y: side === "bottom" ? 40 : 0 }}
|
||||
animate={{ opacity: 1, x: 0, y: 0 }}
|
||||
exit={{ opacity: 0, x: side === "right" ? 20 : 0, y: side === "bottom" ? 20 : 0 }}
|
||||
transition={{ type: "spring", damping: 26, stiffness: 280 }}
|
||||
>
|
||||
<header className="sticky top-0 bg-space-900/95 border-b border-space-700/60 px-4 py-3 flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<p className="text-[10px] font-mono text-wormhole-violet tracking-widest uppercase">
|
||||
Console
|
||||
</p>
|
||||
<h2 className="text-lg font-semibold text-star-100">{title}</h2>
|
||||
{subtitle && <p className="text-xs text-star-400 mt-0.5">{subtitle}</p>}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="font-mono text-xs text-star-400 border border-space-700 rounded px-2 py-1 hover:text-star-200"
|
||||
>
|
||||
ESC
|
||||
</button>
|
||||
</header>
|
||||
<div className="p-4 pb-8">{children}</div>
|
||||
</motion.aside>
|
||||
</>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
|
||||
export function SceneAction({
|
||||
label,
|
||||
onClick,
|
||||
disabled,
|
||||
variant = "primary",
|
||||
}: {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
disabled?: boolean;
|
||||
variant?: "primary" | "ghost";
|
||||
}) {
|
||||
return (
|
||||
<motion.button
|
||||
type="button"
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className={`pointer-events-auto font-mono text-xs tracking-wide px-5 py-2.5 rounded border ${
|
||||
variant === "primary"
|
||||
? "border-orbit-green/50 text-orbit-green bg-orbit-green/10 hover:bg-orbit-green/20"
|
||||
: "border-star-400/30 text-star-300 bg-space-950/60"
|
||||
} disabled:opacity-40`}
|
||||
whileTap={{ scale: 0.97 }}
|
||||
>
|
||||
{label}
|
||||
</motion.button>
|
||||
);
|
||||
}
|
||||
60
web/src/components/hud/HUDRail.tsx
Normal file
60
web/src/components/hud/HUDRail.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import { motion } from "motion/react";
|
||||
|
||||
export type HUDMode = "scene" | "orbits" | "wormhole" | "decay" | "reconstitute";
|
||||
|
||||
const items: { id: HUDMode; label: string; glyph: string; hint: string }[] = [
|
||||
{ id: "scene", label: "Viewport", glyph: "◎", hint: "Vault ring" },
|
||||
{ id: "orbits", label: "Orbits", glyph: "⟳", hint: "Flight paths" },
|
||||
{ id: "wormhole", label: "Wormhole", glyph: "◉", hint: "Outpost link" },
|
||||
{ id: "decay", label: "Decay", glyph: "◇", hint: "Fade policy" },
|
||||
{ id: "reconstitute", label: "Restore", glyph: "↩", hint: "Reconstitute" },
|
||||
];
|
||||
|
||||
export function HUDRail({
|
||||
active,
|
||||
onSelect,
|
||||
capturing,
|
||||
}: {
|
||||
active: HUDMode;
|
||||
onSelect: (m: HUDMode) => void;
|
||||
capturing?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<nav
|
||||
className="pointer-events-auto absolute bottom-6 left-1/2 -translate-x-1/2 z-30 flex gap-1 px-2 py-1.5 rounded-full border border-wormhole-violet/25 bg-space-950/75 backdrop-blur-xl shadow-[0_0_40px_rgba(5,6,15,0.8)]"
|
||||
aria-label="Ship systems"
|
||||
>
|
||||
{items.map((item) => {
|
||||
const on = active === item.id;
|
||||
return (
|
||||
<motion.button
|
||||
key={item.id}
|
||||
type="button"
|
||||
title={item.hint}
|
||||
onClick={() => onSelect(item.id)}
|
||||
className={`relative px-3 py-2 rounded-full text-xs font-mono transition-colors ${
|
||||
on
|
||||
? "text-wormhole-violet bg-wormhole-violet/15"
|
||||
: "text-star-400 hover:text-star-200"
|
||||
}`}
|
||||
whileTap={{ scale: 0.94 }}
|
||||
>
|
||||
<span className="sr-only">{item.label}</span>
|
||||
<span aria-hidden className="text-sm">
|
||||
{item.glyph}
|
||||
</span>
|
||||
{on && (
|
||||
<motion.span
|
||||
layoutId="hud-pip"
|
||||
className="absolute -bottom-1 left-1/2 w-1 h-1 -translate-x-1/2 rounded-full bg-orbit-green"
|
||||
/>
|
||||
)}
|
||||
{item.id === "orbits" && capturing && (
|
||||
<span className="absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orbit-amber animate-pulse" />
|
||||
)}
|
||||
</motion.button>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
36
web/src/components/scene/VaultScene.tsx
Normal file
36
web/src/components/scene/VaultScene.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { motion } from "motion/react";
|
||||
import type { Snapshot } from "../../api";
|
||||
import { VaultRing } from "../vault/VaultRing";
|
||||
import { Starfield } from "./Starfield";
|
||||
|
||||
export function VaultScene({
|
||||
snapshots,
|
||||
onSelect,
|
||||
onCapture,
|
||||
capturing,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
onSelect: (id: string) => void;
|
||||
onCapture?: () => void;
|
||||
capturing?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<div className="absolute inset-0 overflow-hidden">
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_center,rgba(30,38,71,0.45)_0%,rgba(4,5,12,0.95)_65%)]" />
|
||||
<Starfield />
|
||||
<motion.div
|
||||
className="absolute top-1/4 left-1/2 -translate-x-1/2 w-[80vmin] h-[40vmin] rounded-full bg-wormhole-violet/5 blur-3xl"
|
||||
animate={{ opacity: [0.3, 0.55, 0.3], scale: [1, 1.05, 1] }}
|
||||
transition={{ duration: 8, repeat: Infinity }}
|
||||
/>
|
||||
<div className="relative z-10 h-full w-full pb-28">
|
||||
<VaultRing
|
||||
snapshots={snapshots}
|
||||
onSelect={onSelect}
|
||||
onCapture={onCapture}
|
||||
capturing={capturing}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -109,8 +109,8 @@ export function VaultRing({
|
||||
{capturing ? "Orbit in progress…" : "Capture now"}
|
||||
</motion.button>
|
||||
)}
|
||||
<p className="mt-2 text-xs text-star-400 max-w-xs text-center">
|
||||
Tap a tile for snapshot detail. Only stardust that changed.
|
||||
<p className="mt-2 text-[10px] font-mono text-star-400/80 max-w-xs text-center uppercase tracking-wider">
|
||||
Select tile · stardust delta only
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -53,3 +53,25 @@ body,
|
||||
transform: translateY(-120px);
|
||||
}
|
||||
}
|
||||
|
||||
.vignette::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
|
||||
.scanlines::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.04;
|
||||
background: repeating-linear-gradient(
|
||||
0deg,
|
||||
transparent,
|
||||
transparent 2px,
|
||||
rgba(255, 255, 255, 0.15) 3px
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user