({
overview,
onFocusSymbol,
onFilterKind,
onFilterLanguage,
}: {
overview: GraphOverview | null;
onFocusSymbol: (node: Pick<GraphNode, "id" | "name">) => void;
onFilterKind: (family: string) => void;
onFilterLanguage: (language: string) => void;
})
| 36 | }; |
| 37 | |
| 38 | export default function OverviewPanel({ |
| 39 | overview, |
| 40 | onFocusSymbol, |
| 41 | onFilterKind, |
| 42 | onFilterLanguage, |
| 43 | }: { |
| 44 | overview: GraphOverview | null; |
| 45 | onFocusSymbol: (node: Pick<GraphNode, "id" | "name">) => void; |
| 46 | onFilterKind: (family: string) => void; |
| 47 | onFilterLanguage: (language: string) => void; |
| 48 | }) { |
| 49 | if (!overview) { |
| 50 | return <EmptyState>Loading graph analytics…</EmptyState>; |
| 51 | } |
| 52 | |
| 53 | // Aggregate raw kinds into visual families for the chart. |
| 54 | const familyCounts = new Map<string, number>(); |
| 55 | for (const row of overview.nodes_by_kind) { |
| 56 | const family = kindFamily(row.kind); |
| 57 | familyCounts.set(family, (familyCounts.get(family) || 0) + row.count); |
| 58 | } |
| 59 | const familyRows = [...familyCounts.entries()] |
| 60 | .sort((a, b) => b[1] - a[1]) |
| 61 | .map(([family, count]) => ({ |
| 62 | label: KIND_FAMILY_LABELS[family] || family, |
| 63 | family, |
| 64 | count, |
| 65 | })); |
| 66 | |
| 67 | return ( |
| 68 | <div className="tsg-analytics"> |
| 69 | <div className="tsg-analytics-grid"> |
| 70 | <Card> |
| 71 | <CardHeader><CardTitle>Symbols by family</CardTitle></CardHeader> |
| 72 | <CardContent> |
| 73 | <BarList |
| 74 | keyName="label" |
| 75 | rows={familyRows.map((row) => ({ |
| 76 | label: row.label, |
| 77 | color: KIND_FAMILY_COLORS[row.family] || KIND_FAMILY_COLORS.other, |
| 78 | value: fmt(row.count), |
| 79 | family: row.family, |
| 80 | }))} |
| 81 | onPick={(row) => onFilterKind(String(row.family))} |
| 82 | /> |
| 83 | <p className="tsg-chart-hint">Click a family to open the canvas filtered to it.</p> |
| 84 | </CardContent> |
| 85 | </Card> |
| 86 | |
| 87 | <Card> |
| 88 | <CardHeader><CardTitle>Files by language</CardTitle></CardHeader> |
| 89 | <CardContent> |
| 90 | <BarList |
| 91 | keyName="label" |
| 92 | rows={overview.files_by_language.slice(0, 9).map((row) => ({ |
| 93 | label: row.language, |
| 94 | color: LANGUAGE_COLORS[row.language] || "var(--ts-text-3, #6f9189)", |
| 95 | value: fmt(row.count), |
nothing calls this directly
no test coverage detected