import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/Card"; import { formatCurrency } from "@/lib/format"; import { useTranslation, type TranslationKey } from "@/lib/i18n"; import type { RiskLevelSummary } from "@/types"; interface RiskAllocationCardProps { riskLevels: RiskLevelSummary[]; isLoading: boolean; } export function RiskAllocationCard({ riskLevels, isLoading }: RiskAllocationCardProps) { const { t } = useTranslation(); return ( {t("netWorth.riskAllocationTitle")} {isLoading ? (

{t("common.loading")}

) : (
{riskLevels.map((tier) => (

{t(`netWorth.riskLevel.${tier.risk_level}` as TranslationKey)}

{formatCurrency(tier.total_value)}

{tier.percent.toFixed(0)}% {t("netWorth.riskAllocationOfCapital")}

{tier.items.length > 0 && (
    {tier.items.map((item) => (
  • {item.key === "cash" ? t("netWorth.assetClass.cash") : item.name} {item.percent.toFixed(0)}%
  • ))}
)}
))}
)}
); }