Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set aspect ratios on live display #9780

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}`
}
>
Expand Down
9 changes: 5 additions & 4 deletions web/src/pages/Live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down