use overlay state for selected timeline type

This commit is contained in:
Nicolas Mowen 2024-03-26 10:15:08 -06:00
parent 013aeaf2f6
commit 6fd6237620

View File

@ -10,6 +10,7 @@ import MotionReviewTimeline from "@/components/timeline/MotionReviewTimeline";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer"; import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { useOverlayState } from "@/hooks/use-overlay-state";
import { FrigateConfig } from "@/types/frigateConfig"; import { FrigateConfig } from "@/types/frigateConfig";
import { Preview } from "@/types/preview"; import { Preview } from "@/types/preview";
import { import {
@ -75,7 +76,10 @@ export function RecordingView({
// timeline // timeline
const [timelineType, setTimelineType] = useState<TimelineType>("timeline"); const [timelineType, setTimelineType] = useOverlayState<TimelineType>(
"timelineType",
"timeline",
);
const timeRange = useMemo(() => getChunkedTimeDay(startTime), [startTime]); const timeRange = useMemo(() => getChunkedTimeDay(startTime), [startTime]);
const [selectedRangeIdx, setSelectedRangeIdx] = useState( const [selectedRangeIdx, setSelectedRangeIdx] = useState(