From 1ab75b8a92cc6a8dec0792d52399f67ca75d4bc4 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Tue, 24 Jun 2025 00:02:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20feat(EditChannel):=20improve=20m?= =?UTF-8?q?odel=20selection=20UX,=20clipboard=20feedback=20&=20rounded=20s?= =?UTF-8?q?tyling=20(#1290)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added a dedicated effect to merge origin and selected models, ensuring selected items always remain in the dropdown list. * Enhanced “Copy all models” button: * Shows info message when list is empty. * Displays success / error notification based on copy result. * Unified UI look-and-feel by applying `!rounded-lg` class to inputs, selects, banners and buttons. * i18n: added English translations for new prompts - "No models to copy" - "Model list copied to clipboard" - "Copy failed" --- web/src/i18n/locales/en.json | 5 ++- web/src/pages/Channel/EditChannel.js | 53 ++++++++++++++++------------ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index ff182af5..ade70ea5 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -1734,5 +1734,8 @@ "该模型存在固定价格与倍率计费方式冲突,请确认选择": "The model has a fixed price and ratio billing method conflict, please confirm the selection", "当前计费": "Current billing", "修改为": "Modify to", - "状态筛选": "Status filter" + "状态筛选": "Status filter", + "没有模型可以复制": "No models to copy", + "模型列表已复制到剪贴板": "Model list copied to clipboard", + "复制失败": "Copy failed" } \ No newline at end of file diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index 6879eb53..2e8baddf 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -300,27 +300,27 @@ const EditChannel = (props) => { } }; -useEffect(() => { - // 使用 Map 来避免重复,以 value 为键 - const modelMap = new Map(); - - // 先添加原始模型选项 - originModelOptions.forEach(option => { - modelMap.set(option.value, option); - }); - - // 再添加当前选中的模型(如果不存在) - inputs.models.forEach(model => { - if (!modelMap.has(model)) { - modelMap.set(model, { - label: model, - value: model, - }); - } - }); - - setModelOptions(Array.from(modelMap.values())); -}, [originModelOptions, inputs.models]); + useEffect(() => { + // 使用 Map 来避免重复,以 value 为键 + const modelMap = new Map(); + + // 先添加原始模型选项 + originModelOptions.forEach(option => { + modelMap.set(option.value, option); + }); + + // 再添加当前选中的模型(如果不存在) + inputs.models.forEach(model => { + if (!modelMap.has(model)) { + modelMap.set(model, { + label: model, + value: model, + }); + } + }); + + setModelOptions(Array.from(modelMap.values())); + }, [originModelOptions, inputs.models]); useEffect(() => { fetchModels().then(); @@ -835,7 +835,16 @@ useEffect(() => {