aboutsummaryrefslogtreecommitdiff
path: root/src/components/extra_notifications/extra_notifications.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-11-13 17:26:53 +0200
committerHenry Jameson <me@hjkos.com>2023-11-13 17:26:53 +0200
commitc059f4a7ee16c0128c348c43c9d468e7cfdb5ef7 (patch)
tree12e816bd639f1ef6fa531c0df602e115b2a99ca7 /src/components/extra_notifications/extra_notifications.js
parente0b8ad9f141f418ab3d8ebc7a9e68bcb755c820a (diff)
parent18c0cf1845a95db2d0e894d2455cdd4dc545aaf7 (diff)
Merge remote-tracking branch 'origin/develop' into notifications-thru-sw
Diffstat (limited to 'src/components/extra_notifications/extra_notifications.js')
-rw-r--r--src/components/extra_notifications/extra_notifications.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/components/extra_notifications/extra_notifications.js b/src/components/extra_notifications/extra_notifications.js
new file mode 100644
index 00000000..1bb0f837
--- /dev/null
+++ b/src/components/extra_notifications/extra_notifications.js
@@ -0,0 +1,48 @@
+import { mapGetters } from 'vuex'
+
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faUserPlus,
+ faComments,
+ faBullhorn
+} from '@fortawesome/free-solid-svg-icons'
+
+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
+ },
+ currentUser () {
+ return this.$store.state.users.currentUser
+ },
+ ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount', 'followRequestCount', 'mergedConfig'])
+ },
+ methods: {
+ openNotificationSettings () {
+ return this.$store.dispatch('openSettingsModalTab', 'notifications')
+ },
+ dismissConfigurationTip () {
+ return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
+ }
+ }
+}
+
+export default ExtraNotifications