Skip to content

Commit 41cc5d6

Browse files
committed
fix: tabs stuck on actions, remove broken update UI
- Removed lucide dependency from config (was causing crashes) - All buttons use event delegation (data-del-id, data-tab) - Removed Updates section entirely (electron-updater handles it) - Fixed icon rendering for data: URLs in config list
1 parent 2d88b26 commit 41cc5d6

3 files changed

Lines changed: 11 additions & 39 deletions

File tree

apps/server/public/index.html

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ <h3 id="modal-title">Add action</h3>
649649
if (configTab === 'actions') {
650650
html += `<button class="add-btn" onclick="openModal()">${t('addAction')}</button>`;
651651
html += actions.map(a => {
652-
const iconHtml = a.icon && a.icon.startsWith('http') ? `<img src="${a.icon}" style="width:20px;height:20px;border-radius:4px">` : `<i data-lucide="${{url:'globe',copy:'clipboard',command:'terminal'}[a.type]||'zap'}" style="width:18px;height:18px;color:var(--accent)"></i>`;
653-
return `<div class="config-item">${iconHtml}<div class="info"><p>${a.label}</p><small>${a.type}</small></div><button class="del" onclick="del('${a.id}')">×</button></div>`;
652+
const iconHtml = a.icon && (a.icon.startsWith('http') || a.icon.startsWith('data:')) ? `<img src="${a.icon}" style="width:20px;height:20px;border-radius:4px">` : `<svg viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" style="width:18px;height:18px"><circle cx="12" cy="12" r="10"/></svg>`;
653+
return `<div class="config-item">${iconHtml}<div class="info"><p>${a.label}</p><small>${a.type}</small></div><button class="del" data-del-id="${a.id}">×</button></div>`;
654654
}).join('');
655655
} else if (configTab === 'plugins') {
656656
html += `<div id="plugin-store" style="font-size:12px;color:var(--text-dim)">Loading...</div>`;
@@ -666,10 +666,11 @@ <h3 id="modal-title">Add action</h3>
666666
}
667667

668668
el.innerHTML = html;
669-
try { lucide.createIcons(); } catch {}
670669
// Tab click delegation
671670
const tabs = document.getElementById('config-tabs');
672671
if (tabs) tabs.onclick = (e) => { const btn = e.target.closest('[data-tab]'); if (btn) { configTab = btn.dataset.tab; renderConfig(); } };
672+
// Delete button delegation
673+
el.onclick = (e) => { const btn = e.target.closest('[data-del-id]'); if (btn) { del(btn.dataset.delId); } const tabBtn = e.target.closest('[data-tab]'); if (tabBtn) { configTab = tabBtn.dataset.tab; renderConfig(); } };
673674
if (configTab === 'connect' && isHost) {
674675
fetch('/health').then(r=>r.json()).then(d => {
675676
const el = document.getElementById('qr-url');
@@ -695,7 +696,6 @@ <h3 id="modal-title">Add action</h3>
695696
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">${t('language')}</h4>`;
696697
html += `<div style="display:flex;gap:8px"><button onclick="setLang('en')" style="flex:1;padding:10px;border-radius:10px;border:1px solid ${lang==='en'?'var(--accent)':'var(--glass-border)'};background:${lang==='en'?'var(--accent-soft)':'transparent'};color:${lang==='en'?'var(--accent)':'var(--text-dim)'};font-size:12px;font-weight:600;cursor:pointer">English</button><button onclick="setLang('es')" style="flex:1;padding:10px;border-radius:10px;border:1px solid ${lang==='es'?'var(--accent)':'var(--glass-border)'};background:${lang==='es'?'var(--accent-soft)':'transparent'};color:${lang==='es'?'var(--accent)':'var(--text-dim)'};font-size:12px;font-weight:600;cursor:pointer">Español</button></div>`;
697698
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">${t('sound')}</h4><div class="sound-toggle"><span>${t('notifSound')}</span><button class="toggle ${soundEnabled?'on':''}" onclick="toggleSound()"></button></div>`;
698-
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">Updates</h4><div id="update-section" style="font-size:12px;color:var(--text-dim)"></div>`;
699699
html += `<details style="margin-top:16px;border:1px solid var(--glass-border);border-radius:10px;overflow:hidden"><summary style="padding:10px 14px;font-size:11px;color:var(--text-dim);cursor:pointer;background:var(--glass)">Debug logs</summary><div style="padding:10px 14px;border-top:1px solid var(--glass-border)"><pre id="debug-logs" style="font-size:10px;color:var(--text-dim);max-height:150px;overflow:auto;white-space:pre-wrap;-webkit-overflow-scrolling:touch;margin:0">${lang==='es'?'Cargando...':'Loading...'}</pre><button id="copy-logs-btn" style="margin-top:8px;padding:6px 12px;border-radius:6px;border:1px solid var(--glass-border);background:var(--glass);color:var(--text-dim);font-size:10px;cursor:pointer">${lang==='es'?'Copiar':'Copy'}</button></div></details>`;
700700
html += `<p id="version-label" style="margin-top:16px;font-size:10px;color:var(--text-dim);text-align:center"></p>`;
701701
html += `</div>`;
@@ -782,23 +782,9 @@ <h3 id="modal-title">Add action</h3>
782782
.catch(() => addNotif('Uninstall failed', 'error'));
783783
}
784784

785-
const CURRENT_VERSION = '0.6.6';
786-
const REPO = 'florextech/deck';
787-
788-
function checkForUpdates() {
789-
const el = document.getElementById('update-section');
790-
if (!el) return;
791-
fetch('/health').then(r=>r.json()).then(h => {
792-
const currentV = h.version || CURRENT_VERSION;
793-
const vLabel = document.getElementById('version-label');
794-
if (vLabel) vLabel.textContent = `Deck v${currentV}`;
795-
el.innerHTML = `<span style="color:var(--green)">v${currentV} ✓</span>`;
796-
}).catch(() => { el.innerHTML = `<span style="color:var(--text-dim)">v${CURRENT_VERSION}</span>`; });
797-
}
798-
799785
// Check on settings render
800786
const origRenderConfig = renderConfig;
801-
renderConfig = function() { origRenderConfig(); if (configTab === 'settings') { setTimeout(checkForUpdates, 200); setTimeout(setupDebugBtn, 300); } };
787+
renderConfig = function() { origRenderConfig(); if (configTab === 'settings') { setTimeout(setupDebugBtn, 200); setTimeout(()=>{ const vl=document.getElementById('version-label'); if(vl) fetch('/health').then(r=>r.json()).then(h=>{vl.textContent='Deck v'+(h.version||'0.7.1')}).catch(()=>{}); },100); } };
802788

803789
function setupDebugBtn() {
804790
const pre = document.getElementById('debug-logs');

electron/public/index.html

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ <h3 id="modal-title">Add action</h3>
649649
if (configTab === 'actions') {
650650
html += `<button class="add-btn" onclick="openModal()">${t('addAction')}</button>`;
651651
html += actions.map(a => {
652-
const iconHtml = a.icon && a.icon.startsWith('http') ? `<img src="${a.icon}" style="width:20px;height:20px;border-radius:4px">` : `<i data-lucide="${{url:'globe',copy:'clipboard',command:'terminal'}[a.type]||'zap'}" style="width:18px;height:18px;color:var(--accent)"></i>`;
653-
return `<div class="config-item">${iconHtml}<div class="info"><p>${a.label}</p><small>${a.type}</small></div><button class="del" onclick="del('${a.id}')">×</button></div>`;
652+
const iconHtml = a.icon && (a.icon.startsWith('http') || a.icon.startsWith('data:')) ? `<img src="${a.icon}" style="width:20px;height:20px;border-radius:4px">` : `<svg viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" style="width:18px;height:18px"><circle cx="12" cy="12" r="10"/></svg>`;
653+
return `<div class="config-item">${iconHtml}<div class="info"><p>${a.label}</p><small>${a.type}</small></div><button class="del" data-del-id="${a.id}">×</button></div>`;
654654
}).join('');
655655
} else if (configTab === 'plugins') {
656656
html += `<div id="plugin-store" style="font-size:12px;color:var(--text-dim)">Loading...</div>`;
@@ -666,10 +666,11 @@ <h3 id="modal-title">Add action</h3>
666666
}
667667

668668
el.innerHTML = html;
669-
try { lucide.createIcons(); } catch {}
670669
// Tab click delegation
671670
const tabs = document.getElementById('config-tabs');
672671
if (tabs) tabs.onclick = (e) => { const btn = e.target.closest('[data-tab]'); if (btn) { configTab = btn.dataset.tab; renderConfig(); } };
672+
// Delete button delegation
673+
el.onclick = (e) => { const btn = e.target.closest('[data-del-id]'); if (btn) { del(btn.dataset.delId); } const tabBtn = e.target.closest('[data-tab]'); if (tabBtn) { configTab = tabBtn.dataset.tab; renderConfig(); } };
673674
if (configTab === 'connect' && isHost) {
674675
fetch('/health').then(r=>r.json()).then(d => {
675676
const el = document.getElementById('qr-url');
@@ -695,7 +696,6 @@ <h3 id="modal-title">Add action</h3>
695696
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">${t('language')}</h4>`;
696697
html += `<div style="display:flex;gap:8px"><button onclick="setLang('en')" style="flex:1;padding:10px;border-radius:10px;border:1px solid ${lang==='en'?'var(--accent)':'var(--glass-border)'};background:${lang==='en'?'var(--accent-soft)':'transparent'};color:${lang==='en'?'var(--accent)':'var(--text-dim)'};font-size:12px;font-weight:600;cursor:pointer">English</button><button onclick="setLang('es')" style="flex:1;padding:10px;border-radius:10px;border:1px solid ${lang==='es'?'var(--accent)':'var(--glass-border)'};background:${lang==='es'?'var(--accent-soft)':'transparent'};color:${lang==='es'?'var(--accent)':'var(--text-dim)'};font-size:12px;font-weight:600;cursor:pointer">Español</button></div>`;
697698
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">${t('sound')}</h4><div class="sound-toggle"><span>${t('notifSound')}</span><button class="toggle ${soundEnabled?'on':''}" onclick="toggleSound()"></button></div>`;
698-
html += `<h4 style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;margin-bottom:10px;margin-top:16px">Updates</h4><div id="update-section" style="font-size:12px;color:var(--text-dim)"></div>`;
699699
html += `<details style="margin-top:16px;border:1px solid var(--glass-border);border-radius:10px;overflow:hidden"><summary style="padding:10px 14px;font-size:11px;color:var(--text-dim);cursor:pointer;background:var(--glass)">Debug logs</summary><div style="padding:10px 14px;border-top:1px solid var(--glass-border)"><pre id="debug-logs" style="font-size:10px;color:var(--text-dim);max-height:150px;overflow:auto;white-space:pre-wrap;-webkit-overflow-scrolling:touch;margin:0">${lang==='es'?'Cargando...':'Loading...'}</pre><button id="copy-logs-btn" style="margin-top:8px;padding:6px 12px;border-radius:6px;border:1px solid var(--glass-border);background:var(--glass);color:var(--text-dim);font-size:10px;cursor:pointer">${lang==='es'?'Copiar':'Copy'}</button></div></details>`;
700700
html += `<p id="version-label" style="margin-top:16px;font-size:10px;color:var(--text-dim);text-align:center"></p>`;
701701
html += `</div>`;
@@ -782,23 +782,9 @@ <h3 id="modal-title">Add action</h3>
782782
.catch(() => addNotif('Uninstall failed', 'error'));
783783
}
784784

785-
const CURRENT_VERSION = '0.6.6';
786-
const REPO = 'florextech/deck';
787-
788-
function checkForUpdates() {
789-
const el = document.getElementById('update-section');
790-
if (!el) return;
791-
fetch('/health').then(r=>r.json()).then(h => {
792-
const currentV = h.version || CURRENT_VERSION;
793-
const vLabel = document.getElementById('version-label');
794-
if (vLabel) vLabel.textContent = `Deck v${currentV}`;
795-
el.innerHTML = `<span style="color:var(--green)">v${currentV} ✓</span>`;
796-
}).catch(() => { el.innerHTML = `<span style="color:var(--text-dim)">v${CURRENT_VERSION}</span>`; });
797-
}
798-
799785
// Check on settings render
800786
const origRenderConfig = renderConfig;
801-
renderConfig = function() { origRenderConfig(); if (configTab === 'settings') { setTimeout(checkForUpdates, 200); setTimeout(setupDebugBtn, 300); } };
787+
renderConfig = function() { origRenderConfig(); if (configTab === 'settings') { setTimeout(setupDebugBtn, 200); setTimeout(()=>{ const vl=document.getElementById('version-label'); if(vl) fetch('/health').then(r=>r.json()).then(h=>{vl.textContent='Deck v'+(h.version||'0.7.1')}).catch(()=>{}); },100); } };
802788

803789
function setupDebugBtn() {
804790
const pre = document.getElementById('debug-logs');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "open-deck",
33
"private": true,
4-
"version": "0.7.1",
4+
"version": "0.7.2",
55
"description": "AI Command Center — Open Deck by Florex Labs",
66
"scripts": {
77
"dev": "tsx scripts/qr.ts && concurrently -n server,agent -c blue,magenta \"pnpm dev:server\" \"pnpm dev:agent\"",

0 commit comments

Comments
 (0)