Show badges for unread announcements
This commit is contained in:
parent
60e2912005
commit
bb2940d541
|
@ -47,7 +47,7 @@ const MobileNav = {
|
|||
isChat () {
|
||||
return this.$route.name === 'chat'
|
||||
},
|
||||
...mapGetters(['unreadChatCount'])
|
||||
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
||||
},
|
||||
methods: {
|
||||
toggleMobileSidebar () {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
icon="bars"
|
||||
/>
|
||||
<div
|
||||
v-if="unreadChatCount"
|
||||
v-if="unreadChatCount || unreadAnnouncementCount"
|
||||
class="alert-dot"
|
||||
/>
|
||||
</button>
|
||||
|
|
|
@ -57,7 +57,7 @@ const NavPanel = {
|
|||
federating: state => state.instance.federating,
|
||||
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
|
||||
}),
|
||||
...mapGetters(['unreadChatCount'])
|
||||
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,12 @@
|
|||
class="fa-scale-110"
|
||||
icon="bullhorn"
|
||||
/>{{ $t('nav.announcements') }}
|
||||
<span
|
||||
v-if="unreadAnnouncementCount > 0"
|
||||
class="badge badge-notification"
|
||||
>
|
||||
{{ unreadAnnouncementCount }}
|
||||
</span>
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -60,7 +60,7 @@ const Notifications = {
|
|||
return this.unseenNotifications.length
|
||||
},
|
||||
unseenCountTitle () {
|
||||
return this.unseenCount + (this.unreadChatCount)
|
||||
return this.unseenCount + (this.unreadChatCount) + this.unreadAnnouncementCount
|
||||
},
|
||||
loading () {
|
||||
return this.$store.state.statuses.notifications.loading
|
||||
|
@ -68,7 +68,7 @@ const Notifications = {
|
|||
notificationsToDisplay () {
|
||||
return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount)
|
||||
},
|
||||
...mapGetters(['unreadChatCount'])
|
||||
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
||||
},
|
||||
watch: {
|
||||
unseenCountTitle (count) {
|
||||
|
|
|
@ -86,7 +86,7 @@ const SideDrawer = {
|
|||
...mapState({
|
||||
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
|
||||
}),
|
||||
...mapGetters(['unreadChatCount'])
|
||||
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
||||
},
|
||||
methods: {
|
||||
toggleDrawer () {
|
||||
|
|
|
@ -190,6 +190,12 @@
|
|||
class="fa-scale-110 fa-old-padding"
|
||||
icon="bullhorn"
|
||||
/> {{ $t("nav.announcements") }}
|
||||
<span
|
||||
v-if="unreadAnnouncementCount"
|
||||
class="badge badge-notification"
|
||||
>
|
||||
{{ unreadAnnouncementCount }}
|
||||
</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li
|
||||
|
|
|
@ -25,9 +25,18 @@ export const mutations = {
|
|||
}
|
||||
}
|
||||
|
||||
export const getters = {
|
||||
unreadAnnouncementCount (state) {
|
||||
return state.announcements.reduce((acc, cur) => {
|
||||
return (!cur.inactive && !cur.read) ? acc + 1 : acc
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
const announcements = {
|
||||
state: defaultState,
|
||||
mutations,
|
||||
getters,
|
||||
actions: {
|
||||
fetchAnnouncements (store) {
|
||||
const currentUser = store.rootState.users.currentUser
|
||||
|
|
Loading…
Reference in New Issue