"use client";
import { motion } from "framer-motion";
import { Calendar } from "lucide-react";
import React, { useEffect, useState } from "react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
interface Waitlist2Props {
logo?: string;
badge?: string;
heading?: string;
description?: string;
avatars?: string[];
joinedPeople?: number;
launchDate?: string;
className?: string;
}
const COUNTDOWN_UNITS = [
{ key: "day", label: "روز" },
{ key: "hour", label: "ساعت" },
{ key: "minute", label: "دقیقه" },
{ key: "second", label: "ثانیه" },
] as const;
type CountdownTimeLeft = Record<
(typeof COUNTDOWN_UNITS)[number]["key"],
number
>;
const formatCountdownValue = (value: number) =>
value.toLocaleString("fa-IR", { minimumIntegerDigits: 2 });
const SignupForm = () => {
return (
);
};
interface JoinedPeopleProps {
joinedPeople: number;
avatars: string[];
}
const JoinedPeople = ({ joinedPeople, avatars }: JoinedPeopleProps) => {
return (
{avatars.map((avatar, index) => {
return (
);
})}
بیش از {joinedPeople.toLocaleString("fa-IR")} نفر قبلاً پیوستهاند
);
};
interface CountdownTimerProps {
targetDate: string;
}
const CountdownTimer = ({ targetDate }: CountdownTimerProps) => {
const [timeLeft, setTimeLeft] = useState({
day: 0,
hour: 0,
minute: 0,
second: 0,
});
useEffect(() => {
const calculateTimeLeft = () => {
const target = new Date(targetDate).getTime();
const now = new Date().getTime();
const difference = target - now;
if (difference > 0) {
const days = Math.floor(difference / (1000 * 60 * 60 * 24));
const hours = Math.floor(
(difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),
);
const minutes = Math.floor(
(difference % (1000 * 60 * 60)) / (1000 * 60),
);
const seconds = Math.floor((difference % (1000 * 60)) / 1000);
setTimeLeft({
day: days,
hour: hours,
minute: minutes,
second: seconds,
});
} else {
setTimeLeft({ day: 0, hour: 0, minute: 0, second: 0 });
}
};
calculateTimeLeft();
const timer = setInterval(calculateTimeLeft, 1000);
return () => clearInterval(timer);
}, [targetDate]);
return (
{COUNTDOWN_UNITS.map(({ key, label }, index) => {
const value = timeLeft[key];
return (
{formatCountdownValue(value)}
{label}
{index < COUNTDOWN_UNITS.length - 1 ? (
:
) : null}
);
})}
زمان باقیمانده تا راهاندازی
);
};
const Waitlist2 = ({
logo = "/block-media/shadcnblocks/block/block-white-1.svg",
badge = `بهزودی ${(new Date().getFullYear() + 1).toLocaleString("fa-IR")}`,
heading = "به لیست انتظار بپیوندید",
description = "زودتر از همه از راهاندازی مطلع شوید. با ثبت ایمیل، دسترسی زودهنگام و مزایای ویژه دریافت کنید.",
avatars = [
"/block-media/shadcnblocks/block/portraits/joseph-gonzalez-iFgRcqHznqg-unsplash.jpg",
"/block-media/shadcnblocks/block/portraits/michael-dam-mEZ3PoFGs_k-unsplash.jpg",
"/block-media/shadcnblocks/block/portraits/nima-motaghian-nejad-_omdf_EgRUo-unsplash.jpg",
"/block-media/shadcnblocks/block/portraits/good-faces-xmSWVeGEnJw-unsplash.jpg",
"/block-media/shadcnblocks/block/portraits/christian-buehner-DItYlc26zVI-unsplash 1.png",
],
joinedPeople = 12500,
launchDate = `01/01/${new Date().getFullYear() + 1}`,
className,
}: Waitlist2Props) => {
return (
);
};
export { Waitlist2 };