fix: yts queries without year
This commit is contained in:
1 parent
4b262bc1d6
commit
8263a4abd4
1 file changed
+7
-17
@@ -51,17 +51,19 @@ const providers = [
|
|||||||
const Torrents: FC<Props> = ({ title, year, type, id, onResolve }) => {
|
const Torrents: FC<Props> = ({ title, year, type, id, onResolve }) => {
|
||||||
const isMobile = matchMedia('(max-width: 600px)').matches;
|
const isMobile = matchMedia('(max-width: 600px)').matches;
|
||||||
const prefix = usePrefix();
|
const prefix = usePrefix();
|
||||||
const [sorting, setSorting] = useState<Sort>(Sort.seeds);
|
const [sort, setSort] = useState<Sort>(Sort.seeds);
|
||||||
const [withYear, setWithYear] = useState(true);
|
const [withYear, setWithYear] = useState(true);
|
||||||
const [{ key, queryFn, sortable }, setProvider] = useState(providers[0]);
|
const [{ key, queryFn, sortable }, setProvider] = useState(providers[0]);
|
||||||
|
|
||||||
|
const query = key === 'yts' ? title : withYear ? `${title} ${year || ''}` : title;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: torrents,
|
data: torrents,
|
||||||
isLoading,
|
isLoading,
|
||||||
isFetched
|
isFetched
|
||||||
} = useTorrents({
|
} = useTorrents({
|
||||||
query: withYear ? `${title} ${year || ''}` : title,
|
query,
|
||||||
sort: sorting,
|
sort,
|
||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
key,
|
key,
|
||||||
@@ -104,20 +106,8 @@ const Torrents: FC<Props> = ({ title, year, type, id, onResolve }) => {
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
{!isMobile && <TableHead className='px-2'>Title</TableHead>}
|
{!isMobile && <TableHead className='px-2'>Title</TableHead>}
|
||||||
<TableHeadSortable
|
<TableHeadSortable sortable={sortable} title='Size' sort={Sort.size} value={sort} onChange={setSort} />
|
||||||
sortable={sortable}
|
<TableHeadSortable sortable={sortable} title='Seeders' sort={Sort.seeds} value={sort} onChange={setSort} />
|
||||||
title='Size'
|
|
||||||
sort={Sort.size}
|
|
||||||
value={sorting}
|
|
||||||
onChange={setSorting}
|
|
||||||
/>
|
|
||||||
<TableHeadSortable
|
|
||||||
sortable={sortable}
|
|
||||||
title='Seeders'
|
|
||||||
sort={Sort.seeds}
|
|
||||||
value={sorting}
|
|
||||||
onChange={setSorting}
|
|
||||||
/>
|
|
||||||
<TableHead className='px-2 cursor-pointer select-none' onClick={() => showHostManagerModal()} />
|
<TableHead className='px-2 cursor-pointer select-none' onClick={() => showHostManagerModal()} />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
|
|||||||
Reference in new issue
Block a user