@ansiversa/components 0.0.104 → 0.0.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansiversa/components",
3
- "version": "0.0.104",
3
+ "version": "0.0.105",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,6 +18,7 @@ interface User {
18
18
  interface Props {
19
19
  className?: string;
20
20
  user?: User;
21
+ notificationUnreadCount?: number;
21
22
 
22
23
  /** Additional HTML attributes */
23
24
  [attrs: string]: any;
@@ -26,6 +27,7 @@ interface Props {
26
27
  const {
27
28
  className = "",
28
29
  user,
30
+ notificationUnreadCount,
29
31
  ...attrs
30
32
  } = Astro.props as Props;
31
33
 
@@ -99,6 +101,9 @@ const authLink: NavLink = {
99
101
 
100
102
  const userInitial =
101
103
  (user?.name?.charAt(0) ?? user?.email?.charAt(0) ?? "?").toUpperCase();
104
+
105
+ const unreadCount = Number(notificationUnreadCount ?? 0);
106
+ const unreadBadge = unreadCount > 99 ? "99+" : `${unreadCount}`;
102
107
  ---
103
108
 
104
109
  <div class={classAttr} {...attrs}>
@@ -162,6 +167,11 @@ const userInitial =
162
167
 
163
168
  <a href={`${ROOT_URL}/notifications`} class="av-user-menu-item av-dropdown-item" role="menuitem">
164
169
  <span>Notifications</span>
170
+ {unreadCount > 0 && (
171
+ <span class="av-badge av-badge-soft" aria-label={`${unreadBadge} unread notifications`}>
172
+ {unreadBadge}
173
+ </span>
174
+ )}
165
175
  </a>
166
176
 
167
177
  <a href={`${ROOT_URL}/favorites`} class="av-user-menu-item av-dropdown-item" role="menuitem">
@@ -7,11 +7,13 @@ import AvNavbarActions from "../AvNavbarActions.astro";
7
7
  interface Props {
8
8
  title?: string;
9
9
  description?: string;
10
+ notificationUnreadCount?: number;
10
11
  }
11
12
 
12
13
  const {
13
14
  title = "Ansiversa",
14
15
  description = "Ansiversa – A unified ecosystem of premium Apps designed to feel simple, powerful, and delightful.",
16
+ notificationUnreadCount = 0,
15
17
  } = Astro.props;
16
18
 
17
19
  const user = Astro.locals.user;
@@ -72,7 +74,7 @@ const ROOT_URL = rawDomain.match(/^https?:\/\//i)
72
74
  <!-- Top Navigation -->
73
75
  <AvNavbar>
74
76
  <AvBrand />
75
- <AvNavbarActions user={user} />
77
+ <AvNavbarActions user={user} notificationUnreadCount={notificationUnreadCount} />
76
78
  </AvNavbar>
77
79
 
78
80
  <!-- Main content -->