From 244e16c4912a5eb5a334e53d36d6fbf73bc0e8bb Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 27 Mar 2026 17:22:24 +0800 Subject: [PATCH] perf: ui --- .../dynamic-form/DynamicFormComponent.tsx | 41 +++ .../dynamic-form/DynamicFormItemComponent.tsx | 136 +++---- .../components/home-sidebar/HomeSidebar.tsx | 108 +++--- .../home-sidebar/SidebarDataContext.tsx | 4 + .../app/home/knowledge/KBDetailContent.tsx | 85 +++-- .../knowledge/components/kb-form/KBForm.tsx | 287 ++++++++------- .../home/pipelines/PipelineDetailContent.tsx | 216 +++++------ .../pipeline-form/PipelineFormComponent.tsx | 340 ++++++++++++------ web/src/i18n/locales/en-US.ts | 22 +- web/src/i18n/locales/ja-JP.ts | 20 ++ web/src/i18n/locales/zh-Hans.ts | 15 + web/src/i18n/locales/zh-Hant.ts | 18 + 12 files changed, 790 insertions(+), 502 deletions(-) diff --git a/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx b/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx index 20de6646..4de1dad1 100644 --- a/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx +++ b/web/src/app/home/components/dynamic-form/DynamicFormComponent.tsx @@ -14,6 +14,7 @@ import DynamicFormItemComponent from '@/app/home/components/dynamic-form/Dynamic import { useEffect, useRef } from 'react'; import { extractI18nObject } from '@/i18n/I18nProvider'; import { useTranslation } from 'react-i18next'; +import { cn } from '@/lib/utils'; export default function DynamicFormComponent({ itemConfigList, @@ -273,6 +274,46 @@ export default function DynamicFormComponent({ // All fields are disabled when editing (creation_settings are immutable) const isFieldDisabled = !!isEditing; + // Boolean fields use a special inline layout + if (config.type === 'boolean') { + return ( + ( + +
+
+ + {extractI18nObject(config.label)} + + {config.description && ( +

+ {extractI18nObject(config.description)} +

+ )} +
+ + + +
+ +
+ )} + /> + ); + } + return ( field.onChange(Number(e.target.value))} /> ); case DynamicFormItemType.STRING: - return ; + return ; case DynamicFormItemType.TEXT: - return