"use client"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { useEffect, useState } from "react"; const STORAGE_KEY = "deck-intro-seen-v1"; type IntroScreenProps = { /** Tokens displayed as the wordmark. Default ["Deck"]. */ tokens?: string[]; /** Top eyebrow line. */ eyebrow?: string; /** Bottom status line. */ status?: string; /** ms before auto-dismiss. Default 2800. */ duration?: number; }; /** * Black splash with token-by-token wordmark, radial accent glow, and a thin progress bar. * Persists across one session via sessionStorage; reduced motion users skip it. * * To render "Brand × Partner" pass tokens={["Brand", "×", "Partner"]} — the "×" * token is automatically rendered in 45 % white instead of accent. */ export function IntroScreen({ tokens = ["Deck"], eyebrow = "", status = "Loading", duration = 2800, }: IntroScreenProps) { const [show, setShow] = useState(null); const reduce = useReducedMotion(); useEffect(() => { if (typeof window === "undefined") return; const seen = sessionStorage.getItem(STORAGE_KEY) === "1"; if (seen || reduce) { setShow(false); return; } setShow(true); document.body.style.overflow = "hidden"; const t = setTimeout(() => { sessionStorage.setItem(STORAGE_KEY, "1"); setShow(false); document.body.style.overflow = ""; }, duration); return () => { clearTimeout(t); document.body.style.overflow = ""; }; }, [reduce, duration]); if (show === null) return null; return ( {show && (
{eyebrow && ( {eyebrow} )}
{tokens.map((token, i) => ( {token} ))}
{status}
)}
); }