import React, { useState } from "react"; import { Users, DollarSign, TrendingUp, Link2, Copy, Search, Filter, Download, Calendar, CheckCircle, Clock, MoreVertical, } from "lucide-react"; interface Referral { name: string; email: string; date: string; earnings: string; status: "Active" | "Pending"; signupDate: string; totalCommission: string; country: string; } const referrals: Referral[] = [ { name: "John Doe", email: "john@example.com", date: "2025-09-20", earnings: "$50", status: "Active", signupDate: "2025-08-15", totalCommission: "$450", country: "United States", }, { name: "Jane Smith", email: "jane@example.com", date: "2025-09-18", earnings: "$20", status: "Pending", signupDate: "2025-09-10", totalCommission: "$20", country: "Canada", }, { name: "Michael Chen", email: "michael@example.com", date: "2025-09-15", earnings: "$120", status: "Active", signupDate: "2025-07-22", totalCommission: "$890", country: "Singapore", }, { name: "Sarah Johnson", email: "sarah@example.com", date: "2025-09-12", earnings: "$85", status: "Active", signupDate: "2025-06-30", totalCommission: "$1,240", country: "United Kingdom", }, { name: "David Williams", email: "david@example.com", date: "2025-09-25", earnings: "$15", status: "Pending", signupDate: "2025-09-20", totalCommission: "$15", country: "Australia", }, ]; const Referrals: React.FC = () => { const [searchTerm, setSearchTerm] = useState(""); const [copied, setCopied] = useState(false); const referralLink = "https://affiliatepro.com/ref/ABC123"; const handleCopy = () => { navigator.clipboard.writeText(referralLink); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const stats = [ { label: "Total Referrals", value: "5", icon: Users, color: "bg-blue-500", change: "+12% from last month", }, { label: "Active Referrals", value: "3", icon: CheckCircle, color: "bg-green-500", change: "60% conversion rate", }, { label: "Total Earnings", value: "$2,615", icon: DollarSign, color: "bg-purple-500", change: "+$450 this month", }, { label: "Avg. Per Referral", value: "$523", icon: TrendingUp, color: "bg-orange-500", change: "+18% growth", }, ]; const filteredReferrals = referrals.filter( (r) => r.name.toLowerCase().includes(searchTerm.toLowerCase()) || r.email.toLowerCase().includes(searchTerm.toLowerCase()) ); return (
{/* Header */}

Referrals

Track and manage your affiliate referrals

{/* Stats Grid */}
{stats.map((stat, idx) => (
{stat.value}
{stat.label}
{stat.change}
))}
{/* Referral Link Section */}

Your Referral Link

Share this link to earn commissions

{referralLink}
{/* Table Section */}
{/* Table Header */}

Referral List

setSearchTerm(e.target.value)} className="pl-9 sm:pl-10 pr-3 sm:pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none w-full sm:w-64 text-sm" />
{/* Mobile Card View */}
{filteredReferrals.map((r, idx) => (
{r.name.charAt(0)}
{r.name}
{r.email}
{r.status === "Active" ? ( ) : ( )} {r.status}
Signup Date
{r.signupDate}
Country
{r.country}
Last Earning
{r.earnings}
Total Commission
{r.totalCommission}
))}
{/* Desktop Table View */}
{filteredReferrals.map((r, idx) => ( ))}
Referral Signup Date Country Last Earnings Total Commission Status
{r.name.charAt(0)}
{r.name}
{r.email}
{r.signupDate}
{r.country}
{r.earnings}
{r.date}
{r.totalCommission} {r.status === "Active" ? ( ) : ( )} {r.status}
{/* Table Footer */}
Showing{" "} {filteredReferrals.length}{" "} of {referrals.length}{" "} referrals
); }; export default Referrals;