Polish Tessera web canvas: multi-tab vault UI

Vault ring scene, orbits editor, wormhole pairing, decay presets,
reconstitute grace UI, shared components, and API wiring per SPEC.
This commit is contained in:
Tessera Agent
2026-11-09 10:23:57 +00:00
parent a5ffb2c1b4
commit 1a67876f19
23 changed files with 1302 additions and 347 deletions

View File

@@ -0,0 +1,93 @@
import { useMutation } from "@tanstack/react-query";
import { motion } from "motion/react";
import { startPairing } from "../../api";
import { Button } from "../ui/Button";
import { Hint } from "../ui/EmptyState";
import { TelemetryPanel } from "../ui/Telemetry";
export function WormholeView({
pairing,
onPaired,
}: {
pairing: { code: string; expires_at: string } | null;
onPaired: (p: { code: string; expires_at: string }) => void;
}) {
const gen = useMutation({
mutationFn: startPairing,
onSuccess: onPaired,
});
const expires = pairing ? new Date(pairing.expires_at).toLocaleTimeString() : "";
return (
<div className="h-full overflow-y-auto px-4 py-4 pb-28">
<h2 className="text-2xl font-semibold text-star-100">Outposts & wormholes</h2>
<p className="text-sm text-star-300 mt-1 mb-6">
Link a remote machine once — it beams snapshots through an encrypted wormhole.
</p>
{!pairing ? (
<EmptyWormhole onGenerate={() => gen.mutate()} loading={gen.isPending} />
) : (
<motion.div
className="rounded-2xl border border-wormhole-violet/35 bg-gradient-to-b from-wormhole-violet/10 to-space-900 p-6 text-center"
initial={{ scale: 0.95, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
>
<p className="text-xs uppercase tracking-[0.2em] text-wormhole-violet mb-4">
Pairing code
</p>
<p className="text-4xl font-mono tracking-[0.35em] text-star-100">{pairing.code}</p>
<p className="text-sm text-star-400 mt-4">Burns at {expires}</p>
<Hint>
On the outpost:{" "}
<code className="font-mono text-orbit-amber">tessera-agent pair {pairing.code}</code>
</Hint>
<Button variant="ghost" className="mt-4 w-full" onClick={() => gen.mutate()}>
Generate fresh code
</Button>
<TelemetryPanel label="Pairing metadata">
{JSON.stringify(pairing, null, 2)}
</TelemetryPanel>
</motion.div>
)}
<section className="mt-8 space-y-3">
<h3 className="text-sm font-medium text-star-200">Outpost health</h3>
<div className="rounded-xl border border-space-700 bg-space-800/40 p-4 flex items-center gap-3">
<span className="w-2 h-2 rounded-full bg-star-400/50" />
<div>
<p className="text-sm text-star-300">No outposts paired yet</p>
<p className="text-xs text-star-400">Grey dot means offline or waiting.</p>
</div>
</div>
</section>
</div>
);
}
function EmptyWormhole({
onGenerate,
loading,
}: {
onGenerate: () => void;
loading: boolean;
}) {
return (
<div className="text-center py-8">
<motion.div
className="mx-auto w-24 h-24 rounded-full border border-wormhole-violet/30 flex items-center justify-center text-3xl"
animate={{ boxShadow: ["0 0 0 rgba(167,139,250,0)", "0 0 32px rgba(167,139,250,0.25)", "0 0 0 rgba(167,139,250,0)"] }}
transition={{ duration: 3, repeat: Infinity }}
>
◉
</motion.div>
<p className="mt-4 text-star-300 text-sm max-w-xs mx-auto">
Open a wormhole when you&apos;re ready to claim an outpost.
</p>
<Button variant="primary" className="mt-6 w-full max-w-xs mx-auto" disabled={loading} onClick={onGenerate}>
{loading ? "Opening…" : "Show pairing code"}
</Button>
</div>
);
}