From 19b5bb06a0cdf397d6cb884d2a898492e83d4a41 Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 10 Mar 2023 20:22:41 -0500 Subject: [PATCH] Add draft count to nav panel --- src/components/navigation/navigation.js | 3 ++- src/modules/drafts.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/navigation/navigation.js b/src/components/navigation/navigation.js index 41685cda..c3071c8c 100644 --- a/src/components/navigation/navigation.js +++ b/src/components/navigation/navigation.js @@ -82,7 +82,8 @@ export const ROOT_ITEMS = { drafts: { route: 'drafts', icon: 'file-pen', - label: 'nav.drafts' + label: 'nav.drafts', + badgeGetter: 'draftCount' } } diff --git a/src/modules/drafts.js b/src/modules/drafts.js index 808e6837..01eb3dcf 100644 --- a/src/modules/drafts.js +++ b/src/modules/drafts.js @@ -31,6 +31,9 @@ export const getters = { }, draftsArray (state) { return Object.values(state.drafts) + }, + draftCount (state) { + return Object.values(state.drafts).length } }