fix after merging dev branch

pull/2475/head
morpheus65535 7 months ago
parent 3aa504d83b
commit 16fd714a07

@ -30,7 +30,7 @@ const defaultCutoffOptions: SelectorOption<Language.ProfileItem>[] = [
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
audio_exclude: "False", audio_exclude: "False",
forced: "False", forced: "False",
hi: "False", hi: "also",
language: "any", language: "any",
}, },
}, },
@ -88,7 +88,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
form.values.items, form.values.items,
(v) => { (v) => {
const suffix = const suffix =
v.hi === "True" ? ":hi" : v.forced === "True" ? ":forced" : ""; v.hi === "only" ? ":hi" : v.forced === "True" ? ":forced" : "";
return v.language + suffix; return v.language + suffix;
}, },
@ -190,12 +190,8 @@ const ProfileEditForm: FunctionComponent<Props> = ({
const selectValue = useMemo(() => { const selectValue = useMemo(() => {
if (item.forced === "True") { if (item.forced === "True") {
return "forced"; return "forced";
} else if (item.hi === "also") { } else {
return "also"; return item.hi;
} else if (item.hi === "only") {
return "only";
} else if (item.hi === "never") {
return "never";
} }
}, [item.forced, item.hi]); }, [item.forced, item.hi]);
@ -209,7 +205,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
...item, ...item,
hi: value, hi: value,
forced: value === "forced" ? "True" : "False", forced: value === "forced" ? "True" : "False",
}); } as Language.ProfileItem);
} }
}} }}
></Select> ></Select>

@ -28,7 +28,7 @@ declare namespace Language {
id: number; id: number;
audio_exclude: PythonBoolean; audio_exclude: PythonBoolean;
forced: PythonBoolean; forced: PythonBoolean;
hi: string; hi: "never" | "also" | "only";
language: CodeType; language: CodeType;
} }

@ -33,7 +33,7 @@ export function useProfileItemsToLanguages(profile?: Language.Profile) {
profile?.items.map<Language.Info>(({ language: code, hi, forced }) => { profile?.items.map<Language.Info>(({ language: code, hi, forced }) => {
const name = data?.find((v) => v.code2 === code)?.name ?? ""; const name = data?.find((v) => v.code2 === code)?.name ?? "";
return { return {
hi: hi === "True", hi: hi === "only",
forced: forced === "True", forced: forced === "True",
code2: code, code2: code,
name, name,

Loading…
Cancel
Save