fix: removed torrent provider auto select

This commit is contained in:
ner committed 2024-10-29 09:11:36 +02:00
1 parent 62791957bf
commit 0e146b0c53
2 files changed
+5 -26

No files matched your search

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import React, { useState } from 'react';
import { create, InstanceProps } from 'react-modal-promise';
import { TabsContent } from '@radix-ui/react-tabs';
import { Loader } from 'lucide-react';
@@ -22,9 +22,6 @@ interface Props extends InstanceProps<void> {
const showTorrentsModal = create(({ title, year, imdbID, backdrop, onResolve }: Props) => {
const [sort, setSort] = useState<Sort>(Sort.seeds);
const [withYear, setWithYear] = useState(true);
const [providerKey, setProviderKey] = useState(providers.yts.key);
const nextProviderKeyRef = useRef<string | null>(null);
const yts = useTorrents({ query: title, queryFn: providers.yts.queryFn, sort, key: providers.yts.key, imdbID });
const tpb = useTorrents({
@@ -60,13 +57,6 @@ const showTorrentsModal = create(({ title, year, imdbID, backdrop, onResolve }:
const checkIsEmpty = (query: (typeof tabs)[number]['query']) =>
query.isFetched && !query.isLoading && !query.data?.length;
useEffect(() => {
if (!nextProviderKeyRef.current || providerKey === nextProviderKeyRef.current) return;
setProviderKey(nextProviderKeyRef.current);
nextProviderKeyRef.current = null;
}, [providerKey, yts.isFetched, tpb.isFetched]);
return (
<Modal className='rounded-xl p-0' onClose={onResolve}>
<div className='grid grid-cols-[1fr_auto] items-center gap-3 p-2'>
@@ -75,28 +65,17 @@ const showTorrentsModal = create(({ title, year, imdbID, backdrop, onResolve }:
{year}
</Button>
</div>
<Tabs value={providerKey} className='w-full rounded-none'>
<Tabs defaultValue={providers.yts.key} className='w-full rounded-none'>
<TabsList className='grid w-full grid-cols-3'>
{tabs.map(({ provider, query }) => (
<TabsTrigger
disabled={checkIsEmpty(query)}
key={provider.key}
value={provider.key}
onClick={() => setProviderKey(provider.key)}
>
{provider.label}
<TabsTrigger key={provider.key} value={provider.key}>
{query.isLoading ? <Loader className='animate-spin' size={14} /> : provider.label}
</TabsTrigger>
))}
</TabsList>
{tabs.map(({ provider, query }, index) => {
const nextIndex = index + 1;
const isEmpty = checkIsEmpty(query);
if (isEmpty && tabs[nextIndex]) {
nextProviderKeyRef.current = tabs[nextIndex].provider.key;
}
return (
<TabsContent className='pb-1' key={provider.key} value={provider.key}>
<TorrentsTable
+1 -1
View File
@@ -1 +1 @@
if(!self.define){let e,s={};const n=(n,t)=>(n=new URL(n+".js",t).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(t,a)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let c={};const r=e=>n(e,i),o={module:{uri:i},exports:c,require:r};s[i]=Promise.all(t.map((e=>o[e]||r(e)))).then((e=>(a(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"7e72fe164f6adb40a3a4dbe568ee7015"},{url:"/_next/static/00z-0HQ3qA9f5V2C5qbov/_buildManifest.js",revision:"2ec694eb52ae4f523f265a46bae4d768"},{url:"/_next/static/00z-0HQ3qA9f5V2C5qbov/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/152.b96372f7a5392cef.js",revision:"b96372f7a5392cef"},{url:"/_next/static/chunks/209-6e564299ff7a6e7c.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/23-e95fe3862375276d.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/26.286553a5ff2812fc.js",revision:"286553a5ff2812fc"},{url:"/_next/static/chunks/276.c3c1130f2adade69.js",revision:"c3c1130f2adade69"},{url:"/_next/static/chunks/344.05938a041227e582.js",revision:"05938a041227e582"},{url:"/_next/static/chunks/348-5d259ade7b0671f4.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/383.78d47f7582340f53.js",revision:"78d47f7582340f53"},{url:"/_next/static/chunks/460.ac20021c7496f1d6.js",revision:"ac20021c7496f1d6"},{url:"/_next/static/chunks/497.48f1dfd129122432.js",revision:"48f1dfd129122432"},{url:"/_next/static/chunks/61.e269d4a699fba0b6.js",revision:"e269d4a699fba0b6"},{url:"/_next/static/chunks/621-fa4d2ff1cf645813.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/671-a5dd76385a5ca3dc.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/673.362c29137dd3e968.js",revision:"362c29137dd3e968"},{url:"/_next/static/chunks/695.156d21364de6e419.js",revision:"156d21364de6e419"},{url:"/_next/static/chunks/734-18050d0326d4613b.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/755.5cd959eac5682527.js",revision:"5cd959eac5682527"},{url:"/_next/static/chunks/792.b51012549074b93f.js",revision:"b51012549074b93f"},{url:"/_next/static/chunks/810.6105e84414768b0d.js",revision:"6105e84414768b0d"},{url:"/_next/static/chunks/922.9ce4bf0553cfb724.js",revision:"9ce4bf0553cfb724"},{url:"/_next/static/chunks/app/(site)/favorites/page-427f58e0c5275c4d.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/loading-96645736797edde7.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/page-23887b70b5ed4e87.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/popular/page-0720e0237298a840.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/similar/page-ad60f04bbf0d615a.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/starring/page-e41794b0a9c73728.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/top/page-30fe3aaa34e8e41d.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/(site)/watch-list/page-793228b9c3abb45d.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/_not-found/page-aa0c8e90320336c2.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/app/layout-1fda80c361f5ee15.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/c8bcbd21.63daf74955ffea8b.js",revision:"63daf74955ffea8b"},{url:"/_next/static/chunks/fd9d1056-bdf7d185613ab264.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/framework-f66176bb897dc684.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/main-a339d49e77d6dbd3.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/main-app-51cdaff1a81e6b49.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/pages/_app-6a626577ffa902a4.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/pages/_error-1be831200e60c5c0.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-c50673da9d5d6a15.js",revision:"00z-0HQ3qA9f5V2C5qbov"},{url:"/_next/static/css/0d5f6452b2682b9b.css",revision:"0d5f6452b2682b9b"},{url:"/_next/static/css/30fc28b4ca88767d.css",revision:"30fc28b4ca88767d"},{url:"/_next/static/media/a9b1453781eac9e6-s.p.woff2",revision:"c754cf60aba699077f00948285bf54b5"},{url:"/_next/static/media/dd843ebd3ff03195-s.p.woff2",revision:"333341dc4117f45b7fcee6b5223a56db"},{url:"/_next/static/media/e9ecf55e71a874cd-s.woff2",revision:"62348655e2d5baed97a39f0590491d09"},{url:"/apple-touch-icon.png",revision:"6ed7ad7Line truncated
if(!self.define){let e,s={};const n=(n,c)=>(n=new URL(n+".js",c).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(c,t)=>{const a=e||("document"in self?document.currentScript.src:"")||location.href;if(s[a])return;let i={};const r=e=>n(e,a),o={module:{uri:a},exports:i,require:r};s[a]=Promise.all(c.map((e=>o[e]||r(e)))).then((e=>(t(...e),i)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"5812ec1ca057a0a6bf317441ccea2cc9"},{url:"/_next/static/MVsrTry_nXCkHMcSk6hgv/_buildManifest.js",revision:"2ec694eb52ae4f523f265a46bae4d768"},{url:"/_next/static/MVsrTry_nXCkHMcSk6hgv/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/152.b96372f7a5392cef.js",revision:"b96372f7a5392cef"},{url:"/_next/static/chunks/209-6e564299ff7a6e7c.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/23-e95fe3862375276d.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/26.286553a5ff2812fc.js",revision:"286553a5ff2812fc"},{url:"/_next/static/chunks/276.c3c1130f2adade69.js",revision:"c3c1130f2adade69"},{url:"/_next/static/chunks/344.05938a041227e582.js",revision:"05938a041227e582"},{url:"/_next/static/chunks/348-3c2fdb85e94bcc15.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/383.78d47f7582340f53.js",revision:"78d47f7582340f53"},{url:"/_next/static/chunks/460.ac20021c7496f1d6.js",revision:"ac20021c7496f1d6"},{url:"/_next/static/chunks/497.48f1dfd129122432.js",revision:"48f1dfd129122432"},{url:"/_next/static/chunks/61.e269d4a699fba0b6.js",revision:"e269d4a699fba0b6"},{url:"/_next/static/chunks/621-fa4d2ff1cf645813.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/671-a5dd76385a5ca3dc.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/673.362c29137dd3e968.js",revision:"362c29137dd3e968"},{url:"/_next/static/chunks/695.156d21364de6e419.js",revision:"156d21364de6e419"},{url:"/_next/static/chunks/734-18050d0326d4613b.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/755.5cd959eac5682527.js",revision:"5cd959eac5682527"},{url:"/_next/static/chunks/792.b51012549074b93f.js",revision:"b51012549074b93f"},{url:"/_next/static/chunks/810.6105e84414768b0d.js",revision:"6105e84414768b0d"},{url:"/_next/static/chunks/922.9ce4bf0553cfb724.js",revision:"9ce4bf0553cfb724"},{url:"/_next/static/chunks/app/(site)/favorites/page-427f58e0c5275c4d.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/loading-96645736797edde7.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/page-23887b70b5ed4e87.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/popular/page-0720e0237298a840.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/similar/page-ad60f04bbf0d615a.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/starring/page-e41794b0a9c73728.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/top/page-30fe3aaa34e8e41d.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/(site)/watch-list/page-793228b9c3abb45d.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/_not-found/page-aa0c8e90320336c2.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/app/layout-1fda80c361f5ee15.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/c8bcbd21.63daf74955ffea8b.js",revision:"63daf74955ffea8b"},{url:"/_next/static/chunks/fd9d1056-bdf7d185613ab264.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/framework-f66176bb897dc684.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/main-a339d49e77d6dbd3.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/main-app-51cdaff1a81e6b49.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/pages/_app-6a626577ffa902a4.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/pages/_error-1be831200e60c5c0.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-c50673da9d5d6a15.js",revision:"MVsrTry_nXCkHMcSk6hgv"},{url:"/_next/static/css/0d5f6452b2682b9b.css",revision:"0d5f6452b2682b9b"},{url:"/_next/static/css/30fc28b4ca88767d.css",revision:"30fc28b4ca88767d"},{url:"/_next/static/media/a9b1453781eac9e6-s.p.woff2",revision:"c754cf60aba699077f00948285bf54b5"},{url:"/_next/static/media/dd843ebd3ff03195-s.p.woff2",revision:"333341dc4117f45b7fcee6b5223a56db"},{url:"/_next/static/media/e9ecf55e71a874cd-s.woff2",revision:"62348655e2d5baed97a39f0590491d09"},{url:"/apple-touch-icon.png",revision:"6ed7ad7Line truncated