"use client" import AnimateCountClient from "@/components/AnimatedCount" import { LanguageSwitcher } from "@/components/LanguageSwitcher" import { ModeToggle } from "@/components/ThemeSwitcher" import { Separator } from "@/components/ui/separator" import { Skeleton } from "@/components/ui/skeleton" import getEnv from "@/lib/env-entry" import { DateTime } from "luxon" import { useTranslations } from "next-intl" import { useRouter } from "next/navigation" import { memo, useCallback, useEffect, useState } from "react" interface TimeState { hh: number mm: number ss: number } interface CustomLink { link: string name: string } const useCurrentTime = () => { const [time, setTime] = useState({ hh: DateTime.now().setLocale("en-US").hour, mm: DateTime.now().setLocale("en-US").minute, ss: DateTime.now().setLocale("en-US").second, }) useEffect(() => { const intervalId = setInterval(() => { const now = DateTime.now().setLocale("en-US") setTime({ hh: now.hour, mm: now.minute, ss: now.second, }) }, 1000) return () => clearInterval(intervalId) }, []) return time } const Links = memo(function Links() { const linksEnv = getEnv("NEXT_PUBLIC_Links") const links: CustomLink[] | null = linksEnv ? JSON.parse(linksEnv) : null if (!links) return null return (
{links.map((link) => ( {link.name} ))}
) }) const Overview = memo(function Overview() { const t = useTranslations("Overview") const time = useCurrentTime() const [mounted, setMounted] = useState(false) useEffect(() => { setMounted(true) }, []) return (

{t("p_2277-2331_Overview")}

{t("p_2390-2457_wherethetimeis")}

{mounted ? (
: :
) : ( )}
) }) function Header() { const t = useTranslations("Header") const customLogo = getEnv("NEXT_PUBLIC_CustomLogo") const customTitle = getEnv("NEXT_PUBLIC_CustomTitle") const customDescription = getEnv("NEXT_PUBLIC_CustomDescription") const router = useRouter() const handleLogoClick = useCallback(() => { sessionStorage.removeItem("selectedTag") router.push("/") }, [router]) return (
apple-touch-icon apple-touch-icon
{customTitle ? customTitle : "NezhaDash"}

{customDescription ? customDescription : t("p_1079-1199_Simpleandbeautifuldashbo")}

) } export default Header