From 226ed3cb2494b702598e9c95fc0c986b4eba08c2 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Sun, 14 Dec 2025 00:26:22 +0530 Subject: [PATCH] feat(notifications): redesign notifications tray with improved UI/UX (#2894) --- .../notifications-tray.component.html | 70 +++-- .../notifications-tray.component.scss | 243 ++++++++++++++++-- 2 files changed, 276 insertions(+), 37 deletions(-) diff --git a/src/app/shared/notifications-tray/notifications-tray.component.html b/src/app/shared/notifications-tray/notifications-tray.component.html index cc6e7a196..1526d9042 100644 --- a/src/app/shared/notifications-tray/notifications-tray.component.html +++ b/src/app/shared/notifications-tray/notifications-tray.component.html @@ -1,6 +1,7 @@ - - @if (unreadNotifications.length === 0) { -
- - {{ 'labels.menus.Notifications' | translate }} - -

{{ 'labels.text.No notifications' | translate }}

-
- } + +
+ @if (unreadNotifications.length === 0 && displayedReadNotifications.length === 0) { +
+ notifications_none +

{{ 'labels.text.No notifications' | translate }}

+
+ } @else { +
+

{{ 'labels.menus.Notifications' | translate }}

+
+
+ @for (notification of unreadNotifications; track notification) { + + } - @for (notification of unreadNotifications; track notification) { - - } - - @for (notification of displayedReadNotifications; track notification) { - - } + @for (notification of displayedReadNotifications; track notification) { + + } +
+ } +
diff --git a/src/app/shared/notifications-tray/notifications-tray.component.scss b/src/app/shared/notifications-tray/notifications-tray.component.scss index c53b9122e..ea503fe2a 100644 --- a/src/app/shared/notifications-tray/notifications-tray.component.scss +++ b/src/app/shared/notifications-tray/notifications-tray.component.scss @@ -1,30 +1,243 @@ +@use '../../../assets/styles/colours' as *; + +// Screen reader only class for accessibility +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + .mifosx-notifications-menu { - max-height: 20rem !important; - width: 12.5rem !important; + margin-top: 8px; + overflow: hidden; + + .mat-mdc-menu-content, + .mat-menu-content { + padding: 0; + overflow: hidden; + } + + .notifications-container { + width: 320px; + max-width: 320px; + max-height: 500px; + display: flex; + flex-direction: column; + overflow: hidden; + overflow-x: hidden; + box-sizing: border-box; + } + + .notifications-header { + padding: 16px 16px 12px; + border-bottom: 1px solid $silver; + background-color: transparent; + + .notifications-title { + margin: 0; + font-size: 16px; + font-weight: 500; + color: $dark-grey; + line-height: 1.5; + } + } .no-notifications { - padding: 16px; + padding: 48px 32px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + min-height: 200px; + + .no-notifications-icon { + font-size: 64px; + width: 64px; + height: 64px; + color: $concrete; + margin-bottom: 16px; + } + + .no-notifications-text { + color: $asbestos; + font-size: 14px; + margin: 0; + font-weight: 500; + } } - .notification-icon { - font-size: 24px; - opacity: 0.8; + .notifications-list { + max-height: 500px; + overflow: hidden auto; + width: 100%; + box-sizing: border-box; + + // Hide scrollbar + scrollbar-width: none; + -ms-overflow-style: none; + + &::-webkit-scrollbar { + display: none; + } } - .mat-menu-content { - padding: 0 !important; - } + .notification-item { + display: flex; + flex-direction: column; + align-items: flex-start; + padding: 12px 16px; + min-height: 0; + height: auto; + line-height: 1.5; + border-bottom: 1px solid $silver; + transition: background-color 0.2s ease; + width: 100%; + max-width: 100%; + box-sizing: border-box; + overflow: hidden; - [mat-menu-item] { - height: 5rem; - line-height: 2.2rem; + &:hover { + background-color: $light-grey; + } - .time { - font-size: small; + &:last-child { + border-bottom: none; + } + + .notification-content { + width: 100%; + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 8px; + margin-bottom: 4px; + box-sizing: border-box; + min-width: 0; + + .notification-text { + flex: 1; + font-size: 14px; + line-height: 1.4; + text-align: left; + word-wrap: break-word; + overflow-wrap: break-word; + min-width: 0; + overflow: hidden; + } + + .unread-indicator { + color: $peter-river; + font-size: 8px; + margin-top: 6px; + flex-shrink: 0; + } + } + + .notification-time { + font-size: 12px; + color: $asbestos; + font-weight: 400; + margin-top: 2px; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } &.unread { - background-color: #e0f7ff !important; + background-color: $clouds; + + .notification-content .notification-text { + font-weight: 500; + color: $dark-grey; + } + + &:hover { + background-color: $light-grey; + } + } + + &.read { + background-color: transparent; + + .notification-content .notification-text { + font-weight: 400; + color: $asbestos; + } + } + } +} + +.dark-theme { + .mifosx-notifications-menu { + .notifications-header { + border-bottom: 1px solid $asbestos; + + .notifications-title { + color: $white; + } + } + + .no-notifications { + .no-notifications-icon { + color: $white; + opacity: 0.6; + } + + .no-notifications-text { + color: $white; + } + } + + .notification-item { + border-bottom: 1px solid $asbestos; + + &:hover { + background-color: $wet-asphalt; + } + + .notification-content { + .notification-text { + color: $white; + } + + .unread-indicator { + color: $peter-river; + } + } + + .notification-time { + color: $white; + opacity: 0.7; + } + + &.unread { + background-color: $wet-asphalt; + + .notification-content .notification-text { + color: $white; + } + + &:hover { + background-color: $midnight-blue; + } + } + + &.read { + background-color: transparent; + + .notification-content .notification-text { + color: $white; + opacity: 0.8; + } + } } } }