Compare commits

...

1 Commits

Author SHA1 Message Date
Kostiantyn Miakshyn 15a1b00028 feat: Add event to highlight active menu
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
2025-03-03 16:42:06 +01:00
+15
View File
@@ -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
},