'use strict'; /* admin → sessions section: sessions timeline + drawer detail */ (function () { 'use strict'; let inited = false; let allSessions = []; // Phase 6: clicking a session row navigates to the deep page (#sessions/:id) // instead of toggling an inline drawer. The drawer rendering is gone. function gotoSession(id) { if (window.AdminRouter) AdminRouter.navigate('#sessions/' + id); } /* SVG icons (Lucide-style) — kept local to mirror users.js without coupling */ const SESS_ICONS = { eye: '', trash: '', }; /* Inject .row-actions / .row-action-btn styles only if users.js hasn't (sessions can render first). */ function ensureRowActionsStyles() { if (document.getElementById('row-actions-style')) return; const s = document.createElement('style'); s.id = 'row-actions-style'; s.textContent = ` .row-actions { opacity: 0; transition: opacity .15s ease; display: inline-flex; gap: 4px; vertical-align: middle; } tr:hover .row-actions, .sess-tl-item:hover .row-actions { opacity: 1; } tr.selected .row-actions, .sess-tl-item.open .row-actions { opacity: 1; } .row-action-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); transition: background .12s ease, border-color .12s ease, color .12s ease; padding: 0; } .row-action-btn:hover { background: rgba(155,93,229,.08); border-color: var(--violet); color: var(--violet); } .row-action-btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; } .row-action-btn.danger:hover { background: rgba(239,68,68,.08); border-color: var(--red, #EF4444); color: var(--red, #EF4444); } .row-action-btn svg { width: 14px; height: 14px; pointer-events: none; } .row-action-btn:disabled { opacity: .5; cursor: wait; } .row-actions-cell { text-align: right; white-space: nowrap; padding-right: 12px; } @media (max-width: 768px) { .row-actions { display: none; } } `; document.head.appendChild(s); } async function load() { const subject = document.getElementById('t-subject').value; document.getElementById('t-body').innerHTML = '
'; ensureRowActionsStyles(); try { allSessions = await LS.adminGetSessions({ subject: subject || undefined }); renderSessions(); } catch (e) { document.getElementById('t-body').innerHTML = `