mirror of
https://github.com/FluxaMedia/fluxa-desktop.git
synced 2026-08-19 21:51:32 +00:00
Exclude search-only catalogs from discover type filter
Catalogs whose only extra is a required "search" field (e.g. an "AI Search" catalog typed as "other") aren't browsable categories — they were leaking into the type dropdown as their own tab. Also use the plural "Movies" label to match "Series".
This commit is contained in:
parent
68f2359dbc
commit
202dcfa923
2 changed files with 11 additions and 3 deletions
|
|
@ -65,7 +65,7 @@ function openPopoverMenu() {
|
|||
}
|
||||
|
||||
async function switchToSeries(user: ReturnType<typeof userEvent.setup>) {
|
||||
const typeDropdown = screen.getByText('Movie').closest('button')!;
|
||||
const typeDropdown = screen.getByText('Movies').closest('button')!;
|
||||
await user.click(typeDropdown);
|
||||
const menu = openPopoverMenu();
|
||||
await user.click(within(menu).getByText('Series'));
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ function cacheKey(catalogKey: string | null, extraName: string | null, extraValu
|
|||
return `${catalogKey ?? ''}|${extraName ?? ''}|${extraValue ?? ''}`;
|
||||
}
|
||||
|
||||
function isSearchOnlyCatalog(cat: { extra?: Array<{ name?: string; isRequired?: boolean; options?: string[] }> }): boolean {
|
||||
const extra = cat.extra ?? [];
|
||||
const requiresSearch = extra.some((e) => e.name === 'search' && e.isRequired);
|
||||
if (!requiresSearch) return false;
|
||||
return !extra.some((e) => e.name !== 'search' && e.name !== 'skip' && (e.options?.length ?? 0) > 0);
|
||||
}
|
||||
|
||||
function DiscoverScreenInner({ state, onDispatch, onNavigateDetail, initialGenre }: Props) {
|
||||
const discover = state.discover;
|
||||
const [contentType, setContentType] = useState<string>('movie');
|
||||
|
|
@ -101,12 +108,13 @@ function DiscoverScreenInner({ state, onDispatch, onNavigateDetail, initialGenre
|
|||
const types = ['movie', 'series'];
|
||||
for (const addon of state.addons?.installed ?? []) {
|
||||
for (const cat of addon.manifest?.catalogs ?? addon.catalogs ?? []) {
|
||||
if (cat.type && !types.includes(cat.type)) types.push(cat.type);
|
||||
if (!cat.type || types.includes(cat.type) || isSearchOnlyCatalog(cat)) continue;
|
||||
types.push(cat.type);
|
||||
}
|
||||
}
|
||||
return types.map((ty) => ({
|
||||
value: ty,
|
||||
label: ty === 'movie' ? t('auto.movie') : ty === 'series' ? t('auto.series') : ty.charAt(0).toUpperCase() + ty.slice(1),
|
||||
label: ty === 'movie' ? t('auto.movies') : ty === 'series' ? t('auto.series') : ty.charAt(0).toUpperCase() + ty.slice(1),
|
||||
}));
|
||||
}, [state.addons?.installed]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue