"use client"; import { cn } from "@/lib/utils"; import { TrendingUp, TrendingDown, Wallet, PieChart } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ChainIcon } from "./ChainIcon"; import type { PortfolioSummary as PortfolioSummaryType, PortfolioToken } from "@/lib/mock/cryptoMockData"; import { formatPrice, formatPercent, formatLargeNumber } from "@/lib/mock/cryptoMockData"; interface PortfolioSummaryProps { portfolio: PortfolioSummaryType; className?: string; } function StatCard({ label, value, change, changePercent, }: { label: string; value: string; change?: number; changePercent?: number; }) { const isPositive = change !== undefined && change > 0; const isNegative = change !== undefined && change < 0; return (

{label}

{value}

{change !== undefined && changePercent !== undefined && (
{isPositive && } {isNegative && } {formatPrice(Math.abs(change))} ({formatPercent(changePercent)})
)}
); } function TokenRow({ token }: { token: PortfolioToken }) { const isPositive = token.pnl > 0; const isNegative = token.pnl < 0; return (
{token.symbol}
{token.amount.toLocaleString()} tokens
{formatPrice(token.value)}
{formatPercent(token.pnlPercent)}
{token.allocation.toFixed(1)}%
); } export function PortfolioSummary({ portfolio, className }: PortfolioSummaryProps) { return ( Portfolio {/* Summary Stats */}
{/* Token Holdings */}
Holdings
{portfolio.tokens.map((token) => ( ))}
); }