import { h } from 'preact'; import Link from './Link'; import Switch from './Switch'; import { useCallback, useMemo } from 'preact/hooks'; import { usePersistence } from '../context'; import AutoUpdatingCameraImage from './AutoUpdatingCameraImage'; const emptyObject = Object.freeze({}); export function DebugCamera({ camera }) { const [options, setOptions] = usePersistence(`${camera}-feed`, emptyObject); const handleSetOption = useCallback( (id, value) => { const newOptions = { ...options, [id]: value }; setOptions(newOptions); }, [options, setOptions] ); const searchParams = useMemo( () => new URLSearchParams( Object.keys(options).reduce((memo, key) => { memo.push([key, options[key] === true ? '1' : '0']); return memo; }, []) ), [options] ); const optionContent = (
Mask & Zone creator
); return (
{optionContent}
); }