diff --git a/src/mcp_feedback_enhanced/web/locales/en/translation.json b/src/mcp_feedback_enhanced/web/locales/en/translation.json index 18c13c8..5b119f6 100644 --- a/src/mcp_feedback_enhanced/web/locales/en/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/en/translation.json @@ -143,7 +143,7 @@ "message": "Submitting your feedback..." }, "submitted": { - "title": "Feedback Submitted", + "title": "Submitted", "message": "Waiting for next MCP call" } }, @@ -278,14 +278,17 @@ "deleteSuccess": "Prompt deleted successfully" }, "buttons": { - "selectPrompt": "Select Prompt Template", - "useLastPrompt": "Use Last Prompt", + "selectPrompt": "Templates", + "useLastPrompt": "Last Used", "noPrompts": "No prompt templates available, please add one in settings first", "noLastPrompt": "No recently used prompt available", "lastPromptApplied": "Last used prompt applied successfully", "promptNotFound": "Prompt not found", "promptApplied": "Prompt applied: " }, + "select": { + "title": "Select Prompt Template" + }, "modal": { "addTitle": "Add New Prompt", "editTitle": "Edit Prompt", diff --git a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json index eda2973..7fe305e 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-CN/translation.json @@ -278,14 +278,17 @@ "deleteSuccess": "提示词已删除" }, "buttons": { - "selectPrompt": "选择常用提示词", - "useLastPrompt": "使用上次提示词", + "selectPrompt": "常用提示", + "useLastPrompt": "上次提示", "noPrompts": "尚无常用提示词,请先在设置中新增", "noLastPrompt": "尚无最近使用的提示词", "lastPromptApplied": "已套用上次使用的提示词", "promptNotFound": "找不到指定的提示词", "promptApplied": "已套用提示词:" }, + "select": { + "title": "选择常用提示词" + }, "modal": { "addTitle": "新增提示词", "editTitle": "编辑提示词", diff --git a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json index 63119de..ef5786c 100644 --- a/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json +++ b/src/mcp_feedback_enhanced/web/locales/zh-TW/translation.json @@ -283,14 +283,17 @@ "deleteSuccess": "提示詞已刪除" }, "buttons": { - "selectPrompt": "選擇常用提示詞", - "useLastPrompt": "使用上次提示詞", + "selectPrompt": "常用提示", + "useLastPrompt": "上次提示", "noPrompts": "尚無常用提示詞,請先在設定中新增", "noLastPrompt": "尚無最近使用的提示詞", "lastPromptApplied": "已套用上次使用的提示詞", "promptNotFound": "找不到指定的提示詞", "promptApplied": "已套用提示詞:" }, + "select": { + "title": "選擇常用提示詞" + }, "modal": { "addTitle": "新增提示詞", "editTitle": "編輯提示詞", diff --git a/src/mcp_feedback_enhanced/web/static/css/prompt-management.css b/src/mcp_feedback_enhanced/web/static/css/prompt-management.css index 9589a3f..53099d7 100644 --- a/src/mcp_feedback_enhanced/web/static/css/prompt-management.css +++ b/src/mcp_feedback_enhanced/web/static/css/prompt-management.css @@ -321,7 +321,7 @@ } .prompt-input-btn { - padding: 6px 12px; + padding: 6px 10px; font-size: 12px; border-radius: 4px; border: 1px solid var(--border-color); @@ -332,6 +332,8 @@ display: inline-flex; align-items: center; gap: 4px; + white-space: nowrap; + min-width: fit-content; } .prompt-input-btn:hover { @@ -395,11 +397,14 @@ } .prompt-input-buttons { - flex-direction: column; + flex-wrap: wrap; + gap: 6px; } - + .prompt-input-btn { justify-content: center; + flex: 1; + min-width: 80px; } } diff --git a/src/mcp_feedback_enhanced/web/static/js/i18n.js b/src/mcp_feedback_enhanced/web/static/js/i18n.js index 35b573f..067a30a 100644 --- a/src/mcp_feedback_enhanced/web/static/js/i18n.js +++ b/src/mcp_feedback_enhanced/web/static/js/i18n.js @@ -177,6 +177,9 @@ class I18nManager { // 更新連線監控相關的動態內容 this.updateConnectionMonitorContent(); + // 更新提示詞按鈕文字 + this.updatePromptInputButtons(); + // 更新應用程式中的動態狀態文字(使用新的模組化架構) if (window.feedbackApp && window.feedbackApp.isInitialized) { // 更新 UI 狀態 @@ -251,6 +254,16 @@ class I18nManager { } } + updatePromptInputButtons() { + // 更新提示詞輸入按鈕的文字 + if (window.feedbackApp && window.feedbackApp.promptInputButtons) { + // 觸發提示詞按鈕更新文字 + if (typeof window.feedbackApp.promptInputButtons.updateButtonTexts === 'function') { + window.feedbackApp.promptInputButtons.updateButtonTexts(); + } + } + } + setupLanguageSelectors() { // 舊版下拉選擇器(兼容性保留) const selector = document.getElementById('settingsLanguageSelect'); diff --git a/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-input-buttons.js b/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-input-buttons.js index 56afc5a..67660a8 100644 --- a/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-input-buttons.js +++ b/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-input-buttons.js @@ -60,7 +60,7 @@ // 設置事件監聽器 this.setupEventListeners(); - // 更新按鈕狀態 + // 更新按鈕狀態和文字 this.updateButtonStates(); this.isInitialized = true; @@ -80,11 +80,11 @@
`; @@ -92,7 +92,7 @@ // 在 input-group 的 label 後面插入按鈕 const inputGroup = container.closest('.input-group') || container; const label = inputGroup.querySelector('.input-label'); - + if (label) { label.insertAdjacentHTML('afterend', buttonsHtml); } else { @@ -105,6 +105,9 @@ this.selectButtons.push(buttonContainer.querySelector('.select-prompt-btn')); this.lastUsedButtons.push(buttonContainer.querySelector('.last-prompt-btn')); } + + // 更新按鈕文字 + this.updateButtonTexts(); }; /** @@ -285,6 +288,37 @@ textarea.dispatchEvent(inputEvent); }; + /** + * 更新按鈕文字 + */ + PromptInputButtons.prototype.updateButtonTexts = function() { + // 更新選擇提示詞按鈕文字 + this.selectButtons.forEach(function(button) { + if (button) { + const textSpan = button.querySelector('.button-text'); + if (textSpan) { + const text = window.i18nManager ? + window.i18nManager.t('prompts.buttons.selectPrompt', '常用提示') : + '常用提示'; + textSpan.textContent = text; + } + } + }); + + // 更新使用上次提示詞按鈕文字 + this.lastUsedButtons.forEach(function(button) { + if (button) { + const textSpan = button.querySelector('.button-text'); + if (textSpan) { + const text = window.i18nManager ? + window.i18nManager.t('prompts.buttons.useLastPrompt', '上次提示') : + '上次提示'; + textSpan.textContent = text; + } + } + }); + }; + /** * 更新按鈕狀態 */ @@ -300,7 +334,7 @@ this.selectButtons.forEach(function(button) { if (button) { button.disabled = prompts.length === 0; - + if (prompts.length === 0) { button.title = '尚無常用提示詞'; } else { @@ -313,7 +347,7 @@ this.lastUsedButtons.forEach(function(button) { if (button) { button.disabled = !lastPrompt; - + if (!lastPrompt) { button.title = '尚無最近使用的提示詞'; } else { @@ -321,6 +355,9 @@ } } }); + + // 同時更新按鈕文字(以防語言切換) + this.updateButtonTexts(); }; /** diff --git a/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-modal.js b/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-modal.js index b4a481f..41c4083 100644 --- a/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-modal.js +++ b/src/mcp_feedback_enhanced/web/static/js/modules/prompt/prompt-modal.js @@ -85,7 +85,7 @@ const modalData = { type: 'select', - title: this.t('prompts.buttons.selectPrompt', '選擇常用提示詞'), + title: this.t('prompts.select.title', '選擇常用提示詞'), prompts: prompts };