diff options
author | morpheus65535 <[email protected]> | 2023-02-27 22:49:33 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-02-27 22:49:33 -0500 |
commit | ef46ab9261797f2fb6f37e08ac4186d8c8bb0901 (patch) | |
tree | 01b25b3bdcbee0e283da3e167d896d3fc83164e7 | |
parent | 2e8203f0d4f9830a3608db28e6f61f8d9d87715e (diff) | |
download | bazarr-ef46ab9261797f2fb6f37e08ac4186d8c8bb0901.tar.gz bazarr-ef46ab9261797f2fb6f37e08ac4186d8c8bb0901.zip |
Improved languages profile edit modal to clarify subtitles types.v1.1.5-beta.26
-rw-r--r-- | frontend/src/components/forms/ProfileEditForm.tsx | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/frontend/src/components/forms/ProfileEditForm.tsx b/frontend/src/components/forms/ProfileEditForm.tsx index 50074cbc7..a4f394942 100644 --- a/frontend/src/components/forms/ProfileEditForm.tsx +++ b/frontend/src/components/forms/ProfileEditForm.tsx @@ -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 } }) => { - action.mutate(index, { - ...item, - hi: checked ? "True" : "False", - forced: checked ? "False" : item.forced, - }); + <Select + value={selectValue} + data={subtitlesTypeOptions} + onChange={(value) => { + if (value) { + action.mutate(index, { + ...item, + 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; |