From 8041808b53610275283bf6cbc0a44f8a163da254 Mon Sep 17 00:00:00 2001 From: Tianyi Jing Date: Mon, 4 Aug 2025 14:39:54 +0800 Subject: [PATCH] fix: diplay all helpfields (#23348) Signed-off-by: jingfelix --- .../base/form/components/base/base-field.tsx | 17 +++++++++++++++++ .../plugin-auth/authorize/api-key-modal.tsx | 17 +---------------- .../authorize/oauth-client-settings.tsx | 17 ----------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/web/app/components/base/form/components/base/base-field.tsx b/web/app/components/base/form/components/base/base-field.tsx index 8120fad6b..00a1f9b2d 100644 --- a/web/app/components/base/form/components/base/base-field.tsx +++ b/web/app/components/base/form/components/base/base-field.tsx @@ -3,6 +3,7 @@ import { memo, useMemo, } from 'react' +import { RiExternalLinkLine } from '@remixicon/react' import type { AnyFieldApi } from '@tanstack/react-form' import { useStore } from '@tanstack/react-form' import cn from '@/utils/classnames' @@ -200,6 +201,22 @@ const BaseField = ({ ) } + { + formSchema.url && ( + + + {renderI18nObject(formSchema?.help as any)} + + { + + } + + ) + } ) diff --git a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx index d582c660b..21946c4b5 100644 --- a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx @@ -6,7 +6,6 @@ import { useState, } from 'react' import { useTranslation } from 'react-i18next' -import { RiExternalLinkLine } from '@remixicon/react' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' import Modal from '@/app/components/base/modal/modal' import { CredentialTypeEnum } from '../types' @@ -21,7 +20,6 @@ import { useGetPluginCredentialSchemaHook, useUpdatePluginCredentialHook, } from '../hooks/use-credential' -import { useRenderI18nObject } from '@/hooks/use-i18n' export type ApiKeyModalProps = { pluginPayload: PluginPayload @@ -64,8 +62,6 @@ const ApiKeyModal = ({ acc[schema.name] = schema.default return acc }, {} as Record) - const helpField = formSchemas.find(schema => schema.url && schema.help) - const renderI18nObject = useRenderI18nObject() const { mutateAsync: addPluginCredential } = useAddPluginCredentialHook(pluginPayload) const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload) const formRef = useRef(null) @@ -125,18 +121,7 @@ const ApiKeyModal = ({ onClose={onClose} onCancel={onClose} footerSlot={ - helpField && ( - - - {renderI18nObject(helpField?.help as any)} - - - - ) + (
) } bottomSlot={
diff --git a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx index 14c7ed957..c10b06166 100644 --- a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx @@ -4,7 +4,6 @@ import { useRef, useState, } from 'react' -import { RiExternalLinkLine } from '@remixicon/react' import { useForm, useStore, @@ -24,7 +23,6 @@ import type { } from '@/app/components/base/form/types' import { useToastContext } from '@/app/components/base/toast' import Button from '@/app/components/base/button' -import { useRenderI18nObject } from '@/hooks/use-i18n' type OAuthClientSettingsProps = { pluginPayload: PluginPayload @@ -129,8 +127,6 @@ const OAuthClientSettings = ({ defaultValues: editValues || defaultValues, }) const __oauth_client__ = useStore(form.store, s => s.values.__oauth_client__) - const helpField = schemas.find(schema => schema.url && schema.help) - const renderI18nObject = useRenderI18nObject() return ( - { - helpField && __oauth_client__ === 'custom' && ( - - - {renderI18nObject(helpField?.help as any)} - - - - )} )