import { h, Fragment } from 'preact'; import JSMpegPlayer from '../components/JSMpegPlayer'; import Heading from '../components/Heading'; import { useState } from 'preact/hooks'; import useSWR from 'swr'; import { Tabs, TextTab } from '../components/Tabs'; import { LiveChip } from '../components/LiveChip'; import { DebugCamera } from '../components/DebugCamera'; import HistoryViewer from '../components/HistoryViewer/HistoryViewer.tsx'; export default function Camera({ camera }) { const { data: config } = useSWR('config'); const [playerType, setPlayerType] = useState('live'); const cameraConfig = config?.cameras[camera]; const handleTabChange = (index) => { if (index === 0) { setPlayerType('history'); } else if (index === 1) { setPlayerType('live'); } else if (index === 2) { setPlayerType('debug'); } }; return (