mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 22:55:26 +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 { LivePlayerError, LivePlayerMode } from "@/types/live";
|
||||||
import { FaCompress, FaExpand } from "react-icons/fa";
|
import { FaCompress, FaExpand } from "react-icons/fa";
|
||||||
import { useResizeObserver } from "@/hooks/resize-observer";
|
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 = {
|
type LiveDashboardViewProps = {
|
||||||
cameras: CameraConfig[];
|
cameras: CameraConfig[];
|
||||||
@ -247,6 +252,34 @@ export default function LiveDashboardView({
|
|||||||
[setPreferredLiveModes],
|
[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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className="scrollbar-container size-full overflow-y-auto px-1 pt-2 md:p-2"
|
className="scrollbar-container size-full overflow-y-auto px-1 pt-2 md:p-2"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user