mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-08 06:15:43 +03:00
32 lines
814 B
TypeScript
32 lines
814 B
TypeScript
|
|
import { useMemo } from "react";
|
||
|
|
import DebugCameraImage from "../camera/DebugCameraImage";
|
||
|
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||
|
|
import useSWR from "swr";
|
||
|
|
import ActivityIndicator from "../indicators/activity-indicator";
|
||
|
|
|
||
|
|
type ObjectSettingsProps = {
|
||
|
|
selectedCamera?: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export default function ObjectSettings({
|
||
|
|
selectedCamera,
|
||
|
|
}: ObjectSettingsProps) {
|
||
|
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||
|
|
|
||
|
|
const cameraConfig = useMemo(() => {
|
||
|
|
if (config && selectedCamera) {
|
||
|
|
return config.cameras[selectedCamera];
|
||
|
|
}
|
||
|
|
}, [config, selectedCamera]);
|
||
|
|
|
||
|
|
if (!cameraConfig) {
|
||
|
|
return <ActivityIndicator />;
|
||
|
|
}
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="flex flex-col h-50">
|
||
|
|
<DebugCameraImage cameraConfig={cameraConfig} className="size-full" />
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|