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:
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user