From 225a3b65d43e13f1a3fd739f4caa96b3878af724 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 10 Jun 2024 08:01:34 -0400 Subject: [PATCH] wip --- .../src/components/forms/ProfileEditForm.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/forms/ProfileEditForm.tsx b/frontend/src/components/forms/ProfileEditForm.tsx index 93b5440a4..81b50cfcd 100644 --- a/frontend/src/components/forms/ProfileEditForm.tsx +++ b/frontend/src/components/forms/ProfileEditForm.tsx @@ -12,6 +12,7 @@ import { } from "@mantine/core"; import { useForm } from "@mantine/form"; import { faTrash } from "@fortawesome/free-solid-svg-icons"; +import { cond } from "lodash"; import { Action, Selector, SelectorOption, SimpleTable } from "@/components"; import ChipInput from "@/components/inputs/ChipInput"; import { useModals, withModal } from "@/modules/modals"; @@ -87,16 +88,14 @@ const ProfileEditForm: FunctionComponent = ({ const itemCutoffOptions = useSelectorOptions( form.values.items, (v) => { - const suffix = - v.hi === "only" - ? ":hi" - : v.hi === "never" - ? ":normal" - : v.forced === "True" - ? ":forced" - : ""; + const suffix = cond([ + [(v: { forced: string; hi: string }) => v.hi === "only", () => ":hi"], + [(v) => v.hi === "never", () => ":normal"], + [(v) => v.forced === "True", () => ":forced"], + [() => true, () => ""], + ]); - return v.language + suffix; + return v.language + suffix(v); }, (v) => String(v.id), );