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.
bazarr/frontend/src/components/inputs/blacklist.tsx

45 lines
1.1 KiB

import { faFileExcel } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { FunctionComponent } from "react";
import { AsyncButton } from "..";
interface Props {
history: History.Base;
update?: () => void;
promise: (form: FormType.AddBlacklist) => Promise<void>;
}
export const BlacklistButton: FunctionComponent<Props> = ({
history,
update,
promise,
}) => {
const { provider, subs_id, language, subtitles_path, blacklisted } = history;
if (subs_id && provider && language) {
return (
<AsyncButton
size="sm"
variant="light"
noReset
disabled={blacklisted}
promise={() => {
const { code2 } = language;
const form: FormType.AddBlacklist = {
provider,
subs_id,
subtitles_path,
language: code2,
};
return promise(form);
}}
onSuccess={update}
>
<FontAwesomeIcon icon={faFileExcel}></FontAwesomeIcon>
</AsyncButton>
);
} else {
return null;
}
};