mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-13 18:47:36 +03:00
Fix context menu link to debug
This commit is contained in:
parent
f4e7549311
commit
66ad2413ba
@ -355,9 +355,7 @@ export default function LiveContextMenu({
|
|||||||
<div
|
<div
|
||||||
className="flex w-full cursor-pointer items-center justify-start gap-2"
|
className="flex w-full cursor-pointer items-center justify-start gap-2"
|
||||||
onClick={
|
onClick={
|
||||||
isEnabled
|
isEnabled ? () => navigate(`?debug=true#${camera}`) : undefined
|
||||||
? () => navigate(`/settings?page=debug&camera=${camera}`)
|
|
||||||
: undefined
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="text-primary">
|
<div className="text-primary">
|
||||||
|
|||||||
@ -112,7 +112,8 @@ export function useSearchEffect(
|
|||||||
callback: (value: string) => boolean,
|
callback: (value: string) => boolean,
|
||||||
) {
|
) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const navigate = useNavigate();
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
|
||||||
const param = useMemo(() => {
|
const param = useMemo(() => {
|
||||||
const param = searchParams.get(key);
|
const param = searchParams.get(key);
|
||||||
@ -132,7 +133,17 @@ export function useSearchEffect(
|
|||||||
const remove = callback(param[1]);
|
const remove = callback(param[1]);
|
||||||
|
|
||||||
if (remove) {
|
if (remove) {
|
||||||
setSearchParams(undefined, { state: location.state, replace: true });
|
navigate(location.pathname + location.hash, {
|
||||||
|
state: location.state,
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [param, location.state, callback, setSearchParams]);
|
}, [
|
||||||
|
param,
|
||||||
|
location.state,
|
||||||
|
location.pathname,
|
||||||
|
location.hash,
|
||||||
|
callback,
|
||||||
|
navigate,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,6 +111,7 @@ 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";
|
import ObjectSettingsView from "../settings/ObjectSettingsView";
|
||||||
|
import { useSearchEffect } from "@/hooks/use-overlay-state";
|
||||||
|
|
||||||
type LiveCameraViewProps = {
|
type LiveCameraViewProps = {
|
||||||
config?: FrigateConfig;
|
config?: FrigateConfig;
|
||||||
@ -274,6 +275,14 @@ export default function LiveCameraView({
|
|||||||
const [showStats, setShowStats] = useState(false);
|
const [showStats, setShowStats] = useState(false);
|
||||||
const [debug, setDebug] = useState(false);
|
const [debug, setDebug] = useState(false);
|
||||||
|
|
||||||
|
useSearchEffect("debug", (value: string) => {
|
||||||
|
if (value === "true") {
|
||||||
|
setDebug(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
const [fullResolution, setFullResolution] = useState<VideoResolutionType>({
|
const [fullResolution, setFullResolution] = useState<VideoResolutionType>({
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user