(connected, refs)
| 14 | // ─── Connection Status Pill ────────────────────────────────── |
| 15 | |
| 16 | function showStatusPill(connected, refs) { |
| 17 | refCount = refs || 0; |
| 18 | |
| 19 | if (!statusPill) { |
| 20 | statusPill = document.createElement('div'); |
| 21 | statusPill.id = 'gstack-status-pill'; |
| 22 | statusPill.style.cursor = 'pointer'; |
| 23 | statusPill.addEventListener('click', () => { |
| 24 | // Ask background to open the side panel |
| 25 | chrome.runtime.sendMessage({ type: 'openSidePanel' }); |
| 26 | }); |
| 27 | document.body.appendChild(statusPill); |
| 28 | } |
| 29 | |
| 30 | if (!connected) { |
| 31 | statusPill.style.display = 'none'; |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | const refText = refCount > 0 ? ` · ${refCount} refs` : ''; |
| 36 | statusPill.innerHTML = `<span class="gstack-pill-dot"></span> gstack${refText}`; |
| 37 | statusPill.style.display = 'flex'; |
| 38 | statusPill.style.opacity = '1'; |
| 39 | |
| 40 | // Fade to subtle after 3s |
| 41 | clearTimeout(pillFadeTimer); |
| 42 | pillFadeTimer = setTimeout(() => { |
| 43 | statusPill.style.opacity = '0.3'; |
| 44 | }, 3000); |
| 45 | } |
| 46 | |
| 47 | function hideStatusPill() { |
| 48 | if (statusPill) { |
no test coverage detected