From 460dc0dec8a0359af2aa027013666809d8e41156 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 14 Jan 2026 04:35:59 +0530 Subject: [PATCH] feat: Enhance notification model and UI components - Added an `updated_at` timestamp field to the Notification model for better tracking of notification updates. - Updated the NotificationButton component to change the unread notification badge color for improved visibility. - Adjusted the NotificationPopup component's layout and text handling for better responsiveness and readability. --- surfsense_backend/app/db.py | 7 +++++++ .../components/notifications/NotificationButton.tsx | 10 +++++----- .../components/notifications/NotificationPopup.tsx | 10 +++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/surfsense_backend/app/db.py b/surfsense_backend/app/db.py index 699da9c38..00a0c27e6 100644 --- a/surfsense_backend/app/db.py +++ b/surfsense_backend/app/db.py @@ -728,6 +728,13 @@ class Notification(BaseModel, TimestampMixin): Boolean, nullable=False, default=False, server_default=text("false"), index=True ) notification_metadata = Column("metadata", JSONB, nullable=True, default={}) + updated_at = Column( + TIMESTAMP(timezone=True), + nullable=True, + default=lambda: datetime.now(UTC), + onupdate=lambda: datetime.now(UTC), + index=True, + ) user = relationship("User", back_populates="notifications") search_space = relationship("SearchSpace", back_populates="notifications") diff --git a/surfsense_web/components/notifications/NotificationButton.tsx b/surfsense_web/components/notifications/NotificationButton.tsx index a4785af44..fe400d2a8 100644 --- a/surfsense_web/components/notifications/NotificationButton.tsx +++ b/surfsense_web/components/notifications/NotificationButton.tsx @@ -25,11 +25,11 @@ export function NotificationButton() { {unreadCount > 0 && ( 9 && "px-1" - )} - > + className={cn( + "absolute -top-1 -right-1 flex h-5 w-5 items-center justify-center rounded-full bg-black text-[10px] font-medium text-white dark:bg-zinc-800 dark:text-zinc-50", + unreadCount > 9 && "px-1" + )} + > {unreadCount > 99 ? "99+" : unreadCount} )} diff --git a/surfsense_web/components/notifications/NotificationPopup.tsx b/surfsense_web/components/notifications/NotificationPopup.tsx index 3355b62e6..129ff97db 100644 --- a/surfsense_web/components/notifications/NotificationPopup.tsx +++ b/surfsense_web/components/notifications/NotificationPopup.tsx @@ -55,7 +55,7 @@ export function NotificationPopup({ }; return ( -
+
{/* Header */}
@@ -92,20 +92,20 @@ export function NotificationPopup({ !notification.read && "bg-accent/50" )} > -
+
{getStatusIcon(notification)}
-
+

{notification.title}

-

+

{notification.message}