From c92c5149979c213372b67cf165f6c076090e17bf Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 22 May 2026 14:31:49 -0500 Subject: [PATCH] extract replay config sheet to new component --- .../overlay/DebugReplayConfigSheet.tsx | 120 ++++++++++++++++++ web/src/pages/Replay.tsx | 107 +--------------- 2 files changed, 124 insertions(+), 103 deletions(-) create mode 100644 web/src/components/overlay/DebugReplayConfigSheet.tsx diff --git a/web/src/components/overlay/DebugReplayConfigSheet.tsx b/web/src/components/overlay/DebugReplayConfigSheet.tsx new file mode 100644 index 0000000000..ca558e43dd --- /dev/null +++ b/web/src/components/overlay/DebugReplayConfigSheet.tsx @@ -0,0 +1,120 @@ +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { LuSettings } from "react-icons/lu"; +import useSWR from "swr"; +import ActivityIndicator from "@/components/indicators/activity-indicator"; +import { ConfigSectionTemplate } from "@/components/config-form/sections/ConfigSectionTemplate"; +import { Button } from "@/components/ui/button"; +import { PlatformAwareSheet } from "@/components/overlay/dialog/PlatformAwareDialog"; +import { useConfigSchema } from "@/hooks/use-config-schema"; +import type { FrigateConfig } from "@/types/frigateConfig"; + +type DebugReplayConfigSheetProps = { + replayCamera: string | undefined; +}; + +export function DebugReplayConfigSheet({ + replayCamera, +}: DebugReplayConfigSheetProps) { + const { t } = useTranslation(["views/replay"]); + const configSchema = useConfigSchema(); + const { data: config } = useSWR("config", { + revalidateOnFocus: false, + }); + const [open, setOpen] = useState(false); + + return ( + + + {t("page.configuration")} + + } + title={t("page.configuration")} + titleClassName="text-lg font-semibold" + contentClassName="scrollbar-container flex flex-col gap-0 overflow-y-auto px-6 pb-6 sm:max-w-xl md:max-w-2xl xl:max-w-3xl" + content={ + <> +

+ {t("page.configurationDesc")} +

+ {configSchema == null ? ( +
+ +
+ ) : ( +
+ + + + {config?.face_recognition?.enabled && ( + + )} + {config?.lpr?.enabled && ( + + )} +
+ )} + + } + open={open} + onOpenChange={setOpen} + /> + ); +} diff --git a/web/src/pages/Replay.tsx b/web/src/pages/Replay.tsx index a775ee4312..f43e52ee22 100644 --- a/web/src/pages/Replay.tsx +++ b/web/src/pages/Replay.tsx @@ -27,7 +27,7 @@ import { PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; -import { PlatformAwareSheet } from "@/components/overlay/dialog/PlatformAwareDialog"; +import { DebugReplayConfigSheet } from "@/components/overlay/DebugReplayConfigSheet"; import { useCameraActivity } from "@/hooks/use-camera-activity"; import { cn } from "@/lib/utils"; import Heading from "@/components/ui/heading"; @@ -40,16 +40,14 @@ import { Progress } from "@/components/ui/progress"; import { ObjectType } from "@/types/ws"; import { useJobStatus } from "@/api/ws"; import WsMessageFeed from "@/components/ws/WsMessageFeed"; -import { ConfigSectionTemplate } from "@/components/config-form/sections/ConfigSectionTemplate"; -import { LuExternalLink, LuInfo, LuSettings } from "react-icons/lu"; +import { LuExternalLink, LuInfo } from "react-icons/lu"; import { LuSquare } from "react-icons/lu"; import { MdReplay } from "react-icons/md"; import { isDesktop, isMobile } from "react-device-detect"; import Logo from "@/components/Logo"; import { Separator } from "@/components/ui/separator"; import { useDocDomain } from "@/hooks/use-doc-domain"; -import { useConfigSchema } from "@/hooks/use-config-schema"; import DebugDrawingLayer from "@/components/overlay/DebugDrawingLayer"; import { IoMdArrowRoundBack } from "react-icons/io"; @@ -125,7 +123,6 @@ export default function Replay() { }); const { payload: replayJob } = useJobStatus("debug_replay"); - const configSchema = useConfigSchema(); const [isInitializing, setIsInitializing] = useState(true); // Refresh status immediately on mount to avoid showing "no session" briefly @@ -139,7 +136,6 @@ export default function Replay() { const [options, setOptions] = useState(DEFAULT_OPTIONS); const [isStopping, setIsStopping] = useState(false); - const [configDialogOpen, setConfigDialogOpen] = useState(false); const searchParams = useMemo(() => { const params = new URLSearchParams(); @@ -327,103 +323,8 @@ export default function Replay() { )}
- - - - {t("page.configuration")} - - - } - title={t("page.configuration")} - titleClassName="text-lg font-semibold" - contentClassName="scrollbar-container flex flex-col gap-0 overflow-y-auto px-6 pb-6 sm:max-w-xl md:max-w-2xl xl:max-w-3xl" - content={ - <> -

- {t("page.configurationDesc")} -

- {configSchema == null ? ( -
- -
- ) : ( -
- - - - {config?.face_recognition?.enabled && ( - - )} - {config?.lpr?.enabled && ( - - )} -
- )} - - } - open={configDialogOpen} - onOpenChange={setConfigDialogOpen} +