feat(cameras): large view opens in the tile's state (live tile → Live on the same stream, idle tile → Snapshot)
Build & push images / images (push) Successful in 3m56s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZgP5oMncSaVmKRKk1UvN4
This commit is contained in:
2026-11-17 15:57:35 +01:00
parent 4fd5bf852e
commit 52354d194a
2 changed files with 19 additions and 10 deletions
+9 -7
View File
@@ -12,10 +12,10 @@ import { createPlatformSocket } from "../lib/platform-ws.js";
// chips in the device footer; docked bottom-right, the first opened rightmost and each
// next one to its left. A tile rests on the camera's newest entry/exit snapshot and
// switches to live video while that camera is seeing a vehicle (the server's per-camera
// activity, pushed over /api/ws). Clicking the picture opens a large view that streams
// LIVE ON DEMAND (car or no car) with a Live / Snapshot switch; closing it returns the
// tile to automatic — a stream the user started stops, one the camera started carries
// on. Live frames come over their own socket as JPEG binaries; only the newest frame is
// activity, pushed over /api/ws). Clicking the picture opens a large view in the
// tile's state (live if the tile is live, else the snapshot), with a Live / Snapshot
// switch that streams LIVE ON DEMAND, car or no car; closing it returns the tile to
// automatic — a stream the user started stops, one the camera started carries on. Live frames come over their own socket as JPEG binaries; only the newest frame is
// shown, and the tile and the large view share that one socket. Advisory viewing —
// nothing here gates anything.
@@ -75,7 +75,7 @@ function CameraTile({
const { t } = useTranslation();
/** The camera is reporting a vehicle (server-side activity, 30 s after its last push). */
const active = useLiveStore((s) => s.activeCameras[deviceId] === true);
/** Large view open, and what the user picked in it (opens on "live"). */
/** Large view open, and what it shows (opens in the tile's state, then the user's pick). */
const [expanded, setExpanded] = useState(false);
const [modalMode, setModalMode] = useState<"live" | "snapshot">("live");
// Modal open → the user's choice rules; closed → automatic (live while a vehicle is in view).
@@ -120,11 +120,13 @@ function CameraTile({
✕
</button>
</div>
{/* The picture is the expand control: a click opens the large view, live. */}
{/* The picture is the expand control: the large view opens showing what the tile
shows. Seeded from `active`, not from "a frame has arrived", so a camera-started
stream that is still connecting is not torn down by the click. */}
<button
type="button"
onClick={() => {
setModalMode("live");
setModalMode(active ? "live" : "snapshot");
setExpanded(true);
}}
className="block w-full cursor-zoom-in"