integrate debug view

This commit is contained in:
Nicolas Mowen 2025-09-29 13:20:04 -06:00
parent a39f4b8192
commit cd8adcaaf4

View File

@ -110,6 +110,7 @@ import { useIsAdmin } from "@/hooks/use-is-admin";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { useDocDomain } from "@/hooks/use-doc-domain"; import { useDocDomain } from "@/hooks/use-doc-domain";
import PtzControlPanel from "@/components/overlay/PtzControlPanel"; import PtzControlPanel from "@/components/overlay/PtzControlPanel";
import ObjectSettingsView from "../settings/ObjectSettingsView";
type LiveCameraViewProps = { type LiveCameraViewProps = {
config?: FrigateConfig; config?: FrigateConfig;
@ -271,6 +272,7 @@ export default function LiveCameraView({
); );
const [showStats, setShowStats] = useState(false); const [showStats, setShowStats] = useState(false);
const [debug, setDebug] = useState(false);
const [fullResolution, setFullResolution] = useState<VideoResolutionType>({ const [fullResolution, setFullResolution] = useState<VideoResolutionType>({
width: 0, width: 0,
@ -421,7 +423,11 @@ export default function LiveCameraView({
); );
return ( return (
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}> <TransformWrapper
minScale={1.0}
wheel={{ smoothStep: 0.005 }}
disabled={debug}
>
<Toaster position="top-center" closeButton={true} /> <Toaster position="top-center" closeButton={true} />
<div <div
ref={mainRef} ref={mainRef}
@ -593,9 +599,12 @@ export default function LiveCameraView({
supportsAudioOutput={supportsAudioOutput} supportsAudioOutput={supportsAudioOutput}
supports2WayTalk={supports2WayTalk} supports2WayTalk={supports2WayTalk}
cameraEnabled={cameraEnabled} cameraEnabled={cameraEnabled}
debug={debug}
setDebug={setDebug}
/> />
</div> </div>
</div> </div>
{!debug ? (
<div id="player-container" className="size-full" ref={containerRef}> <div id="player-container" className="size-full" ref={containerRef}>
<TransformComponent <TransformComponent
wrapperStyle={{ wrapperStyle={{
@ -649,6 +658,21 @@ export default function LiveCameraView({
</div> </div>
)} )}
</div> </div>
) : (
<TransformComponent
wrapperStyle={{
width: "100%",
height: "100%",
}}
contentStyle={{
position: "relative",
width: "100%",
height: "100%",
}}
>
<ObjectSettingsView selectedCamera={camera.name} />
</TransformComponent>
)}
</div> </div>
{camera.onvif.host != "" && ( {camera.onvif.host != "" && (
<div className="flex flex-col items-center justify-center"> <div className="flex flex-col items-center justify-center">
@ -719,6 +743,8 @@ type FrigateCameraFeaturesProps = {
supportsAudioOutput: boolean; supportsAudioOutput: boolean;
supports2WayTalk: boolean; supports2WayTalk: boolean;
cameraEnabled: boolean; cameraEnabled: boolean;
debug: boolean;
setDebug: (debug: boolean) => void;
}; };
function FrigateCameraFeatures({ function FrigateCameraFeatures({
camera, camera,
@ -739,6 +765,8 @@ function FrigateCameraFeatures({
supportsAudioOutput, supportsAudioOutput,
supports2WayTalk, supports2WayTalk,
cameraEnabled, cameraEnabled,
debug,
setDebug,
}: FrigateCameraFeaturesProps) { }: FrigateCameraFeaturesProps) {
const { t } = useTranslation(["views/live", "components/dialog"]); const { t } = useTranslation(["views/live", "components/dialog"]);
const { getLocaleDocUrl } = useDocDomain(); const { getLocaleDocUrl } = useDocDomain();
@ -1228,17 +1256,22 @@ function FrigateCameraFeatures({
})} })}
</p> </p>
</div> </div>
<div <div className="flex flex-col gap-1">
className="flex cursor-pointer flex-col gap-1" <div className="flex items-center justify-between">
onClick={() => <Label
navigate(`/settings?page=debug&camera=${camera.name}`) className="mx-0 cursor-pointer text-primary"
} htmlFor="debug"
> >
<div className="flex items-center justify-between text-sm font-medium leading-none">
{t("streaming.debugView", { {t("streaming.debugView", {
ns: "components/dialog", ns: "components/dialog",
})} })}
<LuExternalLink className="ml-2 inline-flex size-5" /> </Label>
<Switch
className="ml-1"
id="debug"
checked={debug}
onCheckedChange={(checked) => setDebug(checked)}
/>
</div> </div>
</div> </div>
</div> </div>