mirror of
https://github.com/Minidoracat/mcp-feedback-enhanced.git
synced 2025-07-27 02:22:26 +08:00
🎨 優化按鈕樣式
This commit is contained in:
parent
fdaf8aecbd
commit
ed3b37bc34
@ -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",
|
||||
|
@ -278,14 +278,17 @@
|
||||
"deleteSuccess": "提示词已删除"
|
||||
},
|
||||
"buttons": {
|
||||
"selectPrompt": "选择常用提示词",
|
||||
"useLastPrompt": "使用上次提示词",
|
||||
"selectPrompt": "常用提示",
|
||||
"useLastPrompt": "上次提示",
|
||||
"noPrompts": "尚无常用提示词,请先在设置中新增",
|
||||
"noLastPrompt": "尚无最近使用的提示词",
|
||||
"lastPromptApplied": "已套用上次使用的提示词",
|
||||
"promptNotFound": "找不到指定的提示词",
|
||||
"promptApplied": "已套用提示词:"
|
||||
},
|
||||
"select": {
|
||||
"title": "选择常用提示词"
|
||||
},
|
||||
"modal": {
|
||||
"addTitle": "新增提示词",
|
||||
"editTitle": "编辑提示词",
|
||||
|
@ -283,14 +283,17 @@
|
||||
"deleteSuccess": "提示詞已刪除"
|
||||
},
|
||||
"buttons": {
|
||||
"selectPrompt": "選擇常用提示詞",
|
||||
"useLastPrompt": "使用上次提示詞",
|
||||
"selectPrompt": "常用提示",
|
||||
"useLastPrompt": "上次提示",
|
||||
"noPrompts": "尚無常用提示詞,請先在設定中新增",
|
||||
"noLastPrompt": "尚無最近使用的提示詞",
|
||||
"lastPromptApplied": "已套用上次使用的提示詞",
|
||||
"promptNotFound": "找不到指定的提示詞",
|
||||
"promptApplied": "已套用提示詞:"
|
||||
},
|
||||
"select": {
|
||||
"title": "選擇常用提示詞"
|
||||
},
|
||||
"modal": {
|
||||
"addTitle": "新增提示詞",
|
||||
"editTitle": "編輯提示詞",
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -60,7 +60,7 @@
|
||||
// 設置事件監聽器
|
||||
this.setupEventListeners();
|
||||
|
||||
// 更新按鈕狀態
|
||||
// 更新按鈕狀態和文字
|
||||
this.updateButtonStates();
|
||||
|
||||
this.isInitialized = true;
|
||||
@ -80,11 +80,11 @@
|
||||
<div class="prompt-input-buttons">
|
||||
<button type="button" class="prompt-input-btn select-prompt-btn" data-container-index="${index}">
|
||||
<span>📝</span>
|
||||
<span data-i18n="prompts.buttons.selectPrompt">選擇常用提示詞</span>
|
||||
<span class="button-text"></span>
|
||||
</button>
|
||||
<button type="button" class="prompt-input-btn last-prompt-btn" data-container-index="${index}">
|
||||
<span>🔄</span>
|
||||
<span data-i18n="prompts.buttons.useLastPrompt">使用上次提示詞</span>
|
||||
<span class="button-text"></span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
@ -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();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
const modalData = {
|
||||
type: 'select',
|
||||
title: this.t('prompts.buttons.selectPrompt', '選擇常用提示詞'),
|
||||
title: this.t('prompts.select.title', '選擇常用提示詞'),
|
||||
prompts: prompts
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user