"use client" import { useState, useEffect } from "react" import { motion, AnimatePresence } from "framer-motion" import { Home } from "lucide-react" const NOTIFICATIONS = [ { name: "James T.", location: "Austin, TX", action: "just upgraded to Pro", time: "2 min ago" }, { name: "Sarah M.", location: "London, UK", action: "just signed up", time: "4 min ago" }, { name: "David K.", location: "Denver, CO", action: "got Lifetime access", time: "7 min ago" }, { name: "Priya R.", location: "Toronto, CA", action: "just signed up", time: "12 min ago" }, { name: "Marcus L.", location: "Miami, FL", action: "upgraded to Pro", time: "15 min ago" }, { name: "Rachel W.", location: "Seattle, WA", action: "just signed up", time: "18 min ago" }, { name: "Tom B.", location: "Chicago, IL", action: "got Lifetime access", time: "23 min ago" }, { name: "Aisha N.", location: "New York, NY", action: "just signed up", time: "27 min ago" }, ] export function SocialProofToast() { const [index, setIndex] = useState(0) const [visible, setVisible] = useState(false) useEffect(() => { // First show after 6s const initialTimer = setTimeout(() => tick(0), 6000) return () => clearTimeout(initialTimer) }, []) function tick(i: number) { setIndex(i) setVisible(true) setTimeout(() => { setVisible(false) const next = (i + 1) % NOTIFICATIONS.length setTimeout(() => tick(next), 4000) // gap between toasts }, 5000) // show duration } const notif = NOTIFICATIONS[index] return (
{visible && (

{notif.name} from {notif.location}

{notif.action}

{notif.time}

)}
) }