diff --git a/docs/UI.md b/docs/UI.md index 3de20fa..fa000d9 100644 --- a/docs/UI.md +++ b/docs/UI.md @@ -9,6 +9,7 @@ The persistent viewport maps backup jobs and recovery points. The black hole rep - The first three recovery points of the selected orbit appear as moons when the map has room. Select a moon or history entry to review the snapshot and start a restore. Escape closes the console. Restore countdown and polling continue if the console closes. - Hub connectivity is separate from backup health. Capture targets the named orbit. An incoming meteor represents a confirmed new snapshot. Failures and rehearsals show text feedback. - The map shows up to 55 overview orbits and reserves one slot for inspecting an orbit beyond that limit. The register provides access to every orbit. On narrow screens the map, register, and inspector stack vertically. +- **Big Screen** expands the map and keeps summary counts, motion controls, and a floating navigation dock. The browser can show it in native fullscreen. Use **Exit big screen** or Escape to return to the workspace. ## Data and rendering diff --git a/web/src/App.tsx b/web/src/App.tsx index 620f458..18c0862 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from "react"; +import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { abortReconstitute, fetchHealth, fetchOrbits, fetchSnapshots, pollReconstitute, @@ -34,6 +34,9 @@ function priority(orbit: Orbit) { } export default function App() { + const app = useRef(null); + const workspaceScroll = useRef(undefined); + const [bigScreen, setBigScreen] = useState(false); const [mode, setMode] = useState("scene"); const [orbitId, setOrbitId] = useState(); const [snapshotId, setSnapshotId] = useState(null); @@ -44,6 +47,48 @@ export default function App() { const reducedMotion = useReducedMotion(); const qc = useQueryClient(); + useEffect(() => { + const root = app.current; + if (!root) return; + const syncFullscreen = () => setBigScreen(document.fullscreenElement === root); + root.addEventListener("fullscreenchange", syncFullscreen); + return () => root.removeEventListener("fullscreenchange", syncFullscreen); + }, []); + + useEffect(() => { + if (!bigScreen || mode !== "scene") return; + const exitOnEscape = (event: KeyboardEvent) => { + if (event.key === "Escape" && !event.defaultPrevented && !document.fullscreenElement) { + setBigScreen(false); + } + }; + window.addEventListener("keydown", exitOnEscape); + return () => window.removeEventListener("keydown", exitOnEscape); + }, [bigScreen, mode]); + + useLayoutEffect(() => { + if (bigScreen || workspaceScroll.current === undefined) return; + window.scrollTo(0, workspaceScroll.current); + workspaceScroll.current = undefined; + }, [bigScreen]); + + function toggleBigScreen() { + const root = app.current; + if (bigScreen) { + if (document.fullscreenElement === root) { + void document.exitFullscreen().catch(() => {}); + } else { + setBigScreen(false); + } + return; + } + + workspaceScroll.current = window.scrollY; + setBigScreen(true); + // The viewport layout also works when the browser declines native fullscreen. + if (document.fullscreenEnabled) void root?.requestFullscreen?.().catch(() => {}); + } + const health = useQuery({ queryKey: ["health"], queryFn: fetchHealth, refetchInterval: 15_000, retry: 1 }); const snaps = useQuery({ queryKey: ["snapshots"], queryFn: fetchSnapshots, refetchInterval: 8_000, retry: 1 }); const orbits = useQuery({ queryKey: ["orbits"], queryFn: fetchOrbits, refetchInterval: 8_000, retry: 1 }); @@ -114,7 +159,7 @@ export default function App() { } return ( -
+
ยท {selected.name}}

- +
+ + +
div { min-width: 0; } +.scene-controls { display: flex; align-items: center; gap: 6px; } .scene-toolbar button { flex: none; } .scene-mode { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 13px; } .mode-signal { flex: none; width: 6px; height: 6px; background: var(--accent); transform: rotate(45deg); border-radius: 1px; } @@ -254,6 +255,74 @@ button:disabled { cursor: default; } .dialog-heading h2 + p { margin-top: 4px; color: var(--quiet); font-size: 13px; } .dialog-content { padding: 18px 20px; } +.big-screen { + --screen-gutter: clamp(12px, 2vw, 30px); + --screen-top: max(var(--screen-gutter), env(safe-area-inset-top)); + --screen-bottom: max(var(--screen-gutter), env(safe-area-inset-bottom)); + position: fixed; + inset: 0; + overflow: hidden; + background: #0a0c10; +} + +.big-screen .vault-topbar { display: contents; } +.big-screen :is(.vault-brand, .hub-link, .vault-console, .vault-footer, .scene-footer) { display: none; } +.big-screen .vault-main { padding: 0; } +.big-screen .vault-workspace, +.big-screen .vault-scene { position: absolute; inset: 0; display: grid; } +.big-screen .vault-workspace { grid-template: 1fr / 1fr; height: auto; } +.big-screen .vault-scene { + grid-template-rows: minmax(0, 1fr); + padding-block: 78px; + border: 0; + border-radius: 0; +} +.big-screen .galaxy-frame { max-width: calc((100dvh - 156px) * 1.375); } +.big-screen .vault-scene > .scene-toolbar { + position: absolute; + inset: var(--screen-top) auto auto max(var(--screen-gutter), env(safe-area-inset-left)); + padding: 0; +} +.big-screen .scene-toolbar > div:first-child { max-width: 160px; margin-right: 8px; } +.big-screen .scene-toolbar .instrument-label { display: none; } +.big-screen .scene-mode { margin-top: 0; } +.big-screen .vault-overview { + position: absolute; + z-index: 2; + inset: var(--screen-top) max(var(--screen-gutter), env(safe-area-inset-right)) auto auto; + margin: 0; +} +.big-screen .vault-overview > div:first-child { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; +} +.big-screen :is(.vault-nav, .vault-telemetry) { + border: 1px solid #3a3d44; + background: #111418d9; + backdrop-filter: blur(14px); +} +.big-screen .vault-telemetry { border-radius: 8px; padding-block: 8px; } +.big-screen .vault-nav { + position: absolute; + z-index: 2; + bottom: var(--screen-bottom); + left: 50%; + transform: translateX(-50%); + gap: 3px; + max-width: calc(100% - 2 * var(--screen-gutter)); + margin: 0; + padding: 4px; + border-radius: 999px; + box-shadow: 0 8px 30px #0006; +} +.big-screen .vault-nav button { border-radius: 999px; padding-inline: clamp(8px, 1.65vw, 23px); } +.big-screen .vault-nav button[aria-current] { background: #30251f; color: #ffd0a9; } +.big-screen .vault-nav button[aria-current]::after { display: none; } + @media (max-width: 1060px) { .vault-workspace { grid-template-areas: "map map" "register inspector"; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; } .vault-console { min-height: 240px; max-height: 420px; } @@ -279,6 +348,32 @@ button:disabled { cursor: default; } .vault-footer > p:last-child { text-align: right; } } +@media (max-width: 740px) { + .big-screen .vault-scene { padding-block: 120px 70px; } + .big-screen .galaxy-frame { max-width: calc((100dvh - 190px) * 1.375); } + .big-screen .vault-overview { top: calc(var(--screen-top) + 54px); } + .big-screen .vault-telemetry { grid-template-columns: repeat(4, auto); } + .big-screen .vault-telemetry dd { font-size: 14px; } + .big-screen .scene-toolbar > div:first-child { display: none; } +} + +@media (max-height: 480px) and (orientation: landscape) and (min-width: 560px) { + .big-screen .vault-scene { padding-block: 56px; } + .big-screen .galaxy-frame { max-width: calc((100dvh - 112px) * 1.375); } + .big-screen .vault-overview { top: var(--screen-top); } +} + +@media (max-width: 520px) { + .vault-app:not(.big-screen) .scene-screen-control { min-width: 44px; justify-content: center; } + .vault-app:not(.big-screen) .scene-screen-control span { display: none; } +} + +@media (max-width: 380px) { + .big-screen .vault-nav { gap: 2px; } + .big-screen .vault-nav button { padding-inline: 6px; } + .big-screen .vault-telemetry > div { padding-inline: 7px; } +} + @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important;