feat(theme): add dark mode with next-themes and settings toggle

This commit is contained in:
zetaloop
2026-02-25 20:01:52 +08:00
parent c55d533925
commit 336aa36d5a
7 changed files with 91 additions and 8 deletions
+17
View File
@@ -0,0 +1,17 @@
"use client"
import { useAuthStore } from "@/store/auth"
import { useTheme } from "next-themes"
import { useEffect } from "react"
export function ThemeSyncEffect() {
const { setTheme } = useTheme()
const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
const themePreference = useAuthStore((s) => s.themePreference)
useEffect(() => {
setTheme(themePreference)
}, [isAuthenticated, themePreference, setTheme])
return null
}