ensure birdseye is actually enabled in config

This commit is contained in:
Josh Hawkins 2024-03-12 14:23:20 -05:00
parent c7ce957c2d
commit 57326324cd
2 changed files with 24 additions and 21 deletions

View File

@ -146,6 +146,8 @@ function NewGroupDialog({ open, setOpen, currentGroups }: NewGroupDialogProps) {
const { data: config, mutate: updateConfig } = const { data: config, mutate: updateConfig } =
useSWR<FrigateConfig>("config"); useSWR<FrigateConfig>("config");
const birdseyeConfig = useMemo(() => config?.birdseye, [config]);
// add fields // add fields
const [editState, setEditState] = useState<"none" | "add" | "edit">("none"); const [editState, setEditState] = useState<"none" | "add" | "edit">("none");
@ -298,8 +300,10 @@ function NewGroupDialog({ open, setOpen, currentGroups }: NewGroupDialogProps) {
</div> </div>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent> <DropdownMenuContent>
{[...Object.keys(config?.cameras ?? {}), "birdseye"].map( {[
(camera) => ( ...Object.keys(config?.cameras ?? {}),
...(birdseyeConfig?.enabled ? ["birdseye"] : []),
].map((camera) => (
<FilterCheckBox <FilterCheckBox
key={camera} key={camera}
isChecked={cameras.includes(camera)} isChecked={cameras.includes(camera)}
@ -316,8 +320,7 @@ function NewGroupDialog({ open, setOpen, currentGroups }: NewGroupDialogProps) {
} }
}} }}
/> />
), ))}
)}
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
{error && <div className="text-danger">{error}</div>} {error && <div className="text-danger">{error}</div>}

View File

@ -130,7 +130,7 @@ export default function LiveDashboardView({
<div <div
className={`my-4 grid ${layout == "grid" ? "grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4" : ""} gap-2 md:gap-4 *:rounded-2xl *:bg-black`} className={`my-4 grid ${layout == "grid" ? "grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4" : ""} gap-2 md:gap-4 *:rounded-2xl *:bg-black`}
> >
{includeBirdseye && birdseyeConfig && ( {includeBirdseye && birdseyeConfig?.enabled && (
<BirdseyeLivePlayer <BirdseyeLivePlayer
birdseyeConfig={birdseyeConfig} birdseyeConfig={birdseyeConfig}
liveMode={birdseyeConfig.restream ? "mse" : "jsmpeg"} liveMode={birdseyeConfig.restream ? "mse" : "jsmpeg"}