Fix notification styling

This commit is contained in:
kolaente 2021-04-18 17:21:14 +02:00
parent 747a9fe505
commit adc0f23b49
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 24 additions and 10 deletions

View file

@ -16,16 +16,22 @@
<div class="read-indicator" :class="{'read': n.readAt !== null}"></div>
<user
:user="n.notification.doer"
:show-username="true"
:show-username="false"
:avatar-size="16"
v-if="n.notification.doer"/>
<span class="detail">
<p>
<span class="has-text-weight-bold" v-if="n.notification.doer">
{{ n.notification.doer.getDisplayName() }}
</span>
<a @click="() => to(n, index)()">
{{ n.toText(userInfo) }}
</a>
<span class="created" v-tooltip="formatDate(n.created)">
</p>
<div class="created" v-tooltip="formatDate(n.created)">
{{ formatDateSince(n.created) }}
</span>
</div>
</span>
</div>
<p class="nothing" v-if="notifications.length === 0">
@ -52,7 +58,7 @@ export default {
data() {
return {
notificationService: NotificationService,
notifications: [],
allNotifications: [],
showNotifications: false,
interval: null,
}
@ -73,6 +79,9 @@ export default {
unreadNotifications() {
return this.notifications.filter(n => n.readAt === null).length
},
notifications() {
return this.allNotifications.filter(n => n.name !== '')
},
...mapState({
userInfo: state => state.auth.info,
}),
@ -86,7 +95,7 @@ export default {
loadNotifications() {
this.notificationService.getAll()
.then(r => {
this.$set(this, 'notifications', r)
this.$set(this, 'allNotifications', r)
})
.catch(e => {
this.error(e, this)
@ -125,7 +134,7 @@ export default {
n.read = true
this.notificationService.update(n)
.then(r => {
this.$set(this.notifications, index, r)
this.$set(this.allNotifications, index, r)
})
.catch(e => this.error(e, this))
}

View file

@ -49,6 +49,7 @@
.single-notification {
display: flex;
align-items: center;
padding: 0.25rem 0;
transition: background-color $transition;
@ -70,10 +71,10 @@
}
.user {
display: flex;
display: inline-flex;
align-items: center;
width: auto;
margin-right: .25rem;
margin: 0 .5rem;
span {
font-family: $family-sans-serif;
@ -82,9 +83,13 @@
.avatar {
height: 16px;
}
img {
margin-right: 0;
}
}
.detail .created {
.created {
color: $grey-400;
}