@@ -13,22 +13,21 @@ import StatisticsTable from "./StatisticsTable";
1313 * ============================================================
1414 */
1515
16- /**
17- * A single header row entry in the benchmark setup table.
18- * `content` is an array per tool/runset containing tuples of:
19- * [displayTextOrPayload, colSpan].
20- */
21- type TableHeaderRow = {
22- id : string ;
23- name : string ;
24- content : Array < [ unknown , number ] > ;
25- } ;
16+ const infos = [
17+ "displayName" ,
18+ "tool" ,
19+ "limit" ,
20+ "host" ,
21+ "os" ,
22+ "system" ,
23+ "date" ,
24+ "runset" ,
25+ "branch" ,
26+ "options" ,
27+ "property" ,
28+ ] as const ;
2629
27- /**
28- * Table header structure as used by Summary.
29- * Keys are stable strings like "tool", "date", "options", ...
30- */
31- type TableHeader = Record < string , TableHeaderRow | null > ;
30+ type InfoRowId = typeof infos [ number ] ;
3231
3332/**
3433 * Payload used by the "tool" row in the header table.
@@ -41,6 +40,26 @@ type ToolVersionInfo = {
4140 version_url ?: string ;
4241} ;
4342
43+ /**
44+ * A single header cell in the benchmark setup table.
45+ * First element is the cell content, second is the colSpan.
46+ */
47+ type HeaderCell = [ string , number ] | [ ToolVersionInfo , number ] ;
48+
49+ /**
50+ * Table header row entry.
51+ */
52+ type TableHeaderRow = {
53+ id : InfoRowId ;
54+ name : string ;
55+ content : HeaderCell [ ] ;
56+ } ;
57+
58+ /**
59+ * `tableHeader` is indexed by the known `InfoRowId`s and may contain null rows.
60+ */
61+ type TableHeader = Record < InfoRowId , TableHeaderRow | null > ;
62+
4463/* ============================================================
4564 * Component Types
4665 * ============================================================
@@ -49,10 +68,10 @@ type ToolVersionInfo = {
4968type SummaryProps = {
5069 tableHeader : TableHeader ;
5170
52- // passed through to StatisticsTable (typed locally only as far as Summary needs )
53- selectColumn : ( ... args : unknown [ ] ) => void ;
71+ // passed through to StatisticsTable (keep local-first; these can be tightened later once StatisticsTable is typed )
72+ selectColumn : ( ev : React . SyntheticEvent ) => void ;
5473 tools : unknown ;
55- switchToQuantile : ( ... args : unknown [ ] ) => void ;
74+ switchToQuantile : ( quantilePreSelection : unknown ) => void ;
5675 hiddenCols : unknown ;
5776 tableData : unknown ;
5877 onStatsReady : ( ...args : unknown [ ] ) => void ;
@@ -62,29 +81,16 @@ type SummaryProps = {
6281 version : string ;
6382} ;
6483
65- const infos = [
66- "displayName" ,
67- "tool" ,
68- "limit" ,
69- "host" ,
70- "os" ,
71- "system" ,
72- "date" ,
73- "runset" ,
74- "branch" ,
75- "options" ,
76- "property" ,
77- ] as const ;
78-
7984const Summary = ( props : SummaryProps ) : React . ReactElement => {
8085 /* ++++++++++++++ Helper functions ++++++++++++++ */
8186
82- const renderOptions = ( text : string ) : React . ReactNode =>
83- text . split ( / [ \s ] + - / ) . map ( ( option , i ) => (
87+ const renderOptions = ( text : string ) : React . ReactNode => {
88+ return text . split ( / [ \s ] + - / ) . map ( ( option , i ) => (
8489 < li key = { option } >
8590 < code > { i === 0 ? option : `-${ option } ` } </ code >
8691 </ li >
8792 ) ) ;
93+ } ;
8894
8995 const externalLink = (
9096 url : string | undefined ,
@@ -117,13 +123,13 @@ const Summary = (props: SummaryProps): React.ReactElement => {
117123 /* ++++++++++++++ Table render functions ++++++++++++++ */
118124
119125 const renderRow = (
120- row : string ,
121- text : unknown ,
122- colSpan : number ,
126+ row : InfoRowId ,
127+ cell : HeaderCell ,
123128 j : number ,
124129 ) : React . ReactElement => {
125130 const isOptionRow = row === "options" ;
126131 const isToolRow = row === "tool" ;
132+ const [ text , colSpan ] = cell ;
127133
128134 return (
129135 < td
@@ -154,9 +160,7 @@ const Summary = (props: SummaryProps): React.ReactElement => {
154160 . map ( ( row ) => (
155161 < tr key = { "tr-" + row . id } className = { row . id } >
156162 < th key = { "td-" + row . id } > { row . name } </ th >
157- { row . content . map ( ( tool , j ) =>
158- renderRow ( row . id , tool [ 0 ] , tool [ 1 ] , j ) ,
159- ) }
163+ { row . content . map ( ( cell , j ) => renderRow ( row . id , cell , j ) ) }
160164 </ tr >
161165 ) ) }
162166 </ tbody >
0 commit comments