feat(plugin): sidebar nav buttons for Adwright + BTE (v0.5.0)
plugin-tests / test (push) Failing after 5s
plugin-tests / test (push) Failing after 5s
JP feedback: floating BTE launcher + always-visible Adwright panel were
"very fucked up" UX. Replaced with proper hermes-webui sidebar integration.
New static/svrnty_nav.js:
- Injects 2 nav-tab buttons into .sidebar-nav matching the existing
data-panel + nav-tab + has-tooltip pattern
- Adwright: bullseye icon (marketing intelligence)
- BTE: sparkle/palette icon (creative studio)
- Wraps window.switchPanel to add main.svrnty-showing-{adwright,bte}
classes so our panels participate in the existing main-view show/hide
system without editing upstream panels.js
- Dispatches "svrnty:panel-switch" CustomEvent so panel modules can
lazy-init / open / close based on which panel is active
Adwright panel:
- adwright.css: hidden by default; shows only when main has
.svrnty-showing-adwright. When showing, occupies full main width
and hides all other main children (chat etc).
- adwright.js: no change to mount logic (already mounted inside <main>).
BTE panel:
- bte.js: removed _installLauncher (no more floating bottom-right button).
Init now listens for svrnty:panel-switch events to open/close the
overlay. Defensively removes any stale .svrnty-bte-launcher DOM nodes
from prior plugin versions.
- bte.css: launcher styles replaced with display:none !important.
manifest.yaml: bumped 0.4.0 → 0.5.0, svrnty_nav.js added to assets in
the correct load order (after app.js, before adwright.js + bte.js).
CONNECTION-MAP regenerated.
Karpathy 4 rules: no upstream edit, smallest possible wrap of switchPanel
to keep our panels coexisting with native panels (chat, tasks, kanban,
etc), CSS-only visibility (no DOM thrashing).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+14
-22
@@ -58,29 +58,21 @@
|
||||
};
|
||||
window.SvrntyBTE = SvrntyBTE;
|
||||
|
||||
// ── Init: inject launcher button when DOM ready ─────────────────────────
|
||||
// ── Init: listen for sidebar nav events from svrnty_nav.js ───────────────
|
||||
// The floating launcher is gone; sidebar button (injected by svrnty_nav.js)
|
||||
// calls switchPanel('bte') which sets main.svrnty-showing-bte. We mirror
|
||||
// that with overlay open/close + remove any stale launcher from prior load.
|
||||
function _init() {
|
||||
_installLauncher();
|
||||
// Some WebUI flows rebuild body content; re-install on DOM mutations.
|
||||
const observer = new MutationObserver(() => _installLauncher());
|
||||
observer.observe(document.body, { childList: true, subtree: false });
|
||||
}
|
||||
|
||||
function _installLauncher() {
|
||||
if (document.querySelector(".svrnty-bte-launcher")) return;
|
||||
const btn = document.createElement("button");
|
||||
btn.className = "svrnty-bte-launcher";
|
||||
btn.type = "button";
|
||||
btn.title = "Open BTE Command Center";
|
||||
btn.innerHTML =
|
||||
'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
|
||||
'<rect x="3" y="3" width="7" height="7" rx="1"/>' +
|
||||
'<rect x="14" y="3" width="7" height="7" rx="1"/>' +
|
||||
'<rect x="3" y="14" width="7" height="7" rx="1"/>' +
|
||||
'<rect x="14" y="14" width="7" height="7" rx="1"/>' +
|
||||
'</svg>BTE Command Center';
|
||||
btn.addEventListener("click", _openOverlay);
|
||||
document.body.appendChild(btn);
|
||||
// Remove any prior floating launcher (older plugin versions injected one).
|
||||
document.querySelectorAll(".svrnty-bte-launcher").forEach((el) => el.remove());
|
||||
window.addEventListener("svrnty:panel-switch", (ev) => {
|
||||
const name = ev && ev.detail && ev.detail.name;
|
||||
if (name === "bte") _openOverlay();
|
||||
else _closeOverlay();
|
||||
});
|
||||
// If page boots already on bte (deep link via switchPanel), show now.
|
||||
const main = document.querySelector("main.main");
|
||||
if (main && main.classList.contains("svrnty-showing-bte")) _openOverlay();
|
||||
}
|
||||
|
||||
// ── Overlay lifecycle ────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user