mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
consistent naming
This commit is contained in:
parent
fc256b0572
commit
c63945a7d2
@ -1,14 +1,14 @@
|
|||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
type useSessionStorageReturn<S> = [
|
type useSessionPersistenceReturn<S> = [
|
||||||
value: S | undefined,
|
value: S | undefined,
|
||||||
setValue: (value: S | undefined) => void,
|
setValue: (value: S | undefined) => void,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function useSessionStorage<S>(
|
export function useSessionPersistence<S>(
|
||||||
key: string,
|
key: string,
|
||||||
defaultValue: S | undefined = undefined,
|
defaultValue: S | undefined = undefined,
|
||||||
): useSessionStorageReturn<S> {
|
): useSessionPersistenceReturn<S> {
|
||||||
const [storedValue, setStoredValue] = useState(() => {
|
const [storedValue, setStoredValue] = useState(() => {
|
||||||
try {
|
try {
|
||||||
const value = window.sessionStorage.getItem(key);
|
const value = window.sessionStorage.getItem(key);
|
||||||
@ -78,7 +78,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
|
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useSessionStorage } from "@/hooks/use-session-state";
|
import { useSessionPersistence } from "@/hooks/use-session-persistence";
|
||||||
|
|
||||||
type LiveCameraViewProps = {
|
type LiveCameraViewProps = {
|
||||||
config?: FrigateConfig;
|
config?: FrigateConfig;
|
||||||
@ -195,7 +195,7 @@ export default function LiveCameraView({
|
|||||||
|
|
||||||
// playback state
|
// playback state
|
||||||
|
|
||||||
const [audio, setAudio] = useSessionStorage("liveAudio", false);
|
const [audio, setAudio] = useSessionPersistence("liveAudio", false);
|
||||||
const [mic, setMic] = useState(false);
|
const [mic, setMic] = useState(false);
|
||||||
const [webRTC, setWebRTC] = useState(false);
|
const [webRTC, setWebRTC] = useState(false);
|
||||||
const [pip, setPip] = useState(false);
|
const [pip, setPip] = useState(false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user