import { useRouter } from "next/router"; import { AnimatePresence, motion as m } from "framer-motion"; import NextNProgress from "nextjs-progressbar"; import { SessionProvider } from "next-auth/react"; import "../styles/globals.css"; import "react-loading-skeleton/dist/skeleton.css"; import { SkeletonTheme } from "react-loading-skeleton"; import SearchPalette from "@/components/searchPalette"; import { SearchProvider } from "@/lib/context/isOpenState"; import Head from "next/head"; import { WatchPageProvider } from "@/lib/context/watchPageProvider"; import { useEffect, useState } from "react"; import { unixTimestampToRelativeTime } from "@/utils/getTimes"; import SecretPage from "@/components/secret"; import { Toaster, toast } from "sonner"; export default function App({ Component, pageProps: { session, ...pageProps }, }) { const router = useRouter(); const [info, setInfo] = useState(null); useEffect(() => { async function getBroadcast() { try { const res = await fetch("/api/v2/admin/broadcast", { method: "GET", headers: { "Content-Type": "application/json", "X-Broadcast-Key": "get-broadcast", }, }); const data = await res.json(); if (data?.show === true) { toast.message( `🚧${data.message} ${ data?.startAt ? unixTimestampToRelativeTime(data.startAt) : "" }🚧`, { position: "bottom-right", important: true, duration: 100000, className: "flex-center font-karla text-white", // description: `🚧${info}🚧`, } ); // toast.message(`Announcement`, { // position: "top-center", // important: true, // // duration: 10000, // description: `🚧${info}🚧`, // }); } setInfo( `${data.message} ${ data?.startAt ? unixTimestampToRelativeTime(data.startAt) : "" }` ); } catch (err) { console.log(err); } } getBroadcast(); }, []); const handleCheatCodeEntered = () => { alert("Cheat code entered!"); // You can replace this with your desired action }; return ( <> {/* {info && (
🚧{info}🚧 setInfo()} className="absolute right-3 cursor-pointer" >
)} */}
); }