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