Improved languages profile edit modal to clarify subtitles types.

pull/2078/head v1.1.5-beta.26
morpheus65535 2 years ago
parent 2e8203f0d4
commit ef46ab9261

@ -9,6 +9,7 @@ import {
Accordion,
Button,
Checkbox,
Select,
Stack,
Switch,
Text,
@ -34,6 +35,21 @@ const defaultCutoffOptions: SelectorOption<Language.ProfileItem>[] = [
},
];
const subtitlesTypeOptions: SelectorOption<string>[] = [
{
label: "Normal or hearing-impaired",
value: "normal",
},
{
label: "Hearing-impaired required",
value: "hi",
},
{
label: "Forced (foreign part only)",
value: "forced",
},
];
interface Props {
onComplete?: (profile: Language.Profile) => void;
languages: readonly Language.Info[];
@ -157,43 +173,38 @@ const ProfileEditForm: FunctionComponent<Props> = ({
},
},
{
Header: "Forced",
Header: "Subtitles Type",
accessor: "forced",
Cell: ({ row: { original: item, index }, value }) => {
const selectValue = useMemo(() => {
if (item.forced === "True") {
return "forced";
} else if (item.hi === "True") {
return "hi";
} else {
return "normal";
}
}, [item.forced, item.hi]);
return (
<Checkbox
checked={value === "True"}
onChange={({ currentTarget: { checked } }) => {
action.mutate(index, {
...item,
forced: checked ? "True" : "False",
hi: checked ? "False" : item.hi,
});
}}
></Checkbox>
);
},
},
{
Header: "HI",
accessor: "hi",
Cell: ({ row: { original: item, index }, value }) => {
return (
<Checkbox
checked={value === "True"}
onChange={({ currentTarget: { checked } }) => {
<Select
value={selectValue}
data={subtitlesTypeOptions}
onChange={(value) => {
if (value) {
action.mutate(index, {
...item,
hi: checked ? "True" : "False",
forced: checked ? "False" : item.forced,
hi: value === "hi" ? "True" : "False",
forced: value === "forced" ? "True" : "False",
});
}
}}
></Checkbox>
></Select>
);
},
},
{
Header: "Exclude Audio",
Header: "Exclude If Matching Audio",
accessor: "audio_exclude",
Cell: ({ row: { original: item, index }, value }) => {
return (
@ -317,8 +328,6 @@ export const ProfileEditModal = withModal(
"languages-profile-editor",
{
title: "Edit Languages Profile",
size: "lg",
size: "xl",
}
);
export default ProfileEditForm;

Loading…
Cancel
Save