"use client"; import { useState, useEffect } from "react"; import { usePathname } from "next/navigation"; import { motion, AnimatePresence } from "framer-motion"; const SayCode = () => { const pathname = usePathname(); const [isVisible, setIsVisible] = useState(false); const [isMobile, setIsMobile] = useState(false); // Determine if we are on an invitation guest page const isInvitationSlugPage = pathname.startsWith("/invitation/") && pathname !== "/invitation/maker"; useEffect(() => { // 1. Date Range Check (January 21 to January 27) const now = new Date(); const currentYear = now.getFullYear(); const startDate = new Date(currentYear, 0, 21); // Jan 21 (Month is 0-indexed) const endDate = new Date(currentYear, 0, 27, 23, 59, 59); // Jan 27, end of day const isInDateRange = now >= startDate && now <= endDate; // 2. Responsive Check const checkMobile = () => setIsMobile(window.innerWidth < 640); checkMobile(); window.addEventListener("resize", checkMobile); // 3. Visibility Logic const dismissed = localStorage.getItem("sayCodeDismissed"); // Only show if: not dismissed, not on invitation page, AND within date range if (!dismissed && !isInvitationSlugPage && isInDateRange) { const timer = setTimeout(() => setIsVisible(true), 2000); return () => { clearTimeout(timer); window.removeEventListener("resize", checkMobile); }; } return () => window.removeEventListener("resize", checkMobile); }, [pathname, isInvitationSlugPage]); // Don't render if on invitation slug page if (isInvitationSlugPage) return null; const handleDismiss = () => { setIsVisible(false); localStorage.setItem("sayCodeDismissed", "true"); }; return ( {isVisible && (

Security Access

Use "10" as the answer for any security questions on this site.

*This security layer is implemented to protect input fields from automated bot attacks.

)} ); }; export default SayCode;