import { h, Fragment } from 'preact'; import Box from './components/Box'; import Heading from './components/Heading'; import Link from './components/Link'; import { Table, Thead, Tbody, Tfoot, Th, Tr, Td } from './components/Table'; import { useApiHost, useEvent } from './api'; export default function Event({ eventId }) { const apiHost = useApiHost(); const { data } = useEvent(eventId); if (!data) { return (
{eventId}

loading…

); } const startime = new Date(data.start_time * 1000); const endtime = new Date(data.end_time * 1000); return (
{data.camera} {data.label} {startime.toLocaleString()} {data.has_clip ? ( Clip ) : (

No clip available

)}
{data.has_snapshot ? 'Best image' : 'Thumbnail'} {`${data.label}
Key Value
Camera {data.camera}
Timeframe {startime.toLocaleString()} – {endtime.toLocaleString()}
Score {(data.top_score * 100).toFixed(2)}%
Zones {data.zones.join(', ')}
); }