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:
26
web/src/hooks/useActivity.ts
Normal file
26
web/src/hooks/useActivity.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { useMemo } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { fetchCaptureJobs, fetchRecentRestoreJobs, type Orbit, type Snapshot } from "../api";
|
||||
import { activityCounts, buildActivity } from "../lib/activity";
|
||||
|
||||
/** Everything the hub reports as backups and restores, folded into one log. Polling shares keys with the Orbits console. */
|
||||
export function useActivity(snapshots?: Snapshot[], orbits?: Orbit[]) {
|
||||
const restores = useQuery({ queryKey: ["restore-jobs-recent"], queryFn: () => fetchRecentRestoreJobs(100), refetchInterval: 5_000, retry: false });
|
||||
const captures = useQuery({ queryKey: ["capture-jobs", "", ""], queryFn: () => fetchCaptureJobs("", ""), refetchInterval: 5_000, retry: 1 });
|
||||
const restoreData = restores.data;
|
||||
const captureData = captures.data;
|
||||
const entries = useMemo(() => buildActivity({
|
||||
snapshots: snapshots ?? [],
|
||||
orbits: orbits ?? [],
|
||||
captureJobs: captureData ?? [],
|
||||
restoreJobs: restoreData ?? [],
|
||||
now: Date.now(),
|
||||
}), [snapshots, orbits, captureData, restoreData]);
|
||||
return {
|
||||
entries,
|
||||
counts: activityCounts(entries),
|
||||
restoresUnavailable: restores.isError,
|
||||
capturesUnavailable: captures.isError,
|
||||
updatedAt: Math.max(restores.dataUpdatedAt, captures.dataUpdatedAt),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user