import { money0 } from "@/lib/format";
import { EXPENSE_RATIO, feeCost30, INDEX_RATIO } from "@/lib/invest";
// A holding's expense ratio and its 30-year cost against a 0.03% index fund. Cash and money market rows show nothing.
export function HoldingFee({ ticker, type, value }: { ticker: string | null; type: string | null; value: number | null }) {
if (type === "cash" || !ticker || /^(CASH|CUR:)/.test(ticker)) return null;
const ratio = EXPENSE_RATIO[ticker.toUpperCase()];
if (ratio == null) return fee unknown;
const cost = feeCost30(Number(value ?? 0), ratio);
return (
fee {ratio}%{cost >= 1 && <> ยท = 1000 ? "text-bad" : ""}>about {money0(cost)} more over 30 years>}
);
}