refactor(tabs): consolidate [+] button with app-switcher sidebar

The tab bar [+] button now opens the same sidebar as the header's
rApp dropdown instead of its own duplicate menu. Reduces UI clutter
and gives one consistent place to browse/add rApps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-31 04:47:59 +00:00
parent 71452a6b31
commit 2d39fcac1d
2 changed files with 14 additions and 6 deletions

View File

@ -557,6 +557,12 @@ export class RStackAppSwitcher extends HTMLElement {
this.#render();
}
/** Open the sidebar programmatically (used by tab bar [+] button) */
open() {
this.#isOpen = true;
this.#render();
}
#getSpaceSlug(): string {
// Read from the space switcher or URL
const spaceSwitcher = document.querySelector("rstack-space-switcher");

View File

@ -1085,16 +1085,18 @@ export class RStackTabBar extends HTMLElement {
});
});
// Add button — click + touch support
// Add button — open the header's app-switcher sidebar
const addBtn = this.#shadow.getElementById("add-btn");
const toggleAddMenu = (e: Event) => {
const openAppSwitcher = (e: Event) => {
e.stopPropagation();
e.preventDefault();
this.#addMenuOpen = !this.#addMenuOpen;
this.#render();
const switcher = document.querySelector("rstack-app-switcher") as any;
if (switcher?.open) {
switcher.open();
}
};
addBtn?.addEventListener("click", toggleAddMenu);
addBtn?.addEventListener("touchend", toggleAddMenu);
addBtn?.addEventListener("click", openAppSwitcher);
addBtn?.addEventListener("touchend", openAppSwitcher);
// Add menu items — click + touch support
this.#shadow.querySelectorAll<HTMLElement>(".add-menu-item").forEach(item => {