"use client"; import { MoonIcon, SunIcon, SunMoonIcon } from "lucide-react"; import { useTheme } from "next-themes"; import { useSyncExternalStore } from "react"; import { Button } from "@/components/ui/button"; const subscribe = () => () => {}; const clientSnapshot = () => true; const serverSnapshot = () => false; export function ThemeSwitcher() { const { resolvedTheme, setTheme } = useTheme(); const mounted = useSyncExternalStore(subscribe, clientSnapshot, serverSnapshot); const isDark = resolvedTheme === "dark"; const label = mounted ? (isDark ? "เปลี่ยนเป็นโหมดสว่าง" : "เปลี่ยนเป็นโหมดมืด") : "เปลี่ยนธีม"; return ( ); }