🎨 優化按鈕樣式

This commit is contained in:
Minidoracat 2025-06-13 14:11:27 +08:00
parent fdaf8aecbd
commit ed3b37bc34
7 changed files with 81 additions and 17 deletions

View File

@ -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",

View File

@ -278,14 +278,17 @@
"deleteSuccess": "提示词已删除"
},
"buttons": {
"selectPrompt": "选择常用提示",
"useLastPrompt": "使用上次提示",
"selectPrompt": "常用提示",
"useLastPrompt": "上次提示",
"noPrompts": "尚无常用提示词,请先在设置中新增",
"noLastPrompt": "尚无最近使用的提示词",
"lastPromptApplied": "已套用上次使用的提示词",
"promptNotFound": "找不到指定的提示词",
"promptApplied": "已套用提示词:"
},
"select": {
"title": "选择常用提示词"
},
"modal": {
"addTitle": "新增提示词",
"editTitle": "编辑提示词",

View File

@ -283,14 +283,17 @@
"deleteSuccess": "提示詞已刪除"
},
"buttons": {
"selectPrompt": "選擇常用提示",
"useLastPrompt": "使用上次提示",
"selectPrompt": "常用提示",
"useLastPrompt": "上次提示",
"noPrompts": "尚無常用提示詞,請先在設定中新增",
"noLastPrompt": "尚無最近使用的提示詞",
"lastPromptApplied": "已套用上次使用的提示詞",
"promptNotFound": "找不到指定的提示詞",
"promptApplied": "已套用提示詞:"
},
"select": {
"title": "選擇常用提示詞"
},
"modal": {
"addTitle": "新增提示詞",
"editTitle": "編輯提示詞",

View File

@ -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;
}
}

View File

@ -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');

View File

@ -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>
`;
@ -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;
}
}
});
};
/**
* 更新按鈕狀態
*/
@ -321,6 +355,9 @@
}
}
});
// 同時更新按鈕文字(以防語言切換)
this.updateButtonTexts();
};
/**

View File

@ -85,7 +85,7 @@
const modalData = {
type: 'select',
title: this.t('prompts.buttons.selectPrompt', '選擇常用提示詞'),
title: this.t('prompts.select.title', '選擇常用提示詞'),
prompts: prompts
};