From 12a3c238b8ff3ec56d170698fbef07e23821d1be Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Sat, 16 Oct 2021 16:38:30 +0200 Subject: [PATCH] feat: use computed for namespace title --- src/components/home/navigation.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index 2cc7a114..2476f470 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -54,14 +54,14 @@ + v-tooltip="namespaceTitles[nk]"> - {{ getNamespaceTitle(n) }} ({{ n.lists.filter(l => !l.isArchived).length }}) + {{ namespaceTitles[nk] }} state[LOADING] && state[LOADING_MODULE] === 'namespaces', }), activeLists() { - return this.namespaces.map(({lists}) => lists.filter(item => !item.isArchived)) + return this.namespaces.map(({lists}) => lists?.filter(item => !item.isArchived)) + }, + namespaceTitles() { + return this.namespaces.map((namespace, index) => { + const title = this.getNamespaceTitle(namespace) + return `${title} (${this.activeLists[index]?.length ?? 0})` + }) }, }, beforeCreate() { @@ -229,7 +235,7 @@ export default { } }, toggleLists(namespaceId) { - this.listsVisible[namespaceId] = !this.listsVisible[namespaceId] ?? false + this.listsVisible[namespaceId] = !this.listsVisible[namespaceId] }, updateActiveLists(namespace, activeLists) { // this is a bit hacky: since we do have to filter out the archived items from the list