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.
91 lines
2.2 KiB
91 lines
2.2 KiB
import { faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
import React, { FunctionComponent, useMemo } from "react";
|
|
import { Link } from "react-router-dom";
|
|
import { Column } from "react-table";
|
|
import { EpisodesApi } from "../../apis";
|
|
import { AsyncButton, LanguageText, PageTable } from "../../components";
|
|
|
|
interface Props {
|
|
blacklist: readonly Blacklist.Episode[];
|
|
update: () => void;
|
|
}
|
|
|
|
const Table: FunctionComponent<Props> = ({ blacklist, update }) => {
|
|
const columns = useMemo<Column<Blacklist.Episode>[]>(
|
|
() => [
|
|
{
|
|
Header: "Series",
|
|
accessor: "seriesTitle",
|
|
className: "text-nowrap",
|
|
Cell: (row) => {
|
|
const target = `/series/${row.row.original.sonarrSeriesId}`;
|
|
return (
|
|
<Link to={target}>
|
|
<span>{row.value}</span>
|
|
</Link>
|
|
);
|
|
},
|
|
},
|
|
{
|
|
Header: "Episode",
|
|
accessor: "episode_number",
|
|
},
|
|
{
|
|
accessor: "episodeTitle",
|
|
},
|
|
{
|
|
Header: "Language",
|
|
accessor: "language",
|
|
Cell: ({ value }) => {
|
|
if (value) {
|
|
return <LanguageText text={value} long></LanguageText>;
|
|
} else {
|
|
return null;
|
|
}
|
|
},
|
|
},
|
|
{
|
|
Header: "Provider",
|
|
accessor: "provider",
|
|
},
|
|
{
|
|
Header: "Date",
|
|
accessor: "timestamp",
|
|
},
|
|
{
|
|
accessor: "subs_id",
|
|
Cell: (row) => {
|
|
const subs_id = row.value;
|
|
return (
|
|
<AsyncButton
|
|
size="sm"
|
|
variant="light"
|
|
noReset
|
|
promise={() =>
|
|
EpisodesApi.deleteBlacklist(false, {
|
|
provider: row.row.original.provider,
|
|
subs_id,
|
|
})
|
|
}
|
|
onSuccess={update}
|
|
>
|
|
<FontAwesomeIcon icon={faTrash}></FontAwesomeIcon>
|
|
</AsyncButton>
|
|
);
|
|
},
|
|
},
|
|
],
|
|
[update]
|
|
);
|
|
return (
|
|
<PageTable
|
|
emptyText="No Blacklisted Series Subtitles"
|
|
columns={columns}
|
|
data={blacklist}
|
|
></PageTable>
|
|
);
|
|
};
|
|
|
|
export default Table;
|