Skip to content

Commit ffa5abb

Browse files
authored
feat(frontend): Add navbar version badge (#179)
* feat(frontend): Add navbar version badge * fix: Version badge can trigger auto-wrap of the navbar buttons
1 parent e4828ca commit ffa5abb

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

frontend/components/navbar.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { ThemeToggle } from "./theme-toggle";
77
import { SidebarTrigger } from "./ui/sidebar";
88
import { $ } from "@/lib/i18n";
99
import { logout } from "@/lib/api";
10+
import { Badge } from "./ui/badge";
11+
import { googleSansCode } from "@/lib/fonts";
12+
import { version } from "@/lib/global";
13+
import { UpdateDialog } from "@/app/panel/settings/update-dialog";
1014

1115
export function Navbar({ className, ...props }: React.ComponentProps<"nav">) {
1216
const handleLogout = async () => {
@@ -19,6 +23,13 @@ export function Navbar({ className, ...props }: React.ComponentProps<"nav">) {
1923
className={cn("min-h-12 bg-background border-b border-b-sidebar-border flex items-center justify-end *:cursor-pointer", className)}
2024
{...props}>
2125
<SidebarTrigger className="mr-auto hidden max-md:flex cursor-pointer"/>
26+
<UpdateDialog asChild>
27+
<Badge
28+
variant="outline"
29+
className={cn("max-xs:hidden mr-2", googleSansCode.className)}>
30+
{`v${version}`}
31+
</Badge>
32+
</UpdateDialog>
2233
<div className="space-x-2 mr-2 max-sm:mr-0 max-sm:space-x-0">
2334
<Button
2435
variant="ghost"

frontend/style/lib.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@
2727
@slot;
2828
}
2929
}
30+
31+
@custom-variant max-xs {
32+
@media (max-width: 20rem) {
33+
@slot;
34+
}
35+
}

0 commit comments

Comments
 (0)