diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..3b6783b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1 @@ +- Make sure to use bun when running scripts diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000..dad21d4 --- /dev/null +++ b/opencode.json @@ -0,0 +1,14 @@ +{ + "mcp": { + "context7": { + "type": "local", + "command": [ + "npx", + "-y", + "@upstash/context7-mcp" + ], + "enabled": true + } + }, + "$schema": "https://opencode.ai/config.json" +} \ No newline at end of file diff --git a/src/app/(admin)/admin/_components/sidebar.tsx b/src/app/(admin)/admin/_components/sidebar.tsx index 8a914db..e087fcc 100644 --- a/src/app/(admin)/admin/_components/sidebar.tsx +++ b/src/app/(admin)/admin/_components/sidebar.tsx @@ -4,6 +4,7 @@ import { HomeIcon, KeyRoundIcon, LayoutDashboard, List, PanelLeft, Plus, User2 } import Link from "next/link" import { usePathname } from "next/navigation" +import { ThemeSwitcher } from "@/components/ui/kibo-ui/theme-switcher" import { Sidebar, SidebarContent, diff --git a/src/app/(public)/layout.tsx b/src/app/(public)/layout.tsx index 8834b2c..49d6256 100644 --- a/src/app/(public)/layout.tsx +++ b/src/app/(public)/layout.tsx @@ -1,4 +1,4 @@ -import { ThemeToggle } from "@/components/theme-toggle" +import { ThemeSwitcher } from "@/components/ui/kibo-ui/theme-switcher" import { UserDropdown } from "@/components/user-dropdown" import Link from "next/link" import { ReactNode } from "react" @@ -22,7 +22,7 @@ export default function PublicLayout({
- +
diff --git a/src/components/theme-toggle.tsx b/src/components/theme-toggle.tsx deleted file mode 100644 index 7b7aae0..0000000 --- a/src/components/theme-toggle.tsx +++ /dev/null @@ -1,61 +0,0 @@ -"use client" - -import { Button } from "@/components/ui/button" -import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" -import { Monitor, Moon, Sun } from "lucide-react" -import { useTheme } from "next-themes" -import { useEffect, useState } from "react" - -export function ThemeToggle() { - const { theme, setTheme } = useTheme() - const [mounted, setMounted] = useState(false) - - // Prevent hydration mismatch - useEffect(() => { - setMounted(true) - }, []) - - if (!mounted) { - return ( - - ) - } - - const getIcon = () => { - switch (theme) { - case "light": - return - case "dark": - return - default: - return - } - } - - return ( - - - - - - setTheme("light")}> - - Light - - setTheme("dark")}> - - Dark - - setTheme("system")}> - - System - - - - ) -} diff --git a/src/components/ui/kibo-ui/theme-switcher/index.tsx b/src/components/ui/kibo-ui/theme-switcher/index.tsx new file mode 100644 index 0000000..6cbe736 --- /dev/null +++ b/src/components/ui/kibo-ui/theme-switcher/index.tsx @@ -0,0 +1,88 @@ +"use client" + +import { cn } from "@/lib/utils" +import { Monitor, Moon, Sun } from "lucide-react" +import { motion } from "motion/react" +import { useTheme } from "next-themes" +import { useCallback, useEffect, useState } from "react" + +const themes = [ + { + key: "system", + icon: Monitor, + label: "System theme" + }, + { + key: "light", + icon: Sun, + label: "Light theme" + }, + { + key: "dark", + icon: Moon, + label: "Dark theme" + } +] + +export type ThemeSwitcherProps = { + className?: string + vertical?: boolean +} + +export function ThemeSwitcher({ className, vertical = false }: ThemeSwitcherProps) { + const { theme, setTheme } = useTheme() + const [mounted, setMounted] = useState(false) + + const handleThemeClick = useCallback( + (themeKey: "light" | "dark" | "system") => { + setTheme(themeKey) + }, + [setTheme] + ) + + useEffect(() => { + setMounted(true) + }, []) + + if (!mounted) { + return null + } + + return ( +
+ {themes.map(({ key, icon: Icon, label }) => { + const isActive = theme === key + + return ( + + ) + })} +
+ ) +}