Skip to content

Commit f95b86c

Browse files
hawkeye217mike2307
authored andcommitted
Set aspect ratios on live display (blakeblackshear#9780)
* set aspect ratios on live display * try 8/9
1 parent cb38d20 commit f95b86c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

web/src/components/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ function SidebarItem({ Icon, title, url, dev, onClick }: SidebarItemProps) {
7474
className={({ isActive }) =>
7575
`mx-[10px] mb-6 flex flex-col justify-center items-center rounded-lg ${
7676
isActive
77-
? "font-bold text-white bg-primary"
78-
: "text-muted-foreground bg-secondary"
77+
? "font-bold text-primary-foreground bg-primary"
78+
: "text-muted-foreground bg-muted"
7979
}`
8080
}
8181
>

web/src/pages/Live.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ function Live() {
7878
<div className="mt-4 md:grid md:grid-cols-2 xl:grid-cols-3 3xl:grid-cols-4 gap-4">
7979
{cameras.map((camera) => {
8080
let grow;
81-
if (camera.detect.width / camera.detect.height > 2) {
82-
grow = "aspect-wide md:col-span-2";
83-
} else if (camera.detect.width / camera.detect.height < 1) {
84-
grow = "aspect-tall md:aspect-auto md:row-span-2";
81+
let aspectRatio = camera.detect.width / camera.detect.height;
82+
if (aspectRatio > 2) {
83+
grow = "md:col-span-2 aspect-wide";
84+
} else if (aspectRatio < 1) {
85+
grow = `md:row-span-2 aspect-[8/9]`;
8586
} else {
8687
grow = "aspect-video";
8788
}

0 commit comments

Comments
 (0)