Skip to content

NVR with realtime local object detection for IP cameras

Set aspect ratios on live display (#9780)

Josh Hawkins2d22800a3d1b
diff --git a/web/src/components/Sidebar.tsx b/web/src/components/Sidebar.tsx
index a855dbdc0b..0a563cbce7 100644
--- a/web/src/components/Sidebar.tsx
+++ b/web/src/components/Sidebar.tsx
@@ -74,8 +74,8 @@ function SidebarItem({ Icon, title, url, dev, onClick }: SidebarItemProps) {
className={({ isActive }) =>
`mx-[10px] mb-6 flex flex-col justify-center items-center rounded-lg ${
isActive
- ? "font-bold text-white bg-primary"
- : "text-muted-foreground bg-secondary"
+ ? "font-bold text-primary-foreground bg-primary"
+ : "text-muted-foreground bg-muted"
}`
}
>
diff --git a/web/src/pages/Live.tsx b/web/src/pages/Live.tsx
index c50c0d4d27..2f4270bb1b 100644
--- a/web/src/pages/Live.tsx
+++ b/web/src/pages/Live.tsx
@@ -78,10 +78,11 @@ function Live() {
<div className="mt-4 md:grid md:grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4 gap-4">
{cameras.map((camera) => {
let grow;
- if (camera.detect.width / camera.detect.height > 2) {
- grow = "aspect-wide md:col-span-2";
- } else if (camera.detect.width / camera.detect.height < 1) {
- grow = "aspect-tall md:aspect-auto md:row-span-2";
+ let aspectRatio = camera.detect.width / camera.detect.height;
+ if (aspectRatio > 2) {
+ grow = "md:col-span-2 aspect-wide";
+ } else if (aspectRatio < 1) {
+ grow = `md:row-span-2 aspect-[8/9]`;
} else {
grow = "aspect-video";
}