import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useQuery } from "@tanstack/react-query"; import { fetchSnapshots, snapshotImageUrl } from "../api.js"; // Entry/exit evidence images for a session. Lets the operator verify the car at the // booth against the ticket. Thumbnails load from /api/snapshots/:id (cookie-authed, // served with a long immutable cache); clicking one enlarges it. Read-only. export function SnapshotStrip({ identity }: { identity: string }) { const { t } = useTranslation(); const { data, isLoading } = useQuery({ queryKey: ["snapshots", identity], queryFn: () => fetchSnapshots(identity), enabled: !!identity, }); const [zoom, setZoom] = useState(null); const shots = data?.snapshots ?? []; if (isLoading) return
{t("pay.loadingSnapshots")}
; if (shots.length === 0) return
{t("pay.noSnapshots")}
; return ( <>
{shots.map((s) => ( ))}
{zoom && (
setZoom(null)} > snapshot
)} ); }