Improved notifications view

This commit is contained in:
Eduard Urbach 2018-02-28 23:26:06 +01:00
parent fceec3f193
commit 25c70eba0d
6 changed files with 38 additions and 11 deletions

View File

@ -97,3 +97,8 @@ sidebar-spacing-y = 0.7rem
background badge-important-bg-color
color badge-important-text-color
font-weight bold
:hover
background badge-important-hover-bg-color
color badge-important-text-color
text-shadow none

View File

@ -1,6 +1,12 @@
component Notifications(notifications []*arn.Notification, user *arn.User)
h1 Notifications
.corner-buttons
button.action(data-action="markNotificationsAsSeen", data-trigger="click")
Icon("check")
span Mark all as seen
.notifications-container
.notifications
each notification in notifications
Notification(notification)
@ -11,6 +17,7 @@ component Notification(notification *arn.Notification)
img.lazy(data-src=notification.Icon, alt=notification.Title)
.notification-info
h3= notification.Title
p= notification.Message
h3.notification-title= notification.Title
.notification-footer
p.notification-text= notification.Message
.notification-date.utc-date(data-date=notification.Created)

View File

@ -1,5 +1,11 @@
.notifications-container
horizontal
justify-content center
.notifications
vertical
width 100%
max-width 800px
.notification
horizontal
@ -17,6 +23,14 @@
.notification-info
vertical
flex 1
.notification-footer
horizontal
.notification-text
flex 1
margin 0
.notification-date
opacity 0.5

View File

@ -13,8 +13,11 @@ export async function disableNotifications(arn: AnimeNotifier, button: HTMLEleme
}
// Test notification
export function testNotification(arn: AnimeNotifier) {
fetch("/api/test/notification", {
export async function testNotification(arn: AnimeNotifier) {
await fetch("/api/test/notification", {
credentials: "same-origin"
})
// Update notification counter
arn.notificationManager.update()
}

View File

@ -8,13 +8,10 @@ export class NotificationManager {
let body = await response.text()
this.unseen = parseInt(body)
this.unseen = 2
this.render()
}
render() {
console.log("notification count", this.unseen)
let notificationIcon = document.getElementById("notification-icon")
let notificationCount = document.getElementById("notification-count")

View File

@ -52,6 +52,7 @@ avatar-size = 50px
// Badge
badge-important-bg-color = rgb(215, 38, 15)
badge-important-hover-bg-color = rgb(242, 60, 30)
badge-important-text-color = white
// Quote