mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
add shortcut and query for live view
This commit is contained in:
parent
99e03576bf
commit
5403ee1c8d
@ -31,6 +31,11 @@ import { cn } from "@/lib/utils";
|
||||
import { LivePlayerError, LivePlayerMode } from "@/types/live";
|
||||
import { FaCompress, FaExpand } from "react-icons/fa";
|
||||
import { useResizeObserver } from "@/hooks/resize-observer";
|
||||
import useKeyboardListener, {
|
||||
KeyModifiers,
|
||||
} from "@/hooks/use-keyboard-listener";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { useSearchEffect } from "@/hooks/use-overlay-state";
|
||||
|
||||
type LiveDashboardViewProps = {
|
||||
cameras: CameraConfig[];
|
||||
@ -247,6 +252,34 @@ export default function LiveDashboardView({
|
||||
[setPreferredLiveModes],
|
||||
);
|
||||
|
||||
const onKeyboardShortcut = useCallback(
|
||||
(key: string, modifiers: KeyModifiers) => {
|
||||
if (!modifiers.down) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case "f":
|
||||
toggleFullscreen();
|
||||
break;
|
||||
}
|
||||
},
|
||||
[toggleFullscreen],
|
||||
);
|
||||
|
||||
useKeyboardListener(["f"], onKeyboardShortcut);
|
||||
const handleFullScreenQuery = useCallback(
|
||||
(value: string) => {
|
||||
const desiredState = value === "true";
|
||||
if (fullscreen === desiredState) {
|
||||
return;
|
||||
}
|
||||
toggleFullscreen;
|
||||
},
|
||||
[fullscreen, toggleFullscreen],
|
||||
);
|
||||
useSearchEffect("fullscreen", handleFullScreenQuery);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="scrollbar-container size-full overflow-y-auto px-1 pt-2 md:p-2"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user