pleroma-fe/src/components/extra_notifications/extra_notifications.js

55 lines
1.8 KiB
JavaScript
Raw Normal View History

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-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
)
const ExtraNotifications = {
computed: {
shouldShowChats () {
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showChatsInExtraNotifications && this.unreadChatCount
},
shouldShowAnnouncements () {
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showAnnouncementsInExtraNotifications && this.unreadAnnouncementCount
},
shouldShowFollowRequests () {
return this.mergedConfig.showExtraNotifications && this.mergedConfig.showFollowRequestsInExtraNotifications && this.followRequestCount
},
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'
})
},
methods: {
openNotificationSettings () {
2025-02-03 00:14:44 +02:00
return useInterfaceStore().openSettingsModalTab('notifications')
},
dismissConfigurationTip () {
return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
}
}
}
export default ExtraNotifications