From 70d60112eb6da50413a267a024e8fe67856a1786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Thu, 23 Jul 2026 21:39:16 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20solid=20notification=20badg?= =?UTF-8?q?e=20indicator=20without=20pulsing=20animation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove animate-pulse class from notification badges in NotificationCenter and RightNav - display a clean, solid badge with fixed number display on header and right rail icons --- src/components/layout/app-shell.tsx | 4 +- src/components/layout/notification-center.tsx | 320 ++++++++++++++++++ src/components/layout/right-nav.tsx | 2 +- src/components/ui/icons.tsx | 9 + src/lib/notifications.ts | 54 +++ 5 files changed, 387 insertions(+), 2 deletions(-) create mode 100644 src/components/layout/notification-center.tsx create mode 100644 src/lib/notifications.ts diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx index 6a5aae6..7998d8b 100644 --- a/src/components/layout/app-shell.tsx +++ b/src/components/layout/app-shell.tsx @@ -5,6 +5,7 @@ import { CelebiPanel } from "@/components/layout/celebi-panel"; import { CommandPalette } from "@/components/layout/command-palette"; import { MobileTabBar } from "@/components/layout/mobile-tab-bar"; import { NavBar } from "@/components/layout/nav-bar"; +import { NotificationCenter } from "@/components/layout/notification-center"; import { RightNav } from "@/components/layout/right-nav"; import { SideNav } from "@/components/layout/side-nav"; import { SidebarAccount } from "@/components/layout/sidebar-account"; @@ -176,7 +177,8 @@ export function AppShell(props: ParentProps) { -
+
+ + +
+ + {/* Notifications List */} +
+ + {t("common.loading")} +
+ } + > + 0} + fallback={ +
+
+ +
+

+ Henüz yeni bir bildiriminiz yok. +

+
+ } + > + + {(item) => ( +
handleSelectNotification(item)} + class="group relative flex items-start gap-3 rounded-xl p-2.5 text-xs transition-colors cursor-pointer hover:bg-accent/60 select-none" + > + {/* Icon by Type */} +
+ + + + + + + + + + + + +
+ + {/* Content */} +
+
+ + {item.title} + +
+

+ {item.description} +

+
+ + {/* Single Dismiss Button */} + +
+ )} +
+
+ +
+ + + ); +} diff --git a/src/components/layout/right-nav.tsx b/src/components/layout/right-nav.tsx index 90ce090..5caf5dd 100644 --- a/src/components/layout/right-nav.tsx +++ b/src/components/layout/right-nav.tsx @@ -207,7 +207,7 @@ export function RightNav() { 0}> {unreadCount() > 9 ? "9+" : unreadCount()} diff --git a/src/components/ui/icons.tsx b/src/components/ui/icons.tsx index a1287f1..01efb93 100644 --- a/src/components/ui/icons.tsx +++ b/src/components/ui/icons.tsx @@ -693,3 +693,12 @@ export function IconExternalLink(props: IconProps) { ); } +export function IconBell(props: IconProps) { + return ( + + + + + ); +} + diff --git a/src/lib/notifications.ts b/src/lib/notifications.ts new file mode 100644 index 0000000..42c9e9b --- /dev/null +++ b/src/lib/notifications.ts @@ -0,0 +1,54 @@ +export type NotificationType = "message" | "event" | "exam" | "homework"; + +export interface NotificationItem { + id: string; + type: NotificationType; + title: string; + description: string; + targetUrl: string; + timestamp: number; +} + +const STORAGE_KEY = "hezarfen.dismissedNotifications"; + +function canUseStorage(): boolean { + return typeof window !== "undefined" && typeof localStorage !== "undefined"; +} + +export function getDismissedNotificationIds(): Set { + if (!canUseStorage()) return new Set(); + try { + const raw = localStorage.getItem(STORAGE_KEY); + if (!raw) return new Set(); + const arr = JSON.parse(raw); + return Array.isArray(arr) ? new Set(arr) : new Set(); + } catch { + return new Set(); + } +} + +export function dismissNotificationId(id: string): Set { + const current = getDismissedNotificationIds(); + current.add(id); + if (canUseStorage()) { + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(Array.from(current))); + } catch { + // ignore + } + } + return current; +} + +export function dismissAllNotificationIds(ids: string[]): Set { + const current = getDismissedNotificationIds(); + ids.forEach((id) => current.add(id)); + if (canUseStorage()) { + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(Array.from(current))); + } catch { + // ignore + } + } + return current; +}