// ============================================================ // ATHAR — Pages 6 & 7 (Reveal flow, standalone, no nav) // ============================================================ const SAMPLE_MESSAGE = "From the first moment I saw you, I knew — some people walk into your life and rearrange everything quietly."; // ---------- PAGE 6: Message Reveal /r/:token ---------- function MessageReveal({ token }) { // States: 'idle' (pre-reveal), 'timer' (counting down), 'finale' (fade complete) const [state, setState] = useState('idle'); const [seconds, setSeconds] = useState(60); const [fading, setFading] = useState(false); const intervalRef = useRef(null); const fadeTimerRef = useRef(null); const begin = useCallback(() => { setState('timer'); setSeconds(60); setFading(false); }, []); useEffect(() => { if (state !== 'timer') return; intervalRef.current = setInterval(() => { setSeconds((s) => { if (s <= 1) { clearInterval(intervalRef.current); // trigger fade setFading(true); fadeTimerRef.current = setTimeout(() => setState('finale'), 2500); return 0; } return s - 1; }); }, 1000); return () => { clearInterval(intervalRef.current); clearTimeout(fadeTimerRef.current); }; }, [state]); // Cleanup on unmount useEffect(() => () => { clearInterval(intervalRef.current); clearTimeout(fadeTimerRef.current); }, []); if (state === 'idle') { return (
أثر

A message was left for you.

); } if (state === 'finale') { return (
أثر

Some things are meant to be felt, not kept.

); } // timer state const formatted = '0:' + String(seconds).padStart(2, '0'); return (
{formatted}

{SAMPLE_MESSAGE}

); } // ---------- PAGE 7: Expired /r/:token/expired ---------- function Expired({ token }) { return (
أثر

This message has already been opened.

Some things are meant to be felt, not kept.
); } window.MessageReveal = MessageReveal; window.Expired = Expired;