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:
parent
71452a6b31
commit
2d39fcac1d
|
|
@ -557,6 +557,12 @@ export class RStackAppSwitcher extends HTMLElement {
|
||||||
this.#render();
|
this.#render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Open the sidebar programmatically (used by tab bar [+] button) */
|
||||||
|
open() {
|
||||||
|
this.#isOpen = true;
|
||||||
|
this.#render();
|
||||||
|
}
|
||||||
|
|
||||||
#getSpaceSlug(): string {
|
#getSpaceSlug(): string {
|
||||||
// Read from the space switcher or URL
|
// Read from the space switcher or URL
|
||||||
const spaceSwitcher = document.querySelector("rstack-space-switcher");
|
const spaceSwitcher = document.querySelector("rstack-space-switcher");
|
||||||
|
|
|
||||||
|
|
@ -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 addBtn = this.#shadow.getElementById("add-btn");
|
||||||
const toggleAddMenu = (e: Event) => {
|
const openAppSwitcher = (e: Event) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.#addMenuOpen = !this.#addMenuOpen;
|
const switcher = document.querySelector("rstack-app-switcher") as any;
|
||||||
this.#render();
|
if (switcher?.open) {
|
||||||
|
switcher.open();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
addBtn?.addEventListener("click", toggleAddMenu);
|
addBtn?.addEventListener("click", openAppSwitcher);
|
||||||
addBtn?.addEventListener("touchend", toggleAddMenu);
|
addBtn?.addEventListener("touchend", openAppSwitcher);
|
||||||
|
|
||||||
// Add menu items — click + touch support
|
// Add menu items — click + touch support
|
||||||
this.#shadow.querySelectorAll<HTMLElement>(".add-menu-item").forEach(item => {
|
this.#shadow.querySelectorAll<HTMLElement>(".add-menu-item").forEach(item => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue