blob: e04f583b8338382a0f0d129f73d1757d28f267bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import { Container } from "@mantine/core";
import { useDocumentTitle } from "@mantine/hooks";
import { faSearch } from "@fortawesome/free-solid-svg-icons";
import { ColumnDef } from "@tanstack/react-table";
import { useIsAnyActionRunning } from "@/apis/hooks";
import { UsePaginationQueryResult } from "@/apis/queries/hooks";
import { QueryPageTable, Toolbox } from "@/components";
interface Props<T extends Wanted.Base> {
name: string;
columns: ColumnDef<T>[];
query: UsePaginationQueryResult<T>;
searchAll: () => Promise<void>;
}
function WantedView<T extends Wanted.Base>({
name,
columns,
query,
searchAll,
}: Props<T>) {
const dataCount = query.paginationStatus.totalCount;
const hasTask = useIsAnyActionRunning();
useDocumentTitle(`Wanted ${name} - Bazarr`);
return (
<Container fluid px={0}>
<Toolbox>
<Toolbox.Button
disabled={hasTask || dataCount === 0}
onClick={searchAll}
icon={faSearch}
>
Search All
</Toolbox.Button>
</Toolbox>
<QueryPageTable
tableStyles={{ emptyText: `No missing ${name} subtitles` }}
query={query}
columns={columns}
></QueryPageTable>
</Container>
);
}
export default WantedView;
|