From ef46ab9261797f2fb6f37e08ac4186d8c8bb0901 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 27 Feb 2023 22:49:33 -0500 Subject: [PATCH] Improved languages profile edit modal to clarify subtitles types. --- .../src/components/forms/ProfileEditForm.tsx | 73 +++++++++++-------- 1 file 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[] = [ }, ]; +const subtitlesTypeOptions: SelectorOption[] = [ + { + 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 = ({ }, }, { - 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 ( - { - action.mutate(index, { - ...item, - forced: checked ? "True" : "False", - hi: checked ? "False" : item.hi, - }); - }} - > - ); - }, - }, - { - Header: "HI", - accessor: "hi", - Cell: ({ row: { original: item, index }, value }) => { - return ( - { - action.mutate(index, { - ...item, - hi: checked ? "True" : "False", - forced: checked ? "False" : item.forced, - }); + ); }, }, { - 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;