Display extra notifications on notifications column

This commit is contained in:
tusooa 2023-08-13 23:57:34 -04:00
parent a1641193b5
commit 0d6a9e8a64
No known key found for this signature in database
GPG Key ID: 42AEC43D48433C51
5 changed files with 67 additions and 2 deletions

View File

@ -0,0 +1,9 @@
import { mapGetters } from 'vuex'
const ExtraNotifications = {
computed: {
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
}
}
export default ExtraNotifications

View File

@ -0,0 +1,42 @@
<template>
<div class="ExtraNotifications">
<router-link
v-if="unreadChatCount"
class="button-unstyled -link extra-notification"
to="chats"
>
{{ $tc('notifications.unread_chats', unreadChatCount, { num: unreadChatCount }) }}
</router-link>
<router-link
v-if="unreadAnnouncementCount"
class="button-unstyled -link extra-notification"
to="announcements"
>
{{ $tc('notifications.unread_announcements', unreadAnnouncementCount, { num: unreadAnnouncementCount }) }}
</router-link>
</div>
</template>
<script src="./extra_notifications.js" />
<style lang="scss">
@import "../../variables";
.ExtraNotifications {
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
.extra-notification {
width: 100%;
padding: 1em;
}
.extra-notification {
border-bottom: 1px solid;
border-color: $fallback--border;
border-color: var(--border, $fallback--border);
}
}
</style>

View File

@ -1,6 +1,7 @@
import { computed } from 'vue' import { computed } from 'vue'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Notification from '../notification/notification.vue' import Notification from '../notification/notification.vue'
import ExtraNotifications from '../extra_notifications/extra_notifications.vue'
import NotificationFilters from './notification_filters.vue' import NotificationFilters from './notification_filters.vue'
import notificationsFetcher from '../../services/notifications_fetcher/notifications_fetcher.service.js' import notificationsFetcher from '../../services/notifications_fetcher/notifications_fetcher.service.js'
import { import {
@ -23,7 +24,8 @@ const DEFAULT_SEEN_TO_DISPLAY_COUNT = 30
const Notifications = { const Notifications = {
components: { components: {
Notification, Notification,
NotificationFilters NotificationFilters,
ExtraNotifications
}, },
props: { props: {
// Disables panel styles, unread mark, potentially other notification-related actions // Disables panel styles, unread mark, potentially other notification-related actions
@ -94,6 +96,9 @@ const Notifications = {
return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount) return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount)
}, },
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders }, noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
showExtraNotifications () {
return true
},
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']) ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
}, },
mounted () { mounted () {

View File

@ -54,6 +54,13 @@
class="panel-body" class="panel-body"
role="feed" role="feed"
> >
<div
v-if="showExtraNotifications"
role="listitem"
class="notification"
>
<extra-notifications />
</div>
<div <div
v-for="notification in notificationsToDisplay" v-for="notification in notificationsToDisplay"
:key="notification.id" :key="notification.id"

View File

@ -205,7 +205,9 @@
"migrated_to": "migrated to", "migrated_to": "migrated to",
"reacted_with": "reacted with {0}", "reacted_with": "reacted with {0}",
"submitted_report": "submitted a report", "submitted_report": "submitted a report",
"poll_ended": "poll has ended" "poll_ended": "poll has ended",
"unread_announcements": "{num} unread announcement | {num} unread announcements",
"unread_chats": "{num} unread chat | {num} unread chats"
}, },
"polls": { "polls": {
"add_poll": "Add poll", "add_poll": "Add poll",