Skip to content

Commit

Permalink
fix after merging dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed May 11, 2024
1 parent 3aa504d commit 16fd714
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions frontend/src/components/forms/ProfileEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const defaultCutoffOptions: SelectorOption<Language.ProfileItem>[] = [
// eslint-disable-next-line camelcase
audio_exclude: "False",
forced: "False",
hi: "False",
hi: "also",
language: "any",
},
},
Expand Down Expand Up @@ -88,7 +88,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
form.values.items,
(v) => {
const suffix =
v.hi === "True" ? ":hi" : v.forced === "True" ? ":forced" : "";
v.hi === "only" ? ":hi" : v.forced === "True" ? ":forced" : "";

return v.language + suffix;
},
Expand Down Expand Up @@ -190,12 +190,8 @@ const ProfileEditForm: FunctionComponent<Props> = ({
const selectValue = useMemo(() => {
if (item.forced === "True") {
return "forced";
} else if (item.hi === "also") {
return "also";
} else if (item.hi === "only") {
return "only";
} else if (item.hi === "never") {
return "never";
} else {
return item.hi;
}
}, [item.forced, item.hi]);

Expand All @@ -209,7 +205,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
...item,
hi: value,
forced: value === "forced" ? "True" : "False",
});
} as Language.ProfileItem);
}
}}
></Select>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare namespace Language {
id: number;
audio_exclude: PythonBoolean;
forced: PythonBoolean;
hi: string;
hi: "never" | "also" | "only";
language: CodeType;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utilities/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useProfileItemsToLanguages(profile?: Language.Profile) {
profile?.items.map<Language.Info>(({ language: code, hi, forced }) => {
const name = data?.find((v) => v.code2 === code)?.name ?? "";
return {
hi: hi === "True",
hi: hi === "only",
forced: forced === "True",
code2: code,
name,
Expand Down

0 comments on commit 16fd714

Please sign in to comment.