import { useMemo, useState } from "react";
import { api, type CapitalAccount, type Entity, type PortalDocument } from "../api";
import { categoryLabel, formatDate, formatMoneyExact } from "../format";
import CapitalChart, { type CapitalPoint } from "../components/CapitalChart";
// The investor-facing portal, rendered purely from data. Used by the investor's own home
// (InvestorHome) and by the admin read-only Investor View, so both show exactly the same thing.
export default function InvestorPortalView({
entities,
accounts,
docs,
}: {
entities: Entity[];
accounts: CapitalAccount[];
docs: PortalDocument[];
}) {
if (entities.length === 0) {
return (
No fund access yet.
);
}
// When this login covers several legal names (e.g. an IRA and a trust), label each block.
const showNames = new Set(accounts.map((a) => a.investor_user_id)).size > 1;
return (