diff --git a/layout/sidebar/sidebar.scarlet b/layout/sidebar/sidebar.scarlet index 344012b6..c053f166 100644 --- a/layout/sidebar/sidebar.scarlet +++ b/layout/sidebar/sidebar.scarlet @@ -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 diff --git a/pages/notifications/notifications.pixy b/pages/notifications/notifications.pixy index 9277c884..a2c1cea5 100644 --- a/pages/notifications/notifications.pixy +++ b/pages/notifications/notifications.pixy @@ -1,9 +1,15 @@ component Notifications(notifications []*arn.Notification, user *arn.User) h1 Notifications - .notifications - each notification in notifications - Notification(notification) + .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) component Notification(notification *arn.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 - .notification-date.utc-date(data-date=notification.Created) \ No newline at end of file + h3.notification-title= notification.Title + .notification-footer + p.notification-text= notification.Message + .notification-date.utc-date(data-date=notification.Created) \ No newline at end of file diff --git a/pages/notifications/notifications.scarlet b/pages/notifications/notifications.scarlet index 6848d121..82df3ab1 100644 --- a/pages/notifications/notifications.scarlet +++ b/pages/notifications/notifications.scarlet @@ -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 diff --git a/scripts/Actions/Notifications.ts b/scripts/Actions/Notifications.ts index 10557525..e6f1911c 100644 --- a/scripts/Actions/Notifications.ts +++ b/scripts/Actions/Notifications.ts @@ -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() } \ No newline at end of file diff --git a/scripts/NotificationManager.ts b/scripts/NotificationManager.ts index ff2266d4..92eae2ff 100644 --- a/scripts/NotificationManager.ts +++ b/scripts/NotificationManager.ts @@ -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") diff --git a/styles/include/config.scarlet b/styles/include/config.scarlet index cfa24881..e5074cd2 100644 --- a/styles/include/config.scarlet +++ b/styles/include/config.scarlet @@ -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