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

72 lines
1.9 KiB
JavaScript
Raw Normal View History

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