Hide record switch when disabled (#12997)

This commit is contained in:
Nicolas Mowen 2024-08-12 07:21:21 -06:00
parent 338b59a32e
commit b2c23a367d

View File

@ -412,6 +412,7 @@ export default function LiveCameraView({
)} )}
<FrigateCameraFeatures <FrigateCameraFeatures
camera={camera.name} camera={camera.name}
recordingEnabled={camera.record.enabled_in_config}
audioDetectEnabled={camera.audio.enabled_in_config} audioDetectEnabled={camera.audio.enabled_in_config}
autotrackingEnabled={ autotrackingEnabled={
camera.onvif.autotracking.enabled_in_config camera.onvif.autotracking.enabled_in_config
@ -670,12 +671,14 @@ function PtzControlPanel({
type FrigateCameraFeaturesProps = { type FrigateCameraFeaturesProps = {
camera: string; camera: string;
recordingEnabled: boolean;
audioDetectEnabled: boolean; audioDetectEnabled: boolean;
autotrackingEnabled: boolean; autotrackingEnabled: boolean;
fullscreen: boolean; fullscreen: boolean;
}; };
function FrigateCameraFeatures({ function FrigateCameraFeatures({
camera, camera,
recordingEnabled,
audioDetectEnabled, audioDetectEnabled,
autotrackingEnabled, autotrackingEnabled,
fullscreen, fullscreen,
@ -764,11 +767,15 @@ function FrigateCameraFeatures({
isChecked={detectState == "ON"} isChecked={detectState == "ON"}
onCheckedChange={() => sendDetect(detectState == "ON" ? "OFF" : "ON")} onCheckedChange={() => sendDetect(detectState == "ON" ? "OFF" : "ON")}
/> />
{recordingEnabled && (
<FilterSwitch <FilterSwitch
label="Recording" label="Recording"
isChecked={recordState == "ON"} isChecked={recordState == "ON"}
onCheckedChange={() => sendRecord(recordState == "ON" ? "OFF" : "ON")} onCheckedChange={() =>
sendRecord(recordState == "ON" ? "OFF" : "ON")
}
/> />
)}
<FilterSwitch <FilterSwitch
label="Snapshots" label="Snapshots"
isChecked={snapshotState == "ON"} isChecked={snapshotState == "ON"}