2023-08-13 23:57:34 -04:00
|
|
|
import { mapGetters } from 'vuex'
|
2025-01-30 21:56:07 +02:00
|
|
|
import { mapState as mapPiniaState } from 'pinia'
|
2025-02-03 13:02:14 +02:00
|
|
|
import { useAnnouncementsStore } from 'src/stores/announcements'
|
2023-08-13 23:57:34 -04:00
|
|
|
|
2023-08-18 21:35:56 -04:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
|
|
|
|
faUserPlus,
|
|
|
|
|
faComments,
|
|
|
|
|
faBullhorn
|
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
2025-02-03 13:02:14 +02:00
|
|
|
import { useInterfaceStore } from 'src/stores/interface'
|
2025-02-03 00:14:44 +02:00
|
|
|
|
2023-08-18 21:35:56 -04:00
|
|
|
library.add(
|
|
|
|
|
faUserPlus,
|
|
|
|
|
faComments,
|
|
|
|
|
faBullhorn
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-13 23:57:34 -04:00
|
|
|
const ExtraNotifications = {
|
|
|
|
|
computed: {
|
2023-08-18 20:02:58 -04:00
|
|
|
shouldShowChats () {
|
2023-08-18 20:34:27 -04:00
|
|
|
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showChatsInExtraNotifications && this.unreadChatCount
|
2023-08-18 20:02:58 -04:00
|
|
|
},
|
|
|
|
|
shouldShowAnnouncements () {
|
2023-08-18 20:34:27 -04:00
|
|
|
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showAnnouncementsInExtraNotifications && this.unreadAnnouncementCount
|
2023-08-18 20:02:58 -04:00
|
|
|
},
|
|
|
|
|
shouldShowFollowRequests () {
|
2023-08-18 20:34:27 -04:00
|
|
|
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showFollowRequestsInExtraNotifications && this.followRequestCount
|
2023-08-18 20:02:58 -04:00
|
|
|
},
|
2023-08-18 20:34:27 -04:00
|
|
|
hasAnythingToShow () {
|
|
|
|
|
return this.shouldShowChats || this.shouldShowAnnouncements || this.shouldShowFollowRequests
|
|
|
|
|
},
|
|
|
|
|
shouldShowCustomizationTip () {
|
|
|
|
|
return this.mergedConfig.showExtraNotificationsTip && this.hasAnythingToShow
|
|
|
|
|
},
|
2023-08-18 20:39:14 -04:00
|
|
|
currentUser () {
|
|
|
|
|
return this.$store.state.users.currentUser
|
|
|
|
|
},
|
2025-01-30 21:56:07 +02:00
|
|
|
...mapGetters(['unreadChatCount', 'followRequestCount', 'mergedConfig']),
|
|
|
|
|
...mapPiniaState(useAnnouncementsStore, {
|
|
|
|
|
unreadAnnouncementCount: 'unreadAnnouncementCount'
|
|
|
|
|
})
|
2023-08-18 20:34:27 -04:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
openNotificationSettings () {
|
2025-02-03 00:14:44 +02:00
|
|
|
return useInterfaceStore().openSettingsModalTab('notifications')
|
2023-08-18 20:34:27 -04:00
|
|
|
},
|
|
|
|
|
dismissConfigurationTip () {
|
|
|
|
|
return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
|
|
|
|
|
}
|
2023-08-13 23:57:34 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ExtraNotifications
|