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:
@@ -1,54 +0,0 @@
|
||||
import type { Orbit } from "../api";
|
||||
|
||||
export function OrbitsPanel({
|
||||
orbits,
|
||||
onRun,
|
||||
}: {
|
||||
orbits: Orbit[];
|
||||
onRun: (id: string) => void;
|
||||
}) {
|
||||
if (!orbits.length) return null;
|
||||
return (
|
||||
<section className="shrink-0 border-t border-space-800 px-4 py-2 overflow-x-auto flex gap-2 scrollbar-none">
|
||||
{orbits.map((o) => (
|
||||
<article
|
||||
key={o.id}
|
||||
className="min-w-[160px] rounded-xl bg-space-900 border border-space-800 p-3 text-sm"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<StatusDot status={o.last_status} />
|
||||
<span className="font-medium truncate">{o.name}</span>
|
||||
</div>
|
||||
<p className="text-xs text-star-300 mt-1">
|
||||
{o.dry_run ? "Rehearse orbit" : scheduleLabel(o.schedule)}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="mt-2 text-xs text-orbit-green"
|
||||
onClick={() => onRun(o.id)}
|
||||
>
|
||||
Capture now
|
||||
</button>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function StatusDot({ status }: { status: string }) {
|
||||
const color =
|
||||
status === "failed"
|
||||
? "bg-orbit-red"
|
||||
: status === "running" || status === "rehearsed"
|
||||
? "bg-orbit-amber"
|
||||
: status === "completed"
|
||||
? "bg-orbit-green"
|
||||
: "bg-star-300/40";
|
||||
return <span className={`w-2 h-2 rounded-full ${color}`} />;
|
||||
}
|
||||
|
||||
function scheduleLabel(schedule?: string | null) {
|
||||
if (!schedule) return "On demand";
|
||||
if (schedule.includes("0 2")) return "Every night at 2am";
|
||||
return schedule;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import type { Snapshot } from "../api";
|
||||
|
||||
export function ReconstituteWizard({
|
||||
snapshots,
|
||||
selected,
|
||||
onStart,
|
||||
onPoll,
|
||||
onAbort,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
selected: string | null;
|
||||
onStart: (snapId: string, target: string) => Promise<{ session_id: string; session: { seconds_remaining: number; state: string } }>;
|
||||
onPoll: (id: string) => Promise<{ state: string; seconds_remaining: number }>;
|
||||
onAbort: (id: string) => Promise<void>;
|
||||
}) {
|
||||
const [snapId, setSnapId] = useState(selected ?? snapshots[0]?.id ?? "");
|
||||
const [target, setTarget] = useState("./restore/out");
|
||||
const [sessionId, setSessionId] = useState<string | null>(null);
|
||||
const [remaining, setRemaining] = useState(12);
|
||||
const [state, setState] = useState<string>("idle");
|
||||
|
||||
useEffect(() => {
|
||||
if (!sessionId) return;
|
||||
const t = setInterval(async () => {
|
||||
const s = await onPoll(sessionId);
|
||||
setState(s.state);
|
||||
setRemaining(s.seconds_remaining ?? 0);
|
||||
}, 500);
|
||||
return () => clearInterval(t);
|
||||
}, [sessionId, onPoll]);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-xl font-medium">Reconstitute</h2>
|
||||
<p className="text-sm text-star-300">Pick a snapshot and where it should land.</p>
|
||||
<label className="block text-sm">
|
||||
Snapshot
|
||||
<select
|
||||
className="mt-1 w-full bg-space-800 rounded px-2 py-2"
|
||||
value={snapId}
|
||||
onChange={(e) => setSnapId(e.target.value)}
|
||||
>
|
||||
{snapshots.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.orbit_name} — {new Date(s.taken_at).toLocaleDateString()}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block text-sm">
|
||||
Target path
|
||||
<input
|
||||
className="mt-1 w-full bg-space-800 rounded px-2 py-2"
|
||||
value={target}
|
||||
onChange={(e) => setTarget(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
{state === "countdown" && (
|
||||
<p className="text-orbit-amber text-center py-2">
|
||||
Reconstituting in {remaining}s — abort restores nothing.
|
||||
</p>
|
||||
)}
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
className="flex-1 py-2 rounded-lg bg-orbit-red/20 text-orbit-red border border-orbit-red/30"
|
||||
disabled={!sessionId}
|
||||
onClick={() => sessionId && onAbort(sessionId)}
|
||||
>
|
||||
Abort
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="flex-1 py-2 rounded-lg bg-orbit-green/20 text-orbit-green border border-orbit-green/40"
|
||||
onClick={async () => {
|
||||
const res = await onStart(snapId, target);
|
||||
setSessionId(res.session_id);
|
||||
setState(res.session.state);
|
||||
setRemaining(res.session.seconds_remaining);
|
||||
}}
|
||||
>
|
||||
Begin
|
||||
</button>
|
||||
</div>
|
||||
{state === "completed" && <p className="text-orbit-green text-sm">Reconstitute complete.</p>}
|
||||
{state === "aborted" && <p className="text-star-300 text-sm">Reconstitute cancelled. Nothing was changed.</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { motion } from "motion/react";
|
||||
import type { Snapshot } from "../api";
|
||||
|
||||
export function VaultRing({
|
||||
snapshots,
|
||||
onSelect,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
onSelect: (id: string) => void;
|
||||
}) {
|
||||
const count = Math.max(snapshots.length, 6);
|
||||
const radius = Math.min(140, typeof window !== "undefined" ? window.innerWidth * 0.35 : 140);
|
||||
|
||||
return (
|
||||
<div className="h-full flex items-center justify-center overflow-hidden touch-none">
|
||||
<svg
|
||||
viewBox="-200 -200 400 400"
|
||||
className="w-full h-full max-w-[min(100vw,480px)] max-h-[min(70dvh,480px)]"
|
||||
role="img"
|
||||
aria-label="Vault snapshot ring"
|
||||
>
|
||||
<circle cx="0" cy="0" r={radius + 20} fill="none" stroke="#252d55" strokeWidth="2" strokeDasharray="4 8" />
|
||||
<text x="0" y="-8" textAnchor="middle" fill="#a8b4e8" fontSize="14">
|
||||
Vault
|
||||
</text>
|
||||
{snapshots.slice(0, 12).map((snap, i) => {
|
||||
const angle = (i / count) * Math.PI * 2 - Math.PI / 2;
|
||||
const x = Math.cos(angle) * radius;
|
||||
const y = Math.sin(angle) * radius;
|
||||
return (
|
||||
<motion.g
|
||||
key={snap.id}
|
||||
initial={{ scale: 0 }}
|
||||
animate={{ scale: 1 }}
|
||||
whileTap={{ scale: 0.92 }}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => onSelect(snap.id)}
|
||||
>
|
||||
<circle cx={x} cy={y} r="18" fill="#151b3a" stroke="#5ee6a8" strokeWidth="2" />
|
||||
<title>{snap.orbit_name}</title>
|
||||
</motion.g>
|
||||
);
|
||||
})}
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
51
web/src/components/decay/DecayView.tsx
Normal file
51
web/src/components/decay/DecayView.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import { DECAY_PRESETS } from "../../lib/format";
|
||||
import { Hint } from "../ui/EmptyState";
|
||||
import { TelemetryPanel } from "../ui/Telemetry";
|
||||
|
||||
export function DecayView({ appliedPresets }: { appliedPresets: string[] }) {
|
||||
const unique = [...new Set(appliedPresets)];
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-y-auto px-4 py-4 pb-28">
|
||||
<h2 className="text-2xl font-semibold text-star-100">Decay</h2>
|
||||
<p className="text-sm text-star-300 mt-1 mb-6">
|
||||
Old snapshots fade on purpose — friendly presets, not retention spreadsheets.
|
||||
</p>
|
||||
|
||||
<span className="text-xs text-star-400">Presets — pick one when you create an orbit</span>
|
||||
<ul className="space-y-3 mt-3">
|
||||
{DECAY_PRESETS.map((p) => {
|
||||
const active = unique.includes(p.id);
|
||||
return (
|
||||
<li
|
||||
key={p.id}
|
||||
className={`rounded-2xl border p-4 ${
|
||||
active
|
||||
? "border-orbit-green/35 bg-orbit-green/5"
|
||||
: "border-space-700 bg-space-800/40"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-start gap-2 flex-wrap">
|
||||
<h3 className="font-medium text-star-100">{p.title}</h3>
|
||||
{active && (
|
||||
<span className="text-[10px] text-orbit-green border border-orbit-green/30 rounded px-1.5">
|
||||
In use
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-sm text-star-400 mt-1">{p.blurb}</p>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
|
||||
<Hint>
|
||||
Decay runs after a successful capture — rehearsed orbits never prune the vault.
|
||||
</Hint>
|
||||
|
||||
<TelemetryPanel label="Decay policy IDs">
|
||||
{JSON.stringify(DECAY_PRESETS.map((p) => p.id), null, 2)}
|
||||
</TelemetryPanel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
55
web/src/components/layout/NavBar.tsx
Normal file
55
web/src/components/layout/NavBar.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export type Tab = "vault" | "orbits" | "outposts" | "decay";
|
||||
|
||||
const tabs: { id: Tab; label: string }[] = [
|
||||
{ id: "vault", label: "Vault" },
|
||||
{ id: "orbits", label: "Orbits" },
|
||||
{ id: "outposts", label: "Wormhole" },
|
||||
{ id: "decay", label: "Decay" },
|
||||
];
|
||||
|
||||
export function NavBar({
|
||||
active,
|
||||
onChange,
|
||||
}: {
|
||||
active: Tab;
|
||||
onChange: (t: Tab) => void;
|
||||
}) {
|
||||
return (
|
||||
<nav className="shrink-0 flex border-t border-space-800 bg-space-900/90 backdrop-blur-md safe-area-pb">
|
||||
{tabs.map((t) => (
|
||||
<button
|
||||
key={t.id}
|
||||
type="button"
|
||||
onClick={() => onChange(t.id)}
|
||||
className={`flex-1 py-3 text-xs font-medium transition-colors ${
|
||||
active === t.id
|
||||
? "text-wormhole-violet border-t-2 border-wormhole-violet -mt-px"
|
||||
: "text-star-400"
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export function AppHeader({
|
||||
statusDot,
|
||||
subtitle,
|
||||
}: {
|
||||
statusDot: ReactNode;
|
||||
subtitle: string;
|
||||
}) {
|
||||
return (
|
||||
<header className="shrink-0 px-4 py-3 flex items-center justify-between border-b border-space-800/80 bg-space-950/80 backdrop-blur-sm z-10">
|
||||
<div>
|
||||
<h1 className="text-lg font-semibold tracking-tight text-star-100">Tessera</h1>
|
||||
<p className="text-xs text-star-400">{subtitle}</p>
|
||||
</div>
|
||||
{statusDot}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
156
web/src/components/orbits/OrbitsView.tsx
Normal file
156
web/src/components/orbits/OrbitsView.tsx
Normal file
@@ -0,0 +1,156 @@
|
||||
import { useState } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { Orbit } from "../../api";
|
||||
import { createOrbit, runOrbit } from "../../api";
|
||||
import { DECAY_PRESETS, schedulePhrase } from "../../lib/format";
|
||||
import { Button } from "../ui/Button";
|
||||
import { OrbitStatusDot } from "../ui/StatusDot";
|
||||
import { TelemetryPanel } from "../ui/Telemetry";
|
||||
import { Hint } from "../ui/EmptyState";
|
||||
|
||||
export function OrbitsView({ orbits }: { orbits: Orbit[] }) {
|
||||
const [editing, setEditing] = useState(false);
|
||||
const qc = useQueryClient();
|
||||
const [name, setName] = useState("nightly-docs");
|
||||
const [path, setPath] = useState("./docs");
|
||||
const [preset, setPreset] = useState(DECAY_PRESETS[0].id);
|
||||
const [rehearse, setRehearse] = useState(false);
|
||||
const [schedule, setSchedule] = useState("0 2 * * *");
|
||||
|
||||
const create = useMutation({
|
||||
mutationFn: () =>
|
||||
createOrbit({
|
||||
name,
|
||||
provider: "filesystem",
|
||||
paths: [path],
|
||||
schedule: schedule || undefined,
|
||||
decay_preset: preset,
|
||||
dry_run: rehearse,
|
||||
}),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: ["orbits"] });
|
||||
setEditing(false);
|
||||
},
|
||||
});
|
||||
|
||||
const run = useMutation({
|
||||
mutationFn: (id: string) => runOrbit(id),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ["orbits", "snapshots"] }),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-y-auto px-4 py-4 pb-28 scrollbar-none">
|
||||
<header className="mb-4">
|
||||
<h2 className="text-2xl font-semibold text-star-100">Orbits</h2>
|
||||
<p className="text-sm text-star-300 mt-1">
|
||||
Scheduled circles around your vault — not cron jargon in the headline.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div className="space-y-3 mb-6">
|
||||
{orbits.map((o) => (
|
||||
<article
|
||||
key={o.id}
|
||||
className="rounded-2xl border border-space-700 bg-space-800/50 p-4 backdrop-blur-sm"
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<OrbitStatusDot status={o.last_status} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-star-100 truncate">{o.name}</h3>
|
||||
<p className="text-xs text-star-400 mt-0.5">{schedulePhrase(o.schedule, o.dry_run)}</p>
|
||||
{o.dry_run && (
|
||||
<span className="inline-block mt-2 text-[10px] uppercase tracking-wider text-orbit-amber border border-orbit-amber/30 rounded px-2 py-0.5">
|
||||
Rehearse mode
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-2 mt-4">
|
||||
<Button
|
||||
variant="success"
|
||||
className="flex-1 text-xs py-2"
|
||||
disabled={run.isPending || o.last_status === "running"}
|
||||
onClick={() => run.mutate(o.id)}
|
||||
>
|
||||
Capture now
|
||||
</Button>
|
||||
</div>
|
||||
<TelemetryPanel>
|
||||
{JSON.stringify(o, null, 2)}
|
||||
</TelemetryPanel>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{editing ? (
|
||||
<div className="rounded-2xl border border-wormhole-violet/30 bg-space-900 p-4 space-y-3">
|
||||
<h3 className="font-medium text-star-100">New orbit</h3>
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Name</span>
|
||||
<input
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Folder path</span>
|
||||
<input
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
|
||||
value={path}
|
||||
onChange={(e) => setPath(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Schedule (cron)</span>
|
||||
<input
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
|
||||
value={schedule}
|
||||
onChange={(e) => setSchedule(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Decay</span>
|
||||
<select
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
|
||||
value={preset}
|
||||
onChange={(e) => setPreset(e.target.value)}
|
||||
>
|
||||
{DECAY_PRESETS.map((p) => (
|
||||
<option key={p.id} value={p.id}>
|
||||
{p.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm text-star-300">
|
||||
<input type="checkbox" checked={rehearse} onChange={(e) => setRehearse(e.target.checked)} />
|
||||
Rehearse only (dry run)
|
||||
</label>
|
||||
<Hint>
|
||||
Rehearse orbits prove the path without writing to the vault — status shows amber “rehearsed”.
|
||||
</Hint>
|
||||
<div className="flex gap-2">
|
||||
<Button className="flex-1" onClick={() => setEditing(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
className="flex-1"
|
||||
disabled={create.isPending}
|
||||
onClick={() => create.mutate()}
|
||||
>
|
||||
Save orbit
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Button variant="primary" className="w-full" onClick={() => setEditing(true)}>
|
||||
Add an orbit
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// fix motion.collapse - use div
|
||||
93
web/src/components/outposts/WormholeView.tsx
Normal file
93
web/src/components/outposts/WormholeView.tsx
Normal 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'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>
|
||||
);
|
||||
}
|
||||
163
web/src/components/reconstitute/ReconstituteWizard.tsx
Normal file
163
web/src/components/reconstitute/ReconstituteWizard.tsx
Normal file
@@ -0,0 +1,163 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { motion } from "motion/react";
|
||||
import type { Snapshot } from "../../api";
|
||||
import { formatBytes, formatWhen } from "../../lib/format";
|
||||
import { Button } from "../ui/Button";
|
||||
import { Hint } from "../ui/EmptyState";
|
||||
import { TelemetryPanel } from "../ui/Telemetry";
|
||||
|
||||
const GRACE = 12;
|
||||
|
||||
export function ReconstituteWizard({
|
||||
snapshots,
|
||||
selected,
|
||||
onStart,
|
||||
onPoll,
|
||||
onAbort,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
selected: string | null;
|
||||
onStart: (snapId: string, target: string) => Promise<{
|
||||
session_id: string;
|
||||
session: { seconds_remaining: number; state: string };
|
||||
}>;
|
||||
onPoll: (id: string) => Promise<{ state: string; seconds_remaining: number }>;
|
||||
onAbort: (id: string) => Promise<void>;
|
||||
}) {
|
||||
const [snapId, setSnapId] = useState(selected ?? snapshots[0]?.id ?? "");
|
||||
const [target, setTarget] = useState("./restore/out");
|
||||
const [sessionId, setSessionId] = useState<string | null>(null);
|
||||
const [remaining, setRemaining] = useState(GRACE);
|
||||
const [state, setState] = useState("idle");
|
||||
|
||||
const snap = snapshots.find((s) => s.id === snapId);
|
||||
|
||||
useEffect(() => {
|
||||
if (!sessionId) return;
|
||||
const t = setInterval(async () => {
|
||||
try {
|
||||
const s = await onPoll(sessionId);
|
||||
setState(s.state);
|
||||
setRemaining(s.seconds_remaining ?? 0);
|
||||
} catch {
|
||||
/* hub may clear session */
|
||||
}
|
||||
}, 400);
|
||||
return () => clearInterval(t);
|
||||
}, [sessionId, onPoll]);
|
||||
|
||||
const inCountdown = state === "countdown";
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-star-300">
|
||||
Pick a snapshot, choose where it lands, then wait through the grace window.
|
||||
</p>
|
||||
|
||||
{snap && (
|
||||
<div className="rounded-xl border border-space-700 bg-space-800/50 p-3 text-sm">
|
||||
<p className="text-star-100 font-medium">{snap.orbit_name}</p>
|
||||
<p className="text-star-400 text-xs mt-1">{formatWhen(snap.taken_at)} · {formatBytes(snap.size_bytes)}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Snapshot</span>
|
||||
<select
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2.5"
|
||||
value={snapId}
|
||||
onChange={(e) => setSnapId(e.target.value)}
|
||||
disabled={inCountdown || state === "restoring"}
|
||||
>
|
||||
{snapshots.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.orbit_name} — {new Date(s.taken_at).toLocaleDateString()}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="block text-sm">
|
||||
<span className="text-star-400">Target path</span>
|
||||
<input
|
||||
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2.5 font-mono text-xs"
|
||||
value={target}
|
||||
onChange={(e) => setTarget(e.target.value)}
|
||||
disabled={inCountdown || state === "restoring"}
|
||||
/>
|
||||
</label>
|
||||
|
||||
{inCountdown && (
|
||||
<motion.div
|
||||
className="relative rounded-2xl border border-orbit-amber/40 bg-orbit-amber/10 p-6 text-center"
|
||||
animate={{ opacity: [1, 0.85, 1] }}
|
||||
transition={{ duration: 1.2, repeat: Infinity }}
|
||||
>
|
||||
<div className="relative mx-auto w-20 h-20">
|
||||
<svg viewBox="0 0 36 36" className="w-full h-full -rotate-90">
|
||||
<circle cx="18" cy="18" r="16" fill="none" stroke="#1e2647" strokeWidth="3" />
|
||||
<circle
|
||||
cx="18"
|
||||
cy="18"
|
||||
r="16"
|
||||
fill="none"
|
||||
stroke="#f0c468"
|
||||
strokeWidth="3"
|
||||
strokeDasharray={`${(remaining / GRACE) * 100} 100`}
|
||||
pathLength={100}
|
||||
/>
|
||||
</svg>
|
||||
<span className="absolute inset-0 flex items-center justify-center text-2xl font-semibold text-orbit-amber">
|
||||
{remaining}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-3 text-orbit-amber text-sm font-medium">
|
||||
Reconstituting in {remaining}s — abort restores nothing.
|
||||
</p>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="danger"
|
||||
className="flex-1"
|
||||
disabled={!sessionId || state === "completed"}
|
||||
onClick={() => sessionId && onAbort(sessionId)}
|
||||
>
|
||||
Abort
|
||||
</Button>
|
||||
<Button
|
||||
variant="warn"
|
||||
className="flex-1"
|
||||
disabled={!snapId || inCountdown || state === "restoring"}
|
||||
onClick={async () => {
|
||||
const res = await onStart(snapId, target);
|
||||
setSessionId(res.session_id);
|
||||
setState(res.session.state);
|
||||
setRemaining(res.session.seconds_remaining);
|
||||
}}
|
||||
>
|
||||
Begin reconstitute
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{state === "completed" && (
|
||||
<p className="text-orbit-green text-sm text-center">Reconstitute complete.</p>
|
||||
)}
|
||||
{state === "aborted" && (
|
||||
<p className="text-star-300 text-sm text-center">Reconstitute cancelled. Nothing was changed.</p>
|
||||
)}
|
||||
{state === "failed" && (
|
||||
<p className="text-orbit-red text-sm text-center">Reconstitute failed — check telemetry.</p>
|
||||
)}
|
||||
|
||||
<Hint>Destructive-capable. Evidence above is what we'll write to disk after the timer.</Hint>
|
||||
|
||||
{sessionId && (
|
||||
<TelemetryPanel label="Session">
|
||||
{JSON.stringify({ sessionId, state, remaining }, null, 2)}
|
||||
</TelemetryPanel>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
46
web/src/components/scene/Starfield.tsx
Normal file
46
web/src/components/scene/Starfield.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function Starfield() {
|
||||
const stars = useMemo(
|
||||
() =>
|
||||
Array.from({ length: 48 }, (_, i) => ({
|
||||
id: i,
|
||||
left: `${(i * 17 + 7) % 100}%`,
|
||||
top: `${(i * 23 + 11) % 100}%`,
|
||||
size: i % 3 === 0 ? 2 : 1,
|
||||
opacity: 0.2 + (i % 5) * 0.12,
|
||||
delay: `${(i % 8) * 0.4}s`,
|
||||
})),
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0 overflow-hidden opacity-60"
|
||||
aria-hidden
|
||||
>
|
||||
<div className="stars-drift absolute inset-0 -top-[120px] h-[calc(100%+240px)]">
|
||||
{stars.map((s) => (
|
||||
<span
|
||||
key={s.id}
|
||||
className="absolute rounded-full bg-star-200"
|
||||
style={{
|
||||
left: s.left,
|
||||
top: s.top,
|
||||
width: s.size,
|
||||
height: s.size,
|
||||
opacity: s.opacity,
|
||||
animation: `twinkle 4s ease-in-out ${s.delay} infinite alternate`,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<style>{`
|
||||
@keyframes twinkle {
|
||||
from { opacity: 0.2; }
|
||||
to { opacity: 0.9; }
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
26
web/src/components/ui/Button.tsx
Normal file
26
web/src/components/ui/Button.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
const variants = {
|
||||
primary:
|
||||
"bg-wormhole-violet/25 text-star-100 border-wormhole-violet/40 hover:bg-wormhole-violet/35",
|
||||
ghost: "bg-space-800/60 text-star-200 border-space-700 hover:bg-space-800",
|
||||
danger: "bg-orbit-red/15 text-orbit-red border-orbit-red/35 hover:bg-orbit-red/25",
|
||||
success: "bg-orbit-green/15 text-orbit-green border-orbit-green/35 hover:bg-orbit-green/25",
|
||||
warn: "bg-orbit-amber/15 text-orbit-amber border-orbit-amber/40 hover:bg-orbit-amber/25",
|
||||
};
|
||||
|
||||
export function Button({
|
||||
variant = "ghost",
|
||||
className = "",
|
||||
...props
|
||||
}: ButtonHTMLAttributes<HTMLButtonElement> & {
|
||||
variant?: keyof typeof variants;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`px-4 py-2.5 rounded-xl text-sm font-medium border transition-colors disabled:opacity-40 ${variants[variant]} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
35
web/src/components/ui/EmptyState.tsx
Normal file
35
web/src/components/ui/EmptyState.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { Button } from "./Button";
|
||||
|
||||
export function EmptyState({
|
||||
title,
|
||||
body,
|
||||
action,
|
||||
}: {
|
||||
title: string;
|
||||
body: string;
|
||||
action?: { label: string; onClick: () => void };
|
||||
}) {
|
||||
return (
|
||||
<div className="text-center py-12 px-4 max-w-sm mx-auto">
|
||||
<p className="text-4xl mb-3 opacity-80" aria-hidden>
|
||||
✦
|
||||
</p>
|
||||
<h3 className="text-lg font-semibold text-star-100">{title}</h3>
|
||||
<p className="mt-2 text-sm text-star-300 leading-relaxed">{body}</p>
|
||||
{action && (
|
||||
<Button variant="primary" className="mt-5 w-full" onClick={action.onClick}>
|
||||
{action.label}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Hint({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<p className="text-xs text-star-400 leading-relaxed border border-space-700 rounded-xl px-3 py-2 bg-space-800/40">
|
||||
{children}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
36
web/src/components/ui/QueryGate.tsx
Normal file
36
web/src/components/ui/QueryGate.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { UseQueryResult } from "@tanstack/react-query";
|
||||
import type { ReactNode } from "react";
|
||||
import { Button } from "./Button";
|
||||
|
||||
export function QueryGate<T>({
|
||||
query,
|
||||
empty,
|
||||
children,
|
||||
}: {
|
||||
query: UseQueryResult<T, Error>;
|
||||
empty?: ReactNode;
|
||||
children: (data: T) => ReactNode;
|
||||
}) {
|
||||
if (query.isLoading) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center py-16 text-star-400">
|
||||
<div className="w-10 h-10 rounded-full border-2 border-wormhole-violet/40 border-t-wormhole-violet animate-spin" />
|
||||
<p className="mt-3 text-sm">Pulling telemetry from the vault…</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (query.isError) {
|
||||
return (
|
||||
<div className="rounded-2xl border border-orbit-red/30 bg-orbit-red/10 p-4 text-center space-y-3">
|
||||
<p className="text-orbit-red text-sm">We couldn’t reach the hub right now.</p>
|
||||
<Button variant="ghost" onClick={() => query.refetch()}>
|
||||
Try again
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const data = query.data;
|
||||
const isEmpty = Array.isArray(data) && data.length === 0;
|
||||
if (isEmpty && empty) return <>{empty}</>;
|
||||
return <>{children(data as T)}</>;
|
||||
}
|
||||
51
web/src/components/ui/Sheet.tsx
Normal file
51
web/src/components/ui/Sheet.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import { motion } from "motion/react";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function Sheet({
|
||||
open,
|
||||
onClose,
|
||||
title,
|
||||
children,
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
if (!open) return null;
|
||||
return (
|
||||
<motion.div
|
||||
className="fixed inset-0 z-40 flex flex-col justify-end"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="absolute inset-0 bg-space-950/70 backdrop-blur-sm"
|
||||
aria-label="Close"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<motion.aside
|
||||
className="relative z-10 max-h-[78dvh] overflow-y-auto rounded-t-3xl border-t border-space-700 bg-space-900/98 px-5 pt-4 pb-8 shadow-2xl"
|
||||
initial={{ y: "100%" }}
|
||||
animate={{ y: 0 }}
|
||||
exit={{ y: "100%" }}
|
||||
transition={{ type: "spring", damping: 28, stiffness: 320 }}
|
||||
>
|
||||
<div className="mx-auto mb-3 h-1 w-10 rounded-full bg-space-700" />
|
||||
<div className="flex items-center justify-between gap-3 mb-4">
|
||||
<h2 className="text-xl font-semibold text-star-100">{title}</h2>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="text-star-400 text-sm hover:text-star-200"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
{children}
|
||||
</motion.aside>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
41
web/src/components/ui/StatusDot.tsx
Normal file
41
web/src/components/ui/StatusDot.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { VaultStatus } from "../../lib/format";
|
||||
|
||||
const colors: Record<VaultStatus, string> = {
|
||||
green: "bg-orbit-green shadow-[0_0_12px_rgba(74,222,154,0.6)]",
|
||||
amber: "bg-orbit-amber shadow-[0_0_12px_rgba(240,196,104,0.5)]",
|
||||
grey: "bg-star-400/50",
|
||||
red: "bg-orbit-red shadow-[0_0_12px_rgba(248,113,113,0.5)]",
|
||||
};
|
||||
|
||||
const labels: Record<VaultStatus, string> = {
|
||||
green: "All orbits current",
|
||||
amber: "Something needs you",
|
||||
grey: "Quiet vault — no orbits yet",
|
||||
red: "Last capture failed",
|
||||
};
|
||||
|
||||
export function StatusDot({
|
||||
status,
|
||||
size = "md",
|
||||
}: {
|
||||
status: VaultStatus;
|
||||
size?: "sm" | "md" | "lg";
|
||||
}) {
|
||||
const sizeClass =
|
||||
size === "sm" ? "w-2 h-2" : size === "lg" ? "w-4 h-4" : "w-3 h-3";
|
||||
return (
|
||||
<span
|
||||
className={`inline-block rounded-full ${sizeClass} ${colors[status]}`}
|
||||
title={labels[status]}
|
||||
aria-label={labels[status]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function OrbitStatusDot({ status }: { status: string }) {
|
||||
let vault: VaultStatus = "grey";
|
||||
if (status === "failed") vault = "red";
|
||||
else if (status === "running" || status === "rehearsed") vault = "amber";
|
||||
else if (status === "completed") vault = "green";
|
||||
return <StatusDot status={vault} size="sm" />;
|
||||
}
|
||||
29
web/src/components/ui/Telemetry.tsx
Normal file
29
web/src/components/ui/Telemetry.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
|
||||
export function TelemetryPanel({
|
||||
label,
|
||||
children,
|
||||
}: {
|
||||
label?: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<div className="mt-4 border-t border-space-700 pt-3">
|
||||
<button
|
||||
type="button"
|
||||
className="text-xs text-star-400 flex items-center gap-2 w-full"
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className="text-wormhole-violet">◈</span>
|
||||
{label ?? "Admin telemetry"}
|
||||
<span className="ml-auto opacity-60">{open ? "▾" : "▸"}</span>
|
||||
</button>
|
||||
{open && (
|
||||
<pre className="mt-2 text-[11px] font-mono text-star-400 bg-space-950/80 rounded-lg p-3 overflow-x-auto whitespace-pre-wrap">
|
||||
{children}
|
||||
</pre>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
32
web/src/components/vault/SnapshotSheet.tsx
Normal file
32
web/src/components/vault/SnapshotSheet.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { Snapshot } from "../../api";
|
||||
import { formatBytes, formatWhen } from "../../lib/format";
|
||||
import { Button } from "../ui/Button";
|
||||
import { TelemetryPanel } from "../ui/Telemetry";
|
||||
|
||||
export function SnapshotSheet({
|
||||
snap,
|
||||
onReconstitute,
|
||||
}: {
|
||||
snap: Snapshot;
|
||||
onReconstitute: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-star-300">
|
||||
A point-in-time tile on the vault ring — from orbit{" "}
|
||||
<strong className="text-star-100">{snap.orbit_name}</strong>.
|
||||
</p>
|
||||
<div className="rounded-xl bg-space-800/60 p-3 border border-space-700 text-sm">
|
||||
<p className="text-star-400 text-xs">Captured</p>
|
||||
<p className="text-star-100 mt-1">{formatWhen(snap.taken_at)}</p>
|
||||
<p className="text-star-400 text-xs mt-3">Payload</p>
|
||||
<p className="text-star-100">{formatBytes(snap.size_bytes)}</p>
|
||||
<p className="text-star-400 text-xs mt-2 italic">Only stardust that changed</p>
|
||||
</div>
|
||||
<Button variant="warn" className="w-full" onClick={onReconstitute}>
|
||||
Reconstitute this snapshot…
|
||||
</Button>
|
||||
<TelemetryPanel label="Snapshot ID">{snap.id}</TelemetryPanel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
126
web/src/components/vault/VaultRing.tsx
Normal file
126
web/src/components/vault/VaultRing.tsx
Normal file
@@ -0,0 +1,126 @@
|
||||
import { motion } from "motion/react";
|
||||
import type { Snapshot } from "../../api";
|
||||
import { formatBytes, formatWhen } from "../../lib/format";
|
||||
|
||||
export function VaultRing({
|
||||
snapshots,
|
||||
onSelect,
|
||||
onCapture,
|
||||
capturing,
|
||||
}: {
|
||||
snapshots: Snapshot[];
|
||||
onSelect: (id: string) => void;
|
||||
onCapture?: () => void;
|
||||
capturing?: boolean;
|
||||
}) {
|
||||
const count = Math.max(snapshots.length, 1);
|
||||
const radius = 128;
|
||||
const tiles = snapshots.slice(0, 16);
|
||||
|
||||
return (
|
||||
<div className="relative h-full w-full flex flex-col items-center justify-center px-4">
|
||||
<div className="relative w-full max-w-[min(100vw,420px)] aspect-square flex items-center justify-center">
|
||||
<svg
|
||||
viewBox="-220 -220 440 440"
|
||||
className="w-full h-full drop-shadow-[0_0_40px_rgba(167,139,250,0.12)]"
|
||||
role="img"
|
||||
aria-label="Orbital vault ring of snapshots"
|
||||
>
|
||||
<defs>
|
||||
<radialGradient id="vaultGlow" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stopColor="#1e2647" stopOpacity="0.9" />
|
||||
<stop offset="100%" stopColor="#04050c" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<circle cx="0" cy="0" r="200" fill="url(#vaultGlow)" />
|
||||
<circle
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={radius + 28}
|
||||
fill="none"
|
||||
stroke="#2d3a6b"
|
||||
strokeWidth="1.5"
|
||||
strokeDasharray="6 10"
|
||||
opacity="0.7"
|
||||
/>
|
||||
<motion.circle
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={radius + 28}
|
||||
fill="none"
|
||||
stroke="#a78bfa"
|
||||
strokeWidth="1"
|
||||
strokeDasharray="40 200"
|
||||
strokeLinecap="round"
|
||||
opacity="0.35"
|
||||
animate={{ rotate: 360 }}
|
||||
transition={{ duration: 90, repeat: Infinity, ease: "linear" }}
|
||||
style={{ transformOrigin: "0px 0px" }}
|
||||
/>
|
||||
<text
|
||||
x="0"
|
||||
y="-6"
|
||||
textAnchor="middle"
|
||||
fill="#94a3d4"
|
||||
fontSize="13"
|
||||
fontWeight="500"
|
||||
>
|
||||
Vault
|
||||
</text>
|
||||
<text x="0" y="14" textAnchor="middle" fill="#6b7ab8" fontSize="9">
|
||||
{snapshots.length} snapshot{tiles.length === 1 ? "" : "s"}
|
||||
</text>
|
||||
{tiles.length === 0 && (
|
||||
<text x="0" y="50" textAnchor="middle" fill="#6b7ab8" fontSize="10">
|
||||
Capture your first orbit
|
||||
</text>
|
||||
)}
|
||||
{tiles.map((snap, i) => {
|
||||
const angle = (i / Math.max(count, tiles.length)) * Math.PI * 2 - Math.PI / 2;
|
||||
const x = Math.cos(angle) * radius;
|
||||
const y = Math.sin(angle) * radius;
|
||||
return (
|
||||
<motion.g
|
||||
key={snap.id}
|
||||
initial={{ scale: 0, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
transition={{ delay: i * 0.04 }}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => onSelect(snap.id)}
|
||||
>
|
||||
<circle cx={x} cy={y} r="22" fill="#141a36" stroke="#4ade9a" strokeWidth="2" />
|
||||
<circle cx={x} cy={y} r="14" fill="#1e2647" opacity="0.8" />
|
||||
<title>
|
||||
{snap.orbit_name} · {formatWhen(snap.taken_at)}
|
||||
</title>
|
||||
</motion.g>
|
||||
);
|
||||
})}
|
||||
</svg>
|
||||
</div>
|
||||
{onCapture && (
|
||||
<motion.button
|
||||
type="button"
|
||||
disabled={capturing}
|
||||
onClick={onCapture}
|
||||
className="mt-2 px-6 py-3 rounded-full bg-orbit-green/20 border border-orbit-green/45 text-orbit-green font-medium text-sm disabled:opacity-50"
|
||||
whileTap={{ scale: 0.96 }}
|
||||
>
|
||||
{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>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SnapshotSummaryRow({ snap }: { snap: Snapshot }) {
|
||||
return (
|
||||
<div className="flex justify-between text-sm py-2 border-b border-space-700/50">
|
||||
<span className="text-star-200">{snap.orbit_name}</span>
|
||||
<span className="text-star-400 text-xs">{formatBytes(snap.size_bytes)}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user