Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(ui): add light/dark theme toggle in sidebar
Naiyuan Qing88d2e9340bd5
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsxindex 42055417d5..8a4248d15e 100644--- a/apps/web/app/layout.tsx+++ b/apps/web/app/layout.tsx@@ -1,10 +1,15 @@import type { Metadata } from "next";import { Geist, Geist_Mono, Inter } from "next/font/google";import "@multica/ui/globals.css";-import { SidebarProvider, SidebarInset, SidebarTrigger } from "@multica/ui/components/ui/sidebar";+import {+ SidebarProvider,+ SidebarInset,+ SidebarTrigger,+} from "@multica/ui/components/ui/sidebar";import { AppSidebar } from "@multica/ui/components/app-sidebar";+import { ThemeProvider } from "@multica/ui/components/theme-provider";-const inter = Inter({subsets:['latin'],variable:'--font-sans'});+const inter = Inter({ subsets: ["latin"], variable: "--font-sans" });const geistSans = Geist({variable: "--font-geist-sans",@@ -33,23 +38,23 @@ export default function RootLayout({children: React.ReactNode;}>) {return (- <html lang="en" className={inter.variable}>+ <html lang="en" className={inter.variable} suppressHydrationWarning><bodyclassName={`${geistSans.variable} ${geistMono.variable} antialiased`}>- <SidebarProvider>- <AppSidebar items={NAV_ITEMS} />- <SidebarInset>- <div className="flex h-dvh overflow-hidden">- <header className="flex items-center p-2">- <SidebarTrigger />- </header>- <div className="flex-1">- {children}- </div>- </div>- </SidebarInset>- </SidebarProvider>+ <ThemeProvider+ attribute="class"+ defaultTheme="system"+ enableSystem+ disableTransitionOnChange+ >+ <SidebarProvider>+ <AppSidebar items={NAV_ITEMS} />+ <SidebarInset>+ <div className="flex h-dvh overflow-hidden">{children}</div>+ </SidebarInset>+ </SidebarProvider>+ </ThemeProvider></body></html>);diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex a1a81d0a0a..36d4807c66 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -14,29 +14,30 @@"./hooks/*": "./src/hooks/*.ts"},"dependencies": {- "@multica/store": "workspace:*","@base-ui/react": "^1.1.0","@hugeicons/core-free-icons": "^3.1.1","@hugeicons/react": "^1.1.4",+ "@multica/store": "workspace:*","class-variance-authority": "^0.7.1","clsx": "^2.1.1",+ "linkify-it": "^5.0.0",+ "next-themes": "^0.4.6","react": "catalog:","react-dom": "catalog:",- "shadcn": "^3.7.0",- "tailwind-merge": "^3.4.0",- "tailwindcss": "^4",- "tw-animate-css": "^1.4.0","react-markdown": "^10.1.0",- "remark-gfm": "^4.0.1","rehype-raw": "^7.0.0",+ "remark-gfm": "^4.0.1",+ "shadcn": "^3.7.0","shiki": "^3.21.0",- "linkify-it": "^5.0.0"+ "tailwind-merge": "^3.4.0",+ "tailwindcss": "^4",+ "tw-animate-css": "^1.4.0"},"devDependencies": {"@tailwindcss/postcss": "^4",+ "@types/linkify-it": "^5.0.0","@types/react": "catalog:","@types/react-dom": "catalog:",- "@types/linkify-it": "^5.0.0","typescript": "catalog:"}}diff --git a/packages/ui/src/components/app-sidebar.tsx b/packages/ui/src/components/app-sidebar.tsxindex 7765378fa1..77b5414a23 100644--- a/packages/ui/src/components/app-sidebar.tsx+++ b/packages/ui/src/components/app-sidebar.tsx@@ -2,6 +2,7 @@ import {Sidebar,SidebarHeader,SidebarContent,+ SidebarFooter,SidebarGroup,SidebarGroupLabel,SidebarGroupContent,@@ -9,6 +10,7 @@ import {SidebarMenuItem,SidebarMenuButton,} from "@multica/ui/components/ui/sidebar"+import { ThemeToggle } from "@multica/ui/components/theme-toggle"interface NavItem {title: string@@ -39,6 +41,13 @@ export function AppSidebar({ items }: AppSidebarProps) {</SidebarGroupContent></SidebarGroup></SidebarContent>+ <SidebarFooter>+ <SidebarMenu>+ <SidebarMenuItem>+ <ThemeToggle />+ </SidebarMenuItem>+ </SidebarMenu>+ </SidebarFooter></Sidebar>)}diff --git a/packages/ui/src/components/theme-provider.tsx b/packages/ui/src/components/theme-provider.tsxnew file mode 100644index 0000000000..6a1ffe4d07--- /dev/null+++ b/packages/ui/src/components/theme-provider.tsx@@ -0,0 +1,11 @@+"use client"++import * as React from "react"+import { ThemeProvider as NextThemesProvider } from "next-themes"++export function ThemeProvider({+ children,+ ...props+}: React.ComponentProps<typeof NextThemesProvider>) {+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>+}diff --git a/packages/ui/src/components/theme-toggle.tsx b/packages/ui/src/components/theme-toggle.tsxnew file mode 100644index 0000000000..45aa42dc7a--- /dev/null+++ b/packages/ui/src/components/theme-toggle.tsx@@ -0,0 +1,41 @@+"use client"++import { useTheme } from "next-themes"+import { HugeiconsIcon } from "@hugeicons/react"+import { Sun01Icon, Moon01Icon, ComputerIcon } from "@hugeicons/core-free-icons"+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+} from "@multica/ui/components/ui/dropdown-menu"+import { SidebarMenuButton } from "@multica/ui/components/ui/sidebar"++export function ThemeToggle() {+ const { setTheme } = useTheme()++ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <SidebarMenuButton>+ <HugeiconsIcon icon={Sun01Icon} className="dark:hidden" />+ <HugeiconsIcon icon={Moon01Icon} className="hidden dark:block" />+ <span>Theme</span>+ </SidebarMenuButton>+ }+ />+ <DropdownMenuContent side="top" align="start">+ <DropdownMenuItem onClick={() => setTheme("light")}>+ <HugeiconsIcon icon={Sun01Icon} /> Light+ </DropdownMenuItem>+ <DropdownMenuItem onClick={() => setTheme("dark")}>+ <HugeiconsIcon icon={Moon01Icon} /> Dark+ </DropdownMenuItem>+ <DropdownMenuItem onClick={() => setTheme("system")}>+ <HugeiconsIcon icon={ComputerIcon} /> System+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 907d0a42bf..4327a2633c 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -286,6 +286,9 @@ importers:linkify-it:specifier: ^5.0.0version: 5.0.0+ next-themes:+ specifier: ^0.4.6react:specifier: 'catalog:'version: 19.2.3@@ -4820,6 +4823,12 @@ packages:resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==}engines: {node: '>= 0.4.0'}+ resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==}+ peerDependencies:+ react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc+ react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc+resolution: {integrity: sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==}engines: {node: '>=20.9.0'}@@ -9928,7 +9937,7 @@ snapshots:eslint: 9.39.2([email protected])eslint-import-resolver-node: 0.3.9eslint-import-resolver-typescript: 3.10.1([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected]))- eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))eslint-plugin-react: 7.37.5([email protected]([email protected]))eslint-plugin-react-hooks: 7.0.1([email protected]([email protected]))@@ -9961,7 +9970,7 @@ snapshots:tinyglobby: 0.2.15unrs-resolver: 1.11.1optionalDependencies:- eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected]))+ eslint-plugin-import: 2.32.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected]))transitivePeerDependencies:- supports-color@@ -9976,7 +9985,7 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])))([email protected]([email protected])))([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected]([email protected])):dependencies:'@rtsao/scc': 1.1.0array-includes: 3.1.9@@ -11822,6 +11831,11 @@ snapshots:+ dependencies:+ react: 19.2.3+ react-dom: 19.2.3([email protected])+dependencies:'@next/env': 16.1.6