fix: move copy buttons to main interface next to translate button

This commit is contained in:
Russell Ballestrini 2025-07-02 13:41:25 -04:00
parent 4acf2be811
commit 35f84c4b57

106
src/ui.js
View file

@ -954,22 +954,40 @@ async function openUncloseaiEmbeddedModalNew() {
actionsSection.appendChild(actionsLabel);
actionsSection.appendChild(actionsGrid);
// Copy conversation section
const copySection = document.createElement("div");
copySection.style.cssText = `margin-bottom: 16px;`;
settingsPanel.appendChild(modelSection);
settingsPanel.appendChild(voiceSection);
settingsPanel.appendChild(actionsSection);
// Load and save settings panel state
let settingsOpen = localStorage.getItem('hermesSettingsOpen') === 'true';
settingsPanel.style.display = settingsOpen ? 'block' : 'none';
menuBtn.style.background = settingsOpen ? 'rgba(255,255,255,0.3)' : 'rgba(255,255,255,0.2)';
const copyLabel = document.createElement("div");
copyLabel.textContent = "Copy Conversation:";
copyLabel.style.cssText = `margin-bottom: 8px; font-weight: 600; color: #495057;`;
const copyGrid = document.createElement("div");
copyGrid.style.cssText = `
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
menuBtn.onclick = () => {
settingsOpen = !settingsOpen;
settingsPanel.style.display = settingsOpen ? 'block' : 'none';
menuBtn.style.background = settingsOpen ? 'rgba(255,255,255,0.3)' : 'rgba(255,255,255,0.2)';
localStorage.setItem('hermesSettingsOpen', settingsOpen.toString());
};
// Quick action buttons
const controls = document.createElement("div");
controls.style.cssText = `
flex-shrink: 0;
padding: 8px 16px;
background: white;
border-top: 1px solid #e9ecef;
border-bottom: 1px solid #e9ecef;
display: flex;
gap: 8px;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
`;
const copyActions = [
const controlActions = [
{ text: "📖 Read", action: () => window.readPageWithHermes() },
{ text: "🔊 TTS", action: () => window.openTTSModal() },
{ text: "🌐 Translate", action: () => window.openTranslateModal() },
{ text: "📋 Full Raw", action: async () => {
try {
const history = getChatHistory();
@ -1006,68 +1024,6 @@ async function openUncloseaiEmbeddedModalNew() {
}
}}
];
copyActions.forEach(({ text, action }) => {
const btn = document.createElement("button");
btn.textContent = text;
btn.style.cssText = `
padding: 8px 12px;
border: 1px solid #dee2e6;
border-radius: 4px;
background: white;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
`;
btn.onmouseenter = () => {
btn.style.background = '#f8f9fa';
};
btn.onmouseleave = () => {
btn.style.background = 'white';
};
btn.onclick = action;
copyGrid.appendChild(btn);
});
copySection.appendChild(copyLabel);
copySection.appendChild(copyGrid);
settingsPanel.appendChild(modelSection);
settingsPanel.appendChild(voiceSection);
settingsPanel.appendChild(actionsSection);
settingsPanel.appendChild(copySection);
// Load and save settings panel state
let settingsOpen = localStorage.getItem('hermesSettingsOpen') === 'true';
settingsPanel.style.display = settingsOpen ? 'block' : 'none';
menuBtn.style.background = settingsOpen ? 'rgba(255,255,255,0.3)' : 'rgba(255,255,255,0.2)';
menuBtn.onclick = () => {
settingsOpen = !settingsOpen;
settingsPanel.style.display = settingsOpen ? 'block' : 'none';
menuBtn.style.background = settingsOpen ? 'rgba(255,255,255,0.3)' : 'rgba(255,255,255,0.2)';
localStorage.setItem('hermesSettingsOpen', settingsOpen.toString());
};
// Quick action buttons
const controls = document.createElement("div");
controls.style.cssText = `
flex-shrink: 0;
padding: 8px 16px;
background: white;
border-top: 1px solid #e9ecef;
border-bottom: 1px solid #e9ecef;
display: flex;
gap: 8px;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
`;
const controlActions = [
{ text: "📖 Read", action: () => window.readPageWithHermes() },
{ text: "🔊 TTS", action: () => window.openTTSModal() },
{ text: "🌐 Translate", action: () => window.openTranslateModal() }
];
controlActions.forEach(({ text, action }) => {
const btn = document.createElement("button");