import { h, Fragment } from 'preact'; import ActivityIndicator from '../components/ActivityIndicator'; import Heading from '../components/Heading'; import Link from '../components/Link'; import { FetchStatus, useApiHost, useEvent } from '../api'; import { Table, Thead, Tbody, Tfoot, Th, Tr, Td } from '../components/Table'; export default function Event({ eventId }) { const apiHost = useApiHost(); const { data, status } = useEvent(eventId); if (status !== FetchStatus.LOADED) { return ; } const startime = new Date(data.start_time * 1000); const endtime = new Date(data.end_time * 1000); return (
{data.camera} {data.label} {startime.toLocaleString()}
Key Value
Camera {data.camera}
Timeframe {startime.toLocaleString()} – {endtime.toLocaleString()}
Score {(data.top_score * 100).toFixed(2)}%
Zones {data.zones.join(', ')}
{data.has_clip ? ( Clip ) : (

No clip available

)} {data.has_snapshot ? 'Best image' : 'Thumbnail'} {`${data.label}
); }