Individual live view (#10178)

* Get live camera view working

* Get ptz working

* Add button for ptz presets

* Add camera feature buttons

* Add button for camera audio

* Cleanup

* Cleanup mobile live

* Only use landscape check on mobile
This commit is contained in:
Nicolas Mowen
2024-03-01 17:43:02 -07:00
committed by GitHub
parent a67e970fca
commit 5028a9632e
9 changed files with 575 additions and 132 deletions

View File

@@ -0,0 +1,60 @@
import { IconType } from "react-icons";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { isDesktop } from "react-device-detect";
const variants = {
primary: {
active: "font-bold text-primary-foreground bg-primary",
inactive: "text-muted-foreground bg-muted",
},
secondary: {
active: "font-bold text-primary",
inactive: "text-muted-foreground",
},
};
type CameraFeatureToggleProps = {
className?: string;
variant?: "primary" | "secondary";
isActive: boolean;
Icon: IconType;
title: string;
onClick?: () => void;
};
export default function CameraFeatureToggle({
className = "",
variant = "primary",
isActive,
Icon,
title,
onClick,
}: CameraFeatureToggleProps) {
const content = (
<div
onClick={onClick}
className={`${className} flex flex-col justify-center items-center rounded-lg ${
variants[variant][isActive ? "active" : "inactive"]
}`}
>
<Icon className="size-5 md:m-[6px]" />
</div>
);
if (isDesktop) {
return (
<Tooltip>
<TooltipTrigger>{content}</TooltipTrigger>
<TooltipContent side="bottom">
<p>{title}</p>
</TooltipContent>
</Tooltip>
);
}
return content;
}