diff options
author | Kostiantyn Miakshyn <molodchick@gmail.com> | 2025-03-03 16:38:07 +0100 |
---|---|---|
committer | Kostiantyn Miakshyn <molodchick@gmail.com> | 2025-03-03 16:42:06 +0100 |
commit | 15a1b00028fd725ea2e96a7d83d7ad96f9e3c73a (patch) | |
tree | 8bcae5562651e040c0bad4fd434e1956fdcad96f | |
parent | 6cd30463699fda1dc0b9c2e99f497bdef56a293e (diff) | |
download | nextcloud-server-feature/highlight-active-menu.tar.gz nextcloud-server-feature/highlight-active-menu.zip |
feat: Add event to highlight active menufeature/highlight-active-menu
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
-rw-r--r-- | core/src/components/AppMenu.vue | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/components/AppMenu.vue b/core/src/components/AppMenu.vue index 88f626ff569..1bf1af8d24c 100644 --- a/core/src/components/AppMenu.vue +++ b/core/src/components/AppMenu.vue @@ -88,10 +88,12 @@ export default defineComponent({ mounted() { subscribe('nextcloud:app-menu.refresh', this.setApps) + subscribe('nextcloud:app-menu.active', this.setActive) }, beforeDestroy() { unsubscribe('nextcloud:app-menu.refresh', this.setApps) + unsubscribe('nextcloud:app-menu.active', this.setActive) }, methods: { @@ -104,6 +106,19 @@ export default defineComponent({ } }, + setActive(id: string) { + this.appList.forEach((app) => { + this.$set(app, 'active', false) + }) + + const app = this.appList.find(({ id: menuItemId }) => menuItemId === id) + if (app) { + this.$set(app, 'active', true) + } else { + logger.warn(`Could not find app "${id}" for setting navigation count`) + } + }, + setApps({ apps }: { apps: INavigationEntry[]}) { this.appList = apps }, |