From 2cf9a20910a2086524d36ddb8c2592e165a6fd24 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sun, 23 Nov 2025 12:33:26 +0800 Subject: [PATCH] =?UTF-8?q?snackbar=20=E7=95=A5=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 6ef9971..6734761 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -199,15 +199,17 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC const cachedFiles = React.useRef({} as { [fileName: string]: ArrayBuffer }) const cachedFileNamesCount = React.useRef({} as { [fileName: string]: number }) async function sendMessage() { + let text = inputRef.current!.value + if (text.trim() == '') return const sendingFilesSnackbar = snackbar({ - message: `上传文件到 [${chatInfo.title}]...`, + message: `发送消息到 [${chatInfo.title}]...`, placement: 'top', autoCloseDelay: 0, }) let i = 1 let i2 = 0 const sendingFilesSnackbarId = setInterval(() => { - const len = Object.keys(cachedFiles.current).length + const len = Object.keys(cachedFiles.current).filter((fileName) => text.indexOf(fileName)).length sendingFilesSnackbar.textContent = i2 == len ? `发送消息到 [${chatInfo.title}]... (${i}s)` : `上传第 ${i2}/${len} 文件到 [${chatInfo.title}]... (${i}s)` i++ }, 1000) @@ -216,8 +218,6 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC sendingFilesSnackbar.open = false } try { - let text = inputRef.current!.value - if (text.trim() == '') return setIsMessageSending(true) for (const fileName of Object.keys(cachedFiles.current)) { if (text.indexOf(fileName) != -1) {