diff --git a/client/app.js b/client/app.js index cafd8f0..ea593ec 100644 --- a/client/app.js +++ b/client/app.js @@ -126,15 +126,42 @@ const active = s.session_id === currentSession ? ' active' : ''; return `
-
${escHtml(name)}
-
${escHtml(preview)}
-
${time}
+
+
${escHtml(name)}
+
${escHtml(preview)}
+
${time}
+
+
`; }).join(''); sessionList.querySelectorAll('.session-item').forEach(el => { el.addEventListener('click', () => switchSession(el.dataset.id)); }); + sessionList.querySelectorAll('.btn-delete').forEach(btn => { + btn.addEventListener('click', (e) => { + e.stopPropagation(); + deleteSession(btn.dataset.id); + }); + }); +} + +async function deleteSession(sessionId) { + try { + await fetch(`${API}/sessions/${sessionId}`, { method: 'DELETE' }); + } catch (e) { + console.error('Failed to delete session', e); + } + sessions = sessions.filter(s => s.session_id !== sessionId); + + if (currentSession === sessionId) { + disconnectWS(); + currentSession = null; + messagesEl.innerHTML = '
💬

Start a new conversation

'; + chatHeader.textContent = 'Select a profile and start a new chat'; + setInputEnabled(false); + } + renderSessionList(); } function updateSessionPreview(sessionId, text) { diff --git a/client/style.css b/client/style.css index d4951e3..c5f2136 100644 --- a/client/style.css +++ b/client/style.css @@ -2,26 +2,26 @@ :root { --sidebar-w: 260px; - --bg: #f0f2f5; - --sidebar-bg: #ffffff; - --border: #e0e0e0; - --text: #1a1a1a; - --text-muted: #777; - --accent: #0066ff; - --accent-hover: #0052cc; - --user-bubble: #0066ff; + --bg: #111111; + --sidebar-bg: #1a1a1a; + --border: #2a2a2a; + --text: #e0e0e0; + --text-muted: #666; + --accent: #3b82f6; + --accent-hover: #2563eb; + --user-bubble: #2563eb; --user-text: #ffffff; - --bot-bubble: #ffffff; - --bot-text: #1a1a1a; - --tool-bg: #fffbe6; - --tool-border: #ffe58f; - --tool-text: #7d6000; - --error-bg: #fff1f0; - --error-border: #ffccc7; - --error-text: #a8071a; - --input-bg: #ffffff; + --bot-bubble: #212121; + --bot-text: #e0e0e0; + --tool-bg: #1f1a0e; + --tool-border: #4a3800; + --tool-text: #c9a227; + --error-bg: #1f0e0e; + --error-border: #5c1a1a; + --error-text: #f87171; + --input-bg: #1e1e1e; --radius: 12px; - --shadow: 0 1px 3px rgba(0,0,0,0.08); + --shadow: 0 1px 4px rgba(0,0,0,0.4); } html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; color: var(--text); background: var(--bg); } @@ -101,12 +101,35 @@ transition: background 0.1s; margin-bottom: 2px; } -.session-item:hover { background: var(--bg); } -.session-item.active { background: #e8f0ff; } +.session-item:hover { background: #222; } +.session-item.active { background: #1a2540; } .session-item .s-profile { font-size: 11px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; } .session-item .s-preview { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .session-item .s-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; } +.session-item .s-body { flex: 1; min-width: 0; } +.session-item { display: flex; align-items: center; gap: 6px; } + +.btn-delete { + flex-shrink: 0; + width: 22px; + height: 22px; + background: none; + border: none; + border-radius: 5px; + color: var(--text-muted); + font-size: 15px; + line-height: 1; + cursor: pointer; + opacity: 0; + transition: opacity 0.15s, background 0.15s, color 0.15s; + display: flex; + align-items: center; + justify-content: center; +} +.session-item:hover .btn-delete { opacity: 1; } +.btn-delete:hover { background: #3d1a1a; color: var(--error-text); } + .empty-sessions { padding: 20px 12px; color: var(--text-muted); font-size: 13px; text-align: center; } /* ── Main chat area ──────────────────────────────────── */ @@ -289,4 +312,4 @@ /* ── Scrollbar ───────────────────────────────────────── */ ::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-track { background: transparent; } -::-webkit-scrollbar-thumb { background: #ccc; border-radius: 99px; } +::-webkit-scrollbar-thumb { background: #333; border-radius: 99px; }