@@ -88,14 +88,14 @@ export const ExperimentalSearchPanel: FunctionComponent<
88
88
name,
89
89
count : searchData . contactPersons . reduce (
90
90
( acc , person ) => acc + ( person . species . includes ( name ) ? 1 : 0 ) ,
91
- 0
91
+ 0 ,
92
92
) ,
93
93
} ) ) ;
94
94
}
95
95
96
96
// When a contact person is selected, show only their species
97
97
const person = searchData . contactPersons . find (
98
- ( p ) => p . name === filter . contactPerson
98
+ ( p ) => p . name === filter . contactPerson ,
99
99
) ;
100
100
if ( ! person ) return [ ] ;
101
101
@@ -110,23 +110,31 @@ export const ExperimentalSearchPanel: FunctionComponent<
110
110
// Clear species if not available for current contact person
111
111
if ( filter . species !== "<not specified>" && availableSpecies . length > 0 ) {
112
112
const isSpeciesAvailable = availableSpecies . some (
113
- ( s ) => s . name === filter . species
113
+ ( s ) => s . name === filter . species ,
114
114
) ;
115
115
if ( ! isSpeciesAvailable ) {
116
116
setFilter ( ( f ) => ( { ...f , species : "<not specified>" } ) ) ;
117
117
}
118
118
}
119
119
120
120
// Clear contact person if not available for current species
121
- if ( filter . contactPerson !== "<not specified>" && availableContactPersons . length > 0 ) {
121
+ if (
122
+ filter . contactPerson !== "<not specified>" &&
123
+ availableContactPersons . length > 0
124
+ ) {
122
125
const isPersonAvailable = availableContactPersons . some (
123
- ( p ) => p . name === filter . contactPerson
126
+ ( p ) => p . name === filter . contactPerson ,
124
127
) ;
125
128
if ( ! isPersonAvailable ) {
126
129
setFilter ( ( f ) => ( { ...f , contactPerson : "<not specified>" } ) ) ;
127
130
}
128
131
}
129
- } , [ filter . species , filter . contactPerson , availableSpecies , availableContactPersons ] ) ;
132
+ } , [
133
+ filter . species ,
134
+ filter . contactPerson ,
135
+ availableSpecies ,
136
+ availableContactPersons ,
137
+ ] ) ;
130
138
131
139
useEffect ( ( ) => {
132
140
if ( setDandisetIds ) {
@@ -251,7 +259,9 @@ const result = {
251
259
interface.print("<>" + JSON.stringify(result, null, 2) + "</>");
252
260
` ;
253
261
254
- const [ searchData , setSearchData ] = useState < SearchData | undefined > ( undefined ) ;
262
+ const [ searchData , setSearchData ] = useState < SearchData | undefined > (
263
+ undefined ,
264
+ ) ;
255
265
256
266
useEffect ( ( ) => {
257
267
if ( ! jobRunnerClient ) return ;
@@ -280,29 +290,41 @@ interface.print("<>" + JSON.stringify(result, null, 2) + "</>");
280
290
return { searchData } ;
281
291
} ;
282
292
283
- const useFilteredDandisets = ( searchData : SearchData | undefined , filter : Filter ) => {
293
+ const useFilteredDandisets = (
294
+ searchData : SearchData | undefined ,
295
+ filter : Filter ,
296
+ ) => {
284
297
return useMemo ( ( ) => {
285
298
if ( ! searchData ) return [ ] ;
286
299
287
300
// If no filters are set, return empty array
288
- if ( filter . contactPerson === "<not specified>" && filter . species === "<not specified>" ) {
301
+ if (
302
+ filter . contactPerson === "<not specified>" &&
303
+ filter . species === "<not specified>"
304
+ ) {
289
305
return [ ] ;
290
306
}
291
307
292
308
return searchData . dandisetInfo
293
- . filter ( info => {
309
+ . filter ( ( info ) => {
294
310
// Filter by contact person
295
- if ( filter . contactPerson !== "<not specified>" && info . contactPerson !== filter . contactPerson ) {
311
+ if (
312
+ filter . contactPerson !== "<not specified>" &&
313
+ info . contactPerson !== filter . contactPerson
314
+ ) {
296
315
return false ;
297
316
}
298
317
299
318
// Filter by species
300
- if ( filter . species !== "<not specified>" && ! info . species . includes ( filter . species ) ) {
319
+ if (
320
+ filter . species !== "<not specified>" &&
321
+ ! info . species . includes ( filter . species )
322
+ ) {
301
323
return false ;
302
324
}
303
325
304
326
return true ;
305
327
} )
306
- . map ( info => info . id ) ;
328
+ . map ( ( info ) => info . id ) ;
307
329
} , [ searchData , filter . contactPerson , filter . species ] ) ;
308
330
} ;
0 commit comments