diff --git a/webapp/pages/notifications/index.vue b/webapp/pages/notifications/index.vue
index f59eef2f1..0c404dc04 100644
--- a/webapp/pages/notifications/index.vue
+++ b/webapp/pages/notifications/index.vue
@@ -15,7 +15,28 @@
@markNotificationAsRead="markNotificationAsRead"
:notifications="notifications"
/>
-
+
+
+
+
+
+
+
@@ -23,7 +44,7 @@
import NotificationsTable from '~/components/NotificationsTable/NotificationsTable'
import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
import PaginationButtons from '~/components/_new/generic/PaginationButtons/PaginationButtons'
-import { notificationQuery, markAsReadMutation } from '~/graphql/User'
+import { notificationQuery, markAsReadMutation, markAllAsReadMutation } from '~/graphql/User'
export default {
components: {
@@ -54,6 +75,15 @@ export default {
{ label: this.$t('notifications.filterLabel.unread'), value: false },
]
},
+ hasNotifications() {
+ return this.notifications.length
+ },
+ unreadNotificationsCount() {
+ const result = this.notifications.reduce((count, notification) => {
+ return notification.read ? count : count + 1
+ }, 0)
+ return result
+ },
},
methods: {
filter(option) {
@@ -77,6 +107,19 @@ export default {
next() {
this.offset += this.pageSize
},
+ async markAllAsRead() {
+ if (!this.hasNotifications) {
+ return
+ }
+
+ try {
+ await this.$apollo.mutate({
+ mutation: markAllAsReadMutation(this.$i18n),
+ })
+ } catch (error) {
+ this.$toast.error(error.message)
+ }
+ },
},
apollo: {
notifications: {
@@ -112,4 +155,8 @@ export default {
.notifications-page-flex {
justify-content: space-between;
}
+
+.notifications-footer {
+ text-align: center;
+}