"use client"; // import { LanguageSwitcher } from "@/components/LanguageSwitcher"; import { ModeToggle } from "@/components/ThemeSwitcher"; import { Separator } from "@/components/ui/separator"; import { Skeleton } from "@/components/ui/skeleton"; import { DateTime } from "luxon"; import { useEffect, useRef, useState } from "react"; function Header() { return (
apple-touch-icon
{"NezhaDash"}

哪吒监控面板

{/* */}
); } // https://github.com/streamich/react-use/blob/master/src/useInterval.ts const useInterval = (callback: () => void, delay: number | null) => { const savedCallback = useRef<() => void>(() => {}); useEffect(() => { savedCallback.current = callback; }); useEffect(() => { if (delay !== null) { const interval = setInterval(() => savedCallback.current(), delay || 0); return () => clearInterval(interval); } return undefined; }, [delay]); }; function Overview() { const [mouted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); const timeOption = DateTime.TIME_SIMPLE; timeOption.hour12 = true; const [timeString, setTimeString] = useState( DateTime.now().setLocale("en-US").toLocaleString(timeOption), ); useInterval(() => { setTimeString(DateTime.now().setLocale("en-US").toLocaleString(timeOption)); }, 1000); return (

👋 Overview

where the time is

{mouted ? (

{timeString}

) : ( )}
); } export default Header;