"use client"; interface Asset { symbol: string; value: number; color: string; } interface AssetDistributionProps { assets: Asset[]; totalValue: number; } export function AssetDistribution({ assets, totalValue }: AssetDistributionProps) { const sortedAssets = [...assets].sort((a, b) => b.value - a.value); const total = assets.reduce((sum, asset) => sum + asset.value, 0); return (

Asset Distribution

{sortedAssets.map((asset, index) => { const percentage = (asset.value / total) * 100; const previousPercentages = sortedAssets .slice(0, index) .reduce((sum, a) => sum + (a.value / total) * 100, 0); const strokeDasharray = `${percentage * 5.024} ${100 * 5.024}`; const strokeDashoffset = -previousPercentages * 5.024; return ( ); })}
${totalValue.toLocaleString()}
Total Value
{sortedAssets.map((asset) => (
{asset.symbol}
${asset.value.toLocaleString()}
{((asset.value / total) * 100).toFixed(1)}%
))}
); }