feat(torrents): keep 0day provider API-only, drop it from the UI tabs
This commit is contained in:
1 parent
1fd8f0f7e5
commit
fb645b75a5
2 files changed
+4
-19
No files matched your search
@@ -25,11 +25,5 @@ export const providers = {
|
|||||||
key: 'tlk',
|
key: 'tlk',
|
||||||
queryFn: (options: Options) => queryFn({ ...options, key: 'tlk' }),
|
queryFn: (options: Options) => queryFn({ ...options, key: 'tlk' }),
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
|
||||||
odc: {
|
|
||||||
label: '0day',
|
|
||||||
key: 'odc',
|
|
||||||
queryFn: (options: Options) => queryFn({ ...options, key: 'odc' }),
|
|
||||||
sortable: true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -52,7 +52,7 @@ const showTorrentsModal = create(({ onResolve, ...show }: Props) => {
|
|||||||
|
|
||||||
const isSeries = show.type === 'tv';
|
const isSeries = show.type === 'tv';
|
||||||
|
|
||||||
// Toloka's and 0day's searches are plain word-AND matches with no IMDB filter. For movies,
|
// Toloka's search is a plain word-AND match with no IMDB filter. For movies,
|
||||||
// scope the query by the show's year to keep, e.g., "Dune" (2021) away from "Dune: Part Two" (2024);
|
// scope the query by the show's year to keep, e.g., "Dune" (2021) away from "Dune: Part Two" (2024);
|
||||||
// for series the TV sections do the disambiguation and a year suffix would hide other seasons.
|
// for series the TV sections do the disambiguation and a year suffix would hide other seasons.
|
||||||
const scopedQuery = isSeries ? query : query && Number.isFinite(year) ? `${query} ${year}` : query;
|
const scopedQuery = isSeries ? query : query && Number.isFinite(year) ? `${query} ${year}` : query;
|
||||||
@@ -86,17 +86,8 @@ const showTorrentsModal = create(({ onResolve, ...show }: Props) => {
|
|||||||
type: show.type,
|
type: show.type,
|
||||||
show: tracked
|
show: tracked
|
||||||
});
|
});
|
||||||
const odc = useTorrents({
|
|
||||||
query: scopedQuery,
|
|
||||||
queryFn: providers.odc.queryFn,
|
|
||||||
sort,
|
|
||||||
key: providers.odc.key,
|
|
||||||
imdbID: show.imdb_id!,
|
|
||||||
type: show.type,
|
|
||||||
show: tracked
|
|
||||||
});
|
|
||||||
|
|
||||||
const queries = { yts, tpb, tlk, odc };
|
const queries = { yts, tpb, tlk };
|
||||||
|
|
||||||
const { order, ...dndProps } = useProvidersOrder();
|
const { order, ...dndProps } = useProvidersOrder();
|
||||||
|
|
||||||
@@ -126,7 +117,7 @@ const showTorrentsModal = create(({ onResolve, ...show }: Props) => {
|
|||||||
<Button
|
<Button
|
||||||
type='submit'
|
type='submit'
|
||||||
className='h-full !px-3 transition-all duration-200 hover:bg-secondary-foreground hover:shadow-lg hover:shadow-secondary-foreground/60'
|
className='h-full !px-3 transition-all duration-200 hover:bg-secondary-foreground hover:shadow-lg hover:shadow-secondary-foreground/60'
|
||||||
disabled={tpb.isPending || tlk.isPending || odc.isPending}
|
disabled={tpb.isPending || tlk.isPending}
|
||||||
>
|
>
|
||||||
<Search size={16} />
|
<Search size={16} />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -135,7 +126,7 @@ const showTorrentsModal = create(({ onResolve, ...show }: Props) => {
|
|||||||
<Tabs defaultValue={tabs[0].provider.key} className='w-full rounded-none px-2'>
|
<Tabs defaultValue={tabs[0].provider.key} className='w-full rounded-none px-2'>
|
||||||
<DndContext {...dndProps}>
|
<DndContext {...dndProps}>
|
||||||
<SortableContext items={visibleOrder} strategy={horizontalListSortingStrategy}>
|
<SortableContext items={visibleOrder} strategy={horizontalListSortingStrategy}>
|
||||||
<TabsList className={cn('grid w-full', isSeries ? 'grid-cols-3' : 'grid-cols-4')}>
|
<TabsList className={cn('grid w-full', isSeries ? 'grid-cols-2' : 'grid-cols-3')}>
|
||||||
{tabs.map(({ provider, query }) => (
|
{tabs.map(({ provider, query }) => (
|
||||||
<SortableTabsTrigger key={provider.key} provider={provider} isLoading={query.isLoading} />
|
<SortableTabsTrigger key={provider.key} provider={provider} isLoading={query.isLoading} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in new issue
Block a user