"use client"; import { useEffect, useState } from "react"; import { X, Rocket } from "lucide-react"; import { useLocale } from "next-intl"; import { cn } from "@/lib/utils"; // 1 Tir 1405 = June 22, 2026 (Tehran, UTC+3:30) const LAUNCH_DATE = new Date("2026-06-22T00:00:00+03:30"); const DISMISS_KEY = "meezi_launch_banner_v3"; interface TimeLeft { days: number; hours: number; minutes: number; seconds: number; expired: boolean; } function calcTimeLeft(): TimeLeft { const diff = LAUNCH_DATE.getTime() - Date.now(); if (diff <= 0) return { days: 0, hours: 0, minutes: 0, seconds: 0, expired: true }; const days = Math.floor(diff / 86_400_000); const hours = Math.floor((diff % 86_400_000) / 3_600_000); const minutes = Math.floor((diff % 3_600_000) / 60_000); const seconds = Math.floor((diff % 60_000) / 1_000); return { days, hours, minutes, seconds, expired: false }; } function pad(n: number) { return String(n).padStart(2, "0"); } export function LaunchCountdownSection() { const locale = useLocale(); const isFa = locale === "fa"; const [visible, setVisible] = useState(false); const [timeLeft, setTimeLeft] = useState(calcTimeLeft); useEffect(() => { if (localStorage.getItem(DISMISS_KEY) === "1") return; if (calcTimeLeft().expired) return; setVisible(true); }, []); useEffect(() => { if (!visible) return; const id = setInterval(() => { const tl = calcTimeLeft(); setTimeLeft(tl); if (tl.expired) setVisible(false); }, 1_000); return () => clearInterval(id); }, [visible]); if (!visible) return null; function dismiss() { localStorage.setItem(DISMISS_KEY, "1"); setVisible(false); } const { days, hours, minutes, seconds } = timeLeft; return (
{isFa ? "راه‌اندازی رسمی" : "Official launch"}

{isFa ? "میزی رسماً ۱ تیر ۱۴۰۵ برای همه کاربران راه‌اندازی می‌شود" : "Meezi officially launches for all users on June 22, 2026"}

{isFa ? "ثبت‌نام رایگان" : "Register free"}
); } function CountdownUnit({ value, label }: { value: number; label: string }) { return (
{pad(value)} {label}
); }