Move announcements module to store
This commit is contained in:
parent
e3ca5b0a32
commit
f9254e5fb7
13 changed files with 160 additions and 153 deletions
|
|
@ -76,6 +76,7 @@ export const ROOT_ITEMS = {
|
|||
route: 'announcements',
|
||||
icon: 'bullhorn',
|
||||
label: 'nav.announcements',
|
||||
store: 'announcements',
|
||||
badgeGetter: 'unreadAnnouncementCount',
|
||||
criteria: ['announcements']
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { routeTo } from 'src/components/navigation/navigation.js'
|
|||
import OptionalRouterLink from 'src/components/optional_router_link/optional_router_link.vue'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
||||
import { mapStores } from 'pinia'
|
||||
import { useAnnouncementsStore } from '../../stores/announcements'
|
||||
|
||||
library.add(faThumbtack)
|
||||
|
||||
|
|
@ -31,6 +33,7 @@ const NavigationEntry = {
|
|||
getters () {
|
||||
return this.$store.getters
|
||||
},
|
||||
...mapStores(useAnnouncementsStore),
|
||||
...mapState({
|
||||
currentUser: state => state.users.currentUser,
|
||||
pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,12 @@
|
|||
>
|
||||
{{ getters[item.badgeGetter] }}
|
||||
</div>
|
||||
<div
|
||||
v-else-if="item.badgeGetter && item.store && this[`${item.store}Store`][item.badgeGetter]"
|
||||
class="badge badge-notification"
|
||||
>
|
||||
{{ this[`${item.store}Store`][item.badgeGetter] }}
|
||||
</div>
|
||||
<button
|
||||
v-if="showPin && currentUser"
|
||||
type="button"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue