From b1fbaaed95b2e45e6d4b3b8332f962c587f216e4 Mon Sep 17 00:00:00 2001 From: twwu Date: Fri, 25 Apr 2025 18:39:05 +0800 Subject: [PATCH] refactor: Simplify type checks for form field rendering and correct comment grammar --- .../components/base/form/form-scenarios/base/field.tsx | 8 ++++---- web/app/components/base/form/form-scenarios/base/types.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/app/components/base/form/form-scenarios/base/field.tsx b/web/app/components/base/form/form-scenarios/base/field.tsx index cf8bd911d3..40f9cd4c5d 100644 --- a/web/app/components/base/form/form-scenarios/base/field.tsx +++ b/web/app/components/base/form/form-scenarios/base/field.tsx @@ -36,7 +36,7 @@ const Field = ({ if (!isAllConditionsMet) return <> - if ([BaseVarType.textInput].includes(type)) { + if (type === BaseVarType.textInput) { return ( ({ ) } - if ([BaseVarType.numberInput].includes(type)) { + if (type === BaseVarType.numberInput) { return ( ({ ) } - if ([BaseVarType.checkbox].includes(type)) { + if (type === BaseVarType.checkbox) { return ( ({ ) } - if ([BaseVarType.select].includes(type)) { + if (type === BaseVarType.select) { return ( = { maxLength?: number // Max length for text input placeholder?: string required: boolean - showConditions: ShowCondition[] // Show this field only when the all conditions are met + showConditions: ShowCondition[] // Show this field only when all conditions are met type: BaseVarType tooltip?: string // Tooltip for this field } & NumberConfiguration & SelectConfiguration