"use client"; import Image from "next/image"; import { Button, Card, CardHeader, CardBody, CardFooter } from "@heroui/react"; import { buttonStyles } from "@/lib/buttonStyles"; interface ProductCardProps { name: string; category: string; categoryColor: "orange" | "green" | "blue" | "purple" | "red"; iconType: "us-flag-1" | "hk-flag" | "us-flag-2" | "sg-flag" | "uk-flag"; yieldAPY: string; poolCap: string; maturity: string; risk: string; riskLevel: 1 | 2 | 3; lockUp: string; circulatingSupply: string; poolCapacityPercent: number; onInvest?: () => void; } export default function ProductCard({ name, category, categoryColor, iconType, yieldAPY, poolCap, maturity, risk, riskLevel, lockUp, circulatingSupply, poolCapacityPercent, onInvest, }: ProductCardProps) { const getCategoryColors = () => { switch (categoryColor) { case "orange": return { bg: "bg-orange-50", text: "text-orange-600", gradient: "from-orange-500/5 via-orange-300/3 to-white/0", }; case "green": return { bg: "bg-green-50", text: "text-green-600", gradient: "from-green-500/5 via-green-300/3 to-white/0", }; case "blue": return { bg: "bg-blue-50", text: "text-blue-600", gradient: "from-blue-500/5 via-blue-300/3 to-white/0", }; case "purple": return { bg: "bg-purple-50", text: "text-purple-600", gradient: "from-purple-500/5 via-purple-300/3 to-white/0", }; case "red": return { bg: "bg-red-50", text: "text-red-600", gradient: "from-red-500/5 via-red-300/3 to-white/0", }; default: return { bg: "bg-orange-50", text: "text-orange-600", gradient: "from-orange-500/5 via-orange-300/3 to-white/0", }; } }; const getRiskBars = () => { const bars = [ { height: "h-[5px]", active: riskLevel >= 1 }, { height: "h-[7px]", active: riskLevel >= 2 }, { height: "h-[11px]", active: riskLevel >= 3 }, ]; const activeColor = riskLevel === 1 ? "bg-green-500" : riskLevel === 2 ? "bg-amber-400" : "bg-red-500"; return bars.map((bar, index) => (
)); }; const getIconSrc = () => { switch (iconType) { case "us-flag-1": return "/frame-9230.svg"; case "hk-flag": return "/hk0.svg"; case "us-flag-2": return "/frame-9231.svg"; case "sg-flag": return "/frame-9230.svg"; // TODO: Add Singapore flag case "uk-flag": return "/frame-9230.svg"; // TODO: Add UK flag default: return "/frame-9230.svg"; } }; const colors = getCategoryColors(); return ( {/* Product Header */}
{/* Icon Container */}
{name}
{/* Title and Category */}

{name}

{category}
{/* Yield APY & Pool Cap */}
Yield APY {yieldAPY}
Pool Cap {poolCap}
{/* Details Section */}
{/* Maturity & Risk */}
Maturity {maturity}
Risk
{risk}
{getRiskBars()}
{/* Lock-Up & Circulating Supply */}
Lock-Up {lockUp}
Circulating supply {circulatingSupply}
{/* Pool Capacity & Invest Button */}
Pool Capacity {poolCapacityPercent}% Filled
); }