"use client"; import { useState } from "react"; import { Copy } from "lucide-react"; import { motion, AnimatePresence } from "framer-motion"; import { Button } from "@heroui/react"; import Image from "next/image"; import BorderedButton from "@/components/common/BorderedButton"; import { useApp } from "@/contexts/AppContext"; interface ReferralCodeCardProps { code: string; usedCount?: number; loading?: boolean; onCopy?: () => void; onShare?: () => void; } export default function ReferralCodeCard({ code = "PR0T0-8821", usedCount = 0, loading = false, onCopy, onShare, }: ReferralCodeCardProps) { const { t } = useApp(); const [copied, setCopied] = useState(false); const handleCopyClick = () => { onCopy?.(); setCopied(true); setTimeout(() => setCopied(false), 1500); }; return (
{/* Header */}
{t("points.referralCode")}
{/* Description */}

{t("points.shareYourCodeDescription").replace("{count}", usedCount.toString())}

{/* Code Display and Buttons */}
{/* Code Display Row */}
{/* Code Container */}
{loading ? (
) : ( {code === "Loading..." ? t("points.loading") : code} )}
{/* Copy Button */}
{/* Share Button */} {t("points.share")}
); }