From 9d97b6056136e8359b1ab02346fbd3f6c83c17b9 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Thu, 27 Mar 2025 10:55:54 +0800 Subject: [PATCH] perf: member tableui (#4353) --- .../zh-cn/docs/development/upgrading/492.md | 3 +- packages/web/hooks/useEditTextarea.tsx | 133 ------------------ packages/web/i18n/en/account_team.json | 4 +- packages/web/i18n/zh-CN/account_team.json | 4 +- packages/web/i18n/zh-Hant/account_team.json | 4 +- .../account/team/MemberTable.tsx | 9 +- .../app/src/web/common/hooks/useEditTitle.tsx | 7 +- 7 files changed, 14 insertions(+), 150 deletions(-) delete mode 100644 packages/web/hooks/useEditTextarea.tsx diff --git a/docSite/content/zh-cn/docs/development/upgrading/492.md b/docSite/content/zh-cn/docs/development/upgrading/492.md index 37950109f..d791139e2 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/492.md +++ b/docSite/content/zh-cn/docs/development/upgrading/492.md @@ -30,7 +30,8 @@ weight: 799 6. 工作流节点数组字符串类型,自动适配 string 输入。 7. 工作流节点数组类型,自动进行 JSON parse 解析 string 输入。 8. AI proxy 日志优化,去除重试失败的日志,仅保留最后一份错误日志。 -9. 分块算法小调整: +9. 个人信息和通知展示优化。 +10. 分块算法小调整: * 跨处理符号之间连续性更强。 * 代码块分割时,用 LLM 模型上下文作为分块大小,尽可能保证代码块完整性。 * 表格分割时,用 LLM 模型上下文作为分块大小,尽可能保证表格完整性。 diff --git a/packages/web/hooks/useEditTextarea.tsx b/packages/web/hooks/useEditTextarea.tsx deleted file mode 100644 index 87d949eeb..000000000 --- a/packages/web/hooks/useEditTextarea.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import React, { useCallback, useRef } from 'react'; -import { - ModalFooter, - ModalBody, - Input, - useDisclosure, - Button, - Box, - Textarea -} from '@chakra-ui/react'; -import MyModal from '../components/common/MyModal'; -import { useToast } from './useToast'; -import { useTranslation } from 'next-i18next'; - -export const useEditTextarea = ({ - title, - tip, - placeholder = '', - canEmpty = true, - valueRule, - rows = 10 -}: { - title: string; - tip?: string; - placeholder?: string; - canEmpty?: boolean; - valueRule?: (val: string) => string | void; - rows?: number; -}) => { - const { t } = useTranslation(); - const { isOpen, onOpen, onClose } = useDisclosure(); - - const textareaRef = useRef(null); - const onSuccessCb = useRef<(content: string) => void | Promise>(); - const onErrorCb = useRef<(err: any) => void>(); - const { toast } = useToast(); - const defaultValue = useRef(''); - - const onOpenModal = useCallback( - ({ - defaultVal, - onSuccess, - onError - }: { - defaultVal: string; - onSuccess: (content: string) => any; - onError?: (err: any) => void; - }) => { - onOpen(); - onSuccessCb.current = onSuccess; - onErrorCb.current = onError; - defaultValue.current = defaultVal; - }, - [onOpen] - ); - - const onclickConfirm = useCallback(async () => { - if (!textareaRef.current || !onSuccessCb.current) return; - const val = textareaRef.current.value; - - if (!canEmpty && !val) { - textareaRef.current.focus(); - return; - } - - if (valueRule) { - const result = valueRule(val); - if (result) { - return toast({ - status: 'warning', - title: result - }); - } - } - - try { - await onSuccessCb.current(val); - - onClose(); - } catch (err) { - onErrorCb.current?.(err); - } - }, [canEmpty, onClose]); - - // eslint-disable-next-line react/display-name - const EditModal = useCallback( - ({ - maxLength = 30, - iconSrc = 'modal/edit', - closeBtnText = t('common:common.Close') - }: { - maxLength?: number; - iconSrc?: string; - closeBtnText?: string; - }) => ( - - - {!!tip && ( - - {tip} - - )} - -