feat(dashboard): add company filter — switch between portfolio overview and single company view

This commit is contained in:
selfrelease
2026-07-19 21:52:40 +08:00
parent a24ccd01c7
commit 0197f89018
2 changed files with 46 additions and 12 deletions
@@ -155,16 +155,19 @@ export function HealthTrends({ companyId }: { companyId?: string }) {
</div>
);
}
export function HealthHeatmap() {
export function HealthHeatmap({ companyId }: { companyId?: string }) {
const [data, setData] = useState<HeatmapRow[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
apiFetch<HeatmapRow[]>("/dashboard/heatmap")
.then((res) => setData((res.data as HeatmapRow[]) || []))
.then((res) => {
const rows = (res.data as HeatmapRow[]) || [];
setData(companyId ? rows.filter((r) => r.company_id === companyId) : rows);
})
.catch(() => {})
.finally(() => setLoading(false));
}, []);
}, [companyId]);
if (loading) return <LoadingSpinner />;
if (!data.length) return <EmptyState title="暂无热力图数据" />;