@@ -46,9 +46,6 @@ const columnHelper = createColumnHelper<AnnotationSummary>();
4646
4747export const LabelingSummary = ( { hideInfo, annotations : all , controls, onSelect } : Props ) => {
4848 const currentUser = window . APP_SETTINGS ?. user ;
49- const [ showEmpty , setShowEmpty ] = useState ( true ) ;
50- const [ countEmpty , setCountEmpty ] = useState ( false ) ;
51- const [ popularFirst , setPopularFirst ] = useState ( false ) ;
5249 const [ columnWidths , setColumnWidths ] = useState < Record < string , number > > ( { } ) ;
5350 const tableRef = useRef < HTMLTableElement > ( null ) ;
5451
@@ -70,42 +67,14 @@ export const LabelingSummary = ({ hideInfo, annotations: all, controls, onSelect
7067 : ( annotation . versions . result ?? [ ] ) ,
7168 } ) ) ;
7269
73- // Filter and sort controls based on toggles
74- const processedControls = useMemo ( ( ) => {
75- let result = [ ...controls ] ;
76-
77- // Filter out empty columns if showEmpty is false
78- if ( ! showEmpty ) {
79- result = result . filter ( ( control ) => {
80- const hasResults = annotations . some ( ( ann ) => ann . results . some ( ( r ) => r . from_name === control . name ) ) ;
81- return hasResults ;
82- } ) ;
83- }
84-
85- // Sort by popularity if enabled
86- if ( popularFirst ) {
87- result = result . sort ( ( a , b ) => {
88- const aCount = annotations . reduce ( ( sum , ann ) => {
89- return sum + ann . results . filter ( ( r ) => r . from_name === a . name ) . length ;
90- } , 0 ) ;
91- const bCount = annotations . reduce ( ( sum , ann ) => {
92- return sum + ann . results . filter ( ( r ) => r . from_name === b . name ) . length ;
93- } , 0 ) ;
94- return bCount - aCount ;
95- } ) ;
96- }
97-
98- return result ;
99- } , [ controls , annotations , showEmpty , popularFirst ] ) ;
100-
10170 // Measure initial column widths after first render
10271 useEffect ( ( ) => {
10372 if ( tableRef . current && Object . keys ( columnWidths ) . length === 0 ) {
10473 const headers = tableRef . current . querySelectorAll ( "thead th" ) ;
10574 const widths : Record < string , number > = { } ;
10675
10776 headers . forEach ( ( header , index ) => {
108- const columnId = index === 0 ? "id" : processedControls [ index - 1 ] ?. name ;
77+ const columnId = index === 0 ? "id" : controls [ index - 1 ] ?. name ;
10978 if ( columnId ) {
11079 // Get the computed width
11180 const width = header . getBoundingClientRect ( ) . width ;
@@ -115,10 +84,10 @@ export const LabelingSummary = ({ hideInfo, annotations: all, controls, onSelect
11584
11685 setColumnWidths ( widths ) ;
11786 }
118- } , [ processedControls , columnWidths ] ) ;
87+ } , [ controls , columnWidths ] ) ;
11988
12089 const columns = useMemo ( ( ) => {
121- const columns : ColumnDef < AnnotationSummary , unknown > [ ] = processedControls . map ( ( control ) =>
90+ const columns : ColumnDef < AnnotationSummary , unknown > [ ] = controls . map ( ( control ) =>
12291 columnHelper . display ( {
12392 id : control . name ,
12493 header : ( ) => (
@@ -165,7 +134,7 @@ export const LabelingSummary = ({ hideInfo, annotations: all, controls, onSelect
165134 } ,
166135 } ) ;
167136 return columns ;
168- } , [ processedControls , onSelect , hideInfo , columnWidths ] ) ;
137+ } , [ controls , onSelect , hideInfo , columnWidths ] ) ;
169138
170139 const table = useReactTable < AnnotationSummary > ( {
171140 data : annotations ,
@@ -182,37 +151,6 @@ export const LabelingSummary = ({ hideInfo, annotations: all, controls, onSelect
182151
183152 return (
184153 < div className = "mb-base" >
185- { /* Controls */ }
186- < div className = "hidden gap-base mb-base p-tight bg-neutral-surface-subtle border border-neutral-border rounded-small" >
187- < label className = "flex items-center gap-2 cursor-pointer hover:bg-neutral-surface px-2 py-1 rounded-small transition-colors" >
188- < input
189- type = "checkbox"
190- checked = { showEmpty }
191- onChange = { ( e ) => setShowEmpty ( e . target . checked ) }
192- className = "cursor-pointer"
193- />
194- < span className = "text-sm font-medium" > Show empty</ span >
195- </ label >
196- < label className = "flex items-center gap-2 cursor-pointer hover:bg-neutral-surface px-2 py-1 rounded-small transition-colors" >
197- < input
198- type = "checkbox"
199- checked = { countEmpty }
200- onChange = { ( e ) => setCountEmpty ( e . target . checked ) }
201- className = "cursor-pointer"
202- />
203- < span className = "text-sm font-medium" > Count empty</ span >
204- </ label >
205- < label className = "flex items-center gap-2 cursor-pointer hover:bg-neutral-surface px-2 py-1 rounded-small transition-colors" >
206- < input
207- type = "checkbox"
208- checked = { popularFirst }
209- onChange = { ( e ) => setPopularFirst ( e . target . checked ) }
210- className = "cursor-pointer"
211- />
212- < span className = "text-sm font-medium" > Popular first</ span >
213- </ label >
214- </ div >
215-
216154 < div className = "overflow-x-auto pb-tight" >
217155 < table
218156 ref = { tableRef }
@@ -257,9 +195,8 @@ export const LabelingSummary = ({ hideInfo, annotations: all, controls, onSelect
257195 { /* Distribution/Aggregation Row */ }
258196 < AggregationTableRow
259197 headers = { table . getHeaderGroups ( ) [ 0 ] ?. headers ?? [ ] }
260- processedControls = { processedControls }
198+ controls = { controls }
261199 annotations = { annotations }
262- countEmpty = { countEmpty }
263200 />
264201 { /* Annotation Rows */ }
265202 { table . getRowModel ( ) . rows . map ( ( row , rowIndex ) => (
0 commit comments