"use client"; import { useState } from "react"; import { AnimatePresence, motion } from "framer-motion"; import useSWR from "swr"; import { fetcher } from "@/lib/utils"; import { Icons } from "../shared/icons"; import { Button } from "../ui/button"; export function Notification() { const [isVisible, setIsVisible] = useState(true); const { data, isLoading, error } = useSWR>( "/api/configs?key=system_notification", fetcher, { dedupingInterval: 30000 }, ); const handleClose = () => { setIsVisible(false); }; if (error || isLoading || !data || !data.system_notification) return null; return ( {isVisible && (
)} ); }