import { T } from "../theme" import { useI18n } from "../i18n/I18nContext" const CONFETTI_COLORS = ["#16a34a", "#f59e0b", "#3b82f6", "#ef4444", "#0d9488", "#a855f7"] // Big celebratory overlay shown when the user unlocks one or more badges. export default function Celebration({ badges, onClose }) { const { t } = useI18n() if (!badges || badges.length === 0) return null const main = badges[0] const pieces = Array.from({ length: 60 }) return (
{/* confetti */} {pieces.map((_, i) => { const left = Math.random() * 100 const delay = Math.random() * 0.6 const dur = 1.8 + Math.random() * 1.4 const color = CONFETTI_COLORS[i % CONFETTI_COLORS.length] const size = 7 + Math.random() * 7 return ( ) })}
e.stopPropagation()}>
{t("achievement_unlocked")}
{main.emoji}
{t("congrats_badge")}
{main.label}
{badges.length > 1 && (
{badges.slice(1).map((b) => ( {b.emoji} {b.label} ))}
)}
) } const overlay = { position: "fixed", inset: 0, background: "rgba(15,23,42,.6)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 3000, backdropFilter: "blur(3px)", overflow: "hidden" } const cardStyle = { position: "relative", width: "90%", maxWidth: 360, background: "#fff", borderRadius: 24, padding: "30px 26px", textAlign: "center", boxShadow: T.shadowLg, animation: "popBig .5s ease both" } const banner = { display: "inline-block", background: T.gradientWarm, color: "#fff", fontSize: 12, fontWeight: 800, letterSpacing: ".08em", textTransform: "uppercase", padding: "6px 16px", borderRadius: 999 } const badgeCircle = { width: 120, height: 120, borderRadius: "50%", margin: "22px auto 0", display: "flex", alignItems: "center", justifyContent: "center", background: "radial-gradient(circle at 50% 40%, #fef3c7, #fde68a)", boxShadow: "0 10px 30px rgba(245,158,11,.4)" } const miniBadge = { fontSize: 12, fontWeight: 600, color: T.muted, background: T.surfaceAlt, border: `1px solid ${T.border}`, borderRadius: 999, padding: "5px 12px" } const btn = { marginTop: 24, width: "100%", padding: "13px", borderRadius: 12, border: "none", background: T.gradient, color: "#fff", fontSize: 15, fontWeight: 700, cursor: "pointer", boxShadow: T.shadowGreen }