You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
2 years ago
|
import { useIsAnyActionRunning } from "@/apis/hooks";
|
||
|
import { UsePaginationQueryResult } from "@/apis/queries/hooks";
|
||
2 years ago
|
import { QueryPageTable, Toolbox } from "@/components";
|
||
2 years ago
|
import { faSearch } from "@fortawesome/free-solid-svg-icons";
|
||
2 years ago
|
import { Container } from "@mantine/core";
|
||
|
import { useDocumentTitle } from "@mantine/hooks";
|
||
2 years ago
|
import { Column } from "react-table";
|
||
|
|
||
|
interface Props<T extends Wanted.Base> {
|
||
|
name: string;
|
||
|
columns: Column<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();
|
||
|
|
||
2 years ago
|
useDocumentTitle(`Wanted ${name} - Bazarr`);
|
||
|
|
||
2 years ago
|
return (
|
||
2 years ago
|
<Container fluid px={0}>
|
||
|
<Toolbox>
|
||
|
<Toolbox.Button
|
||
2 years ago
|
disabled={hasTask || dataCount === 0}
|
||
2 years ago
|
onClick={searchAll}
|
||
2 years ago
|
icon={faSearch}
|
||
|
>
|
||
|
Search All
|
||
2 years ago
|
</Toolbox.Button>
|
||
|
</Toolbox>
|
||
|
<QueryPageTable
|
||
|
tableStyles={{ emptyText: `No missing ${name} subtitles` }}
|
||
|
query={query}
|
||
|
columns={columns}
|
||
|
></QueryPageTable>
|
||
2 years ago
|
</Container>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default WantedView;
|