feat: Better Jellyseerr search results #586

- fetch 4 pages at once to maximize search results
- add local sorting options
This commit is contained in:
herrrta
2025-03-05 00:32:30 -05:00
parent 4dddc0f926
commit e397be4b2e
17 changed files with 264 additions and 118 deletions

View File

@@ -13,7 +13,7 @@ interface FilterButtonProps<T> extends ViewProps {
title: string;
set: (value: T[]) => void;
queryFn: (params: any) => Promise<any>;
searchFilter: (item: T, query: string) => boolean;
searchFilter?: (item: T, query: string) => boolean;
renderItemLabel: (item: T) => React.ReactNode;
icon?: "filter" | "sort";
}

View File

@@ -28,7 +28,7 @@ interface Props<T> extends ViewProps {
values: T[];
set: (value: T[]) => void;
title: string;
searchFilter: (item: T, query: string) => boolean;
searchFilter?: (item: T, query: string) => boolean;
renderItemLabel: (item: T) => React.ReactNode;
showSearch?: boolean;
}
@@ -88,7 +88,7 @@ export const FilterSheet = <T,>({
if (!search) return _data;
const results = [];
for (let i = 0; i < (_data?.length || 0); i++) {
if (_data && searchFilter(_data[i], search)) {
if (_data && searchFilter?.(_data[i], search)) {
results.push(_data[i]);
}
}