Skip to content

Commit b5d1361

Browse files
committed
formatting
1 parent 3430473 commit b5d1361

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

src/pages/DandiPage/experimentalSearch/ExperimentalSearchPanel.tsx

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ export const ExperimentalSearchPanel: FunctionComponent<
8888
name,
8989
count: searchData.contactPersons.reduce(
9090
(acc, person) => acc + (person.species.includes(name) ? 1 : 0),
91-
0
91+
0,
9292
),
9393
}));
9494
}
9595

9696
// When a contact person is selected, show only their species
9797
const person = searchData.contactPersons.find(
98-
(p) => p.name === filter.contactPerson
98+
(p) => p.name === filter.contactPerson,
9999
);
100100
if (!person) return [];
101101

@@ -110,23 +110,31 @@ export const ExperimentalSearchPanel: FunctionComponent<
110110
// Clear species if not available for current contact person
111111
if (filter.species !== "<not specified>" && availableSpecies.length > 0) {
112112
const isSpeciesAvailable = availableSpecies.some(
113-
(s) => s.name === filter.species
113+
(s) => s.name === filter.species,
114114
);
115115
if (!isSpeciesAvailable) {
116116
setFilter((f) => ({ ...f, species: "<not specified>" }));
117117
}
118118
}
119119

120120
// 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+
) {
122125
const isPersonAvailable = availableContactPersons.some(
123-
(p) => p.name === filter.contactPerson
126+
(p) => p.name === filter.contactPerson,
124127
);
125128
if (!isPersonAvailable) {
126129
setFilter((f) => ({ ...f, contactPerson: "<not specified>" }));
127130
}
128131
}
129-
}, [filter.species, filter.contactPerson, availableSpecies, availableContactPersons]);
132+
}, [
133+
filter.species,
134+
filter.contactPerson,
135+
availableSpecies,
136+
availableContactPersons,
137+
]);
130138

131139
useEffect(() => {
132140
if (setDandisetIds) {
@@ -251,7 +259,9 @@ const result = {
251259
interface.print("<>" + JSON.stringify(result, null, 2) + "</>");
252260
`;
253261

254-
const [searchData, setSearchData] = useState<SearchData | undefined>(undefined);
262+
const [searchData, setSearchData] = useState<SearchData | undefined>(
263+
undefined,
264+
);
255265

256266
useEffect(() => {
257267
if (!jobRunnerClient) return;
@@ -280,29 +290,41 @@ interface.print("<>" + JSON.stringify(result, null, 2) + "</>");
280290
return { searchData };
281291
};
282292

283-
const useFilteredDandisets = (searchData: SearchData | undefined, filter: Filter) => {
293+
const useFilteredDandisets = (
294+
searchData: SearchData | undefined,
295+
filter: Filter,
296+
) => {
284297
return useMemo(() => {
285298
if (!searchData) return [];
286299

287300
// 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+
) {
289305
return [];
290306
}
291307

292308
return searchData.dandisetInfo
293-
.filter(info => {
309+
.filter((info) => {
294310
// 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+
) {
296315
return false;
297316
}
298317

299318
// 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+
) {
301323
return false;
302324
}
303325

304326
return true;
305327
})
306-
.map(info => info.id);
328+
.map((info) => info.id);
307329
}, [searchData, filter.contactPerson, filter.species]);
308330
};

0 commit comments

Comments
 (0)