@burdenoff/microfe-notification 2026.1117.1 → 2026.1118.1
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/dist/components/NotificationListFooter.d.ts +18 -0
- package/dist/components/NotificationListFooter.js +43 -0
- package/dist/components/NotificationListFooter.js.map +1 -0
- package/dist/hooks/notificationPaging.d.ts +51 -0
- package/dist/hooks/notificationPaging.js +43 -0
- package/dist/hooks/notificationPaging.js.map +1 -0
- package/dist/hooks/useNotifications.d.ts +2 -0
- package/dist/hooks/useNotifications.js +177 -129
- package/dist/hooks/useNotifications.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +98 -91
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +78 -71
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +105 -98
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +77 -70
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/package.json +9 -9
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { NotificationCard as e } from "../components/NotificationCard.js";
|
|
2
2
|
import { useNotifications as t } from "../hooks/useNotifications.js";
|
|
3
|
-
import {
|
|
3
|
+
import { NotificationListFooter as n } from "../components/NotificationListFooter.js";
|
|
4
4
|
import { useNotificationTopics as r } from "../hooks/useNotificationTopics.js";
|
|
5
|
+
import { NOTIFICATION_PERMISSIONS as i } from "../constants/permissions.js";
|
|
5
6
|
import "../hooks/index.js";
|
|
6
|
-
import { useNotification as
|
|
7
|
-
import { useTr as
|
|
8
|
-
import { needsAction as
|
|
7
|
+
import { useNotification as a } from "../providers/NotificationProvider.js";
|
|
8
|
+
import { useTr as o } from "../shared/hooks/useTr.js";
|
|
9
|
+
import { needsAction as ee } from "./inboxFilters.js";
|
|
9
10
|
import { filterNotifications as s, groupNotificationsByDate as c } from "../utils/index.js";
|
|
10
11
|
import { AdminToolsMenu as l } from "./AdminToolsMenu.js";
|
|
11
12
|
import { MoreFiltersButton as u, SearchField as d, ViewChips as f } from "./FilterControls.js";
|
|
@@ -16,37 +17,37 @@ import { Archive as _, CheckCheck as v, Settings as y } from "lucide-react";
|
|
|
16
17
|
import { Link as b } from "react-router";
|
|
17
18
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
18
19
|
import { PushOptInToggle as C } from "@burdenoff/fe-libs/chrome";
|
|
19
|
-
import { Button as w, IllustratedEmptyState as T, NativeSelect as E, useRememberedOpen as
|
|
20
|
+
import { Button as w, IllustratedEmptyState as T, NativeSelect as E, useRememberedOpen as te } from "@burdenoff/fe-libs/ui";
|
|
20
21
|
// src/navigation-v2/NotificationInboxV2.tsx
|
|
21
|
-
var
|
|
22
|
+
var D = {
|
|
22
23
|
archived: !1,
|
|
23
24
|
channel: "IN_APP"
|
|
24
|
-
},
|
|
25
|
-
function
|
|
26
|
-
let l =
|
|
27
|
-
baseFilter:
|
|
28
|
-
unreadFilter:
|
|
29
|
-
}), { topics:
|
|
30
|
-
let e = s(
|
|
31
|
-
return
|
|
25
|
+
}, O = { channel: "IN_APP" }, k = "ALL";
|
|
26
|
+
function A() {
|
|
27
|
+
let l = o(), _ = p(), { hasPermission: v, isLoading: y } = g(), { currentUser: A } = a(), { notifications: M, hasMore: N, isLoadingMore: P, loadMore: F, unreadCount: I, notificationFilter: L, markAsRead: R, markAllAsRead: z, archiveNotification: B, recordAction: V, updateFilter: H, resetFilter: ne } = t({
|
|
28
|
+
baseFilter: D,
|
|
29
|
+
unreadFilter: O
|
|
30
|
+
}), { topics: U } = r({ isActive: !0 }), [W, G] = h(!1), [K, q] = te("notifications.inbox.moreFilters", !1), J = W ? "action" : L.isRead === !1 ? "unread" : L.isRead === null ? "all" : null, Y = m(() => {
|
|
31
|
+
let e = s(M, L);
|
|
32
|
+
return W ? e.filter(ee) : e;
|
|
32
33
|
}, [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
]),
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
34
|
+
M,
|
|
35
|
+
L,
|
|
36
|
+
W
|
|
37
|
+
]), X = m(() => c(Y, l), [Y, l]), Z = L.type !== k || L.priority !== k || !!L.topicId || L.isRead === !0, re = !!L.search || Z || J !== "all", ie = (e) => {
|
|
38
|
+
G(e === "action"), H({ isRead: e !== "unread" && null });
|
|
39
|
+
}, Q = () => {
|
|
40
|
+
G(!1), ne();
|
|
40
41
|
};
|
|
41
42
|
if (y) return /* @__PURE__ */ x("div", {
|
|
42
43
|
className: "flex h-64 items-center justify-center",
|
|
43
44
|
children: /* @__PURE__ */ x("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
44
45
|
});
|
|
45
|
-
if (!v(
|
|
46
|
+
if (!v(i.NOTIFICATION_LIST) && !A?.id) return /* @__PURE__ */ x("div", {
|
|
46
47
|
className: "p-8 text-center text-text-secondary",
|
|
47
48
|
children: l("notifications.noPermissionView", "You don't have permission to view notifications.")
|
|
48
49
|
});
|
|
49
|
-
let
|
|
50
|
+
let ae = [
|
|
50
51
|
{
|
|
51
52
|
id: "all",
|
|
52
53
|
label: l("notifications.filterAll", "All")
|
|
@@ -59,9 +60,9 @@ function j() {
|
|
|
59
60
|
id: "action",
|
|
60
61
|
label: l("notifications.v2.needsAction", "Needs action")
|
|
61
62
|
}
|
|
62
|
-
],
|
|
63
|
+
], oe = [
|
|
63
64
|
{
|
|
64
|
-
value:
|
|
65
|
+
value: k,
|
|
65
66
|
label: l("notifications.allTypes", "All Types")
|
|
66
67
|
},
|
|
67
68
|
{
|
|
@@ -80,9 +81,9 @@ function j() {
|
|
|
80
81
|
value: "MARKETING",
|
|
81
82
|
label: l("notifications.typeMarketing", "Marketing")
|
|
82
83
|
}
|
|
83
|
-
],
|
|
84
|
+
], $ = [
|
|
84
85
|
{
|
|
85
|
-
value:
|
|
86
|
+
value: k,
|
|
86
87
|
label: l("notifications.allPriorities", "All Priorities")
|
|
87
88
|
},
|
|
88
89
|
{
|
|
@@ -101,13 +102,13 @@ function j() {
|
|
|
101
102
|
value: "LOW",
|
|
102
103
|
label: l("notifications.priorityLow", "Low")
|
|
103
104
|
}
|
|
104
|
-
],
|
|
105
|
-
value:
|
|
105
|
+
], se = [{
|
|
106
|
+
value: k,
|
|
106
107
|
label: l("notifications.allTopics", "All Topics")
|
|
107
|
-
}, ...
|
|
108
|
+
}, ...U.map((e) => ({
|
|
108
109
|
value: e.id,
|
|
109
110
|
label: e.name
|
|
110
|
-
}))],
|
|
111
|
+
}))], ce = [
|
|
111
112
|
{
|
|
112
113
|
value: "ALL",
|
|
113
114
|
label: l("notifications.filterAll", "All")
|
|
@@ -120,13 +121,13 @@ function j() {
|
|
|
120
121
|
value: "READ",
|
|
121
122
|
label: l("notifications.filterRead", "Read")
|
|
122
123
|
}
|
|
123
|
-
],
|
|
124
|
+
], le = L.isRead === null ? "ALL" : L.isRead ? "READ" : "UNREAD";
|
|
124
125
|
return /* @__PURE__ */ S("div", {
|
|
125
126
|
className: "mx-auto w-full max-w-5xl space-y-4 p-3 animate-in fade-in duration-200 sm:space-y-5 sm:p-6",
|
|
126
127
|
children: [
|
|
127
|
-
/* @__PURE__ */ x(
|
|
128
|
-
unreadCount:
|
|
129
|
-
onMarkAllAsRead:
|
|
128
|
+
/* @__PURE__ */ x(j, {
|
|
129
|
+
unreadCount: I,
|
|
130
|
+
onMarkAllAsRead: z
|
|
130
131
|
}),
|
|
131
132
|
/* @__PURE__ */ x(C, {}),
|
|
132
133
|
/* @__PURE__ */ S("section", {
|
|
@@ -138,60 +139,60 @@ function j() {
|
|
|
138
139
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center",
|
|
139
140
|
children: [/* @__PURE__ */ x(d, {
|
|
140
141
|
label: l("notifications.searchPlaceholder", "Search notifications..."),
|
|
141
|
-
value:
|
|
142
|
-
onChange: (e) =>
|
|
142
|
+
value: L.search,
|
|
143
|
+
onChange: (e) => H({ search: e }),
|
|
143
144
|
tour: "notification-center-search"
|
|
144
145
|
}), /* @__PURE__ */ S("div", {
|
|
145
146
|
className: "flex flex-wrap items-center gap-2",
|
|
146
147
|
children: [/* @__PURE__ */ x(f, {
|
|
147
|
-
chips:
|
|
148
|
-
value:
|
|
149
|
-
onChange:
|
|
148
|
+
chips: ae,
|
|
149
|
+
value: J,
|
|
150
|
+
onChange: ie,
|
|
150
151
|
testIdPrefix: "notifications-view"
|
|
151
152
|
}), /* @__PURE__ */ x(u, {
|
|
152
|
-
open:
|
|
153
|
-
active:
|
|
153
|
+
open: K,
|
|
154
|
+
active: Z,
|
|
154
155
|
controls: "notifications-more-filters",
|
|
155
|
-
onToggle: () =>
|
|
156
|
+
onToggle: () => q(!K)
|
|
156
157
|
})]
|
|
157
158
|
})]
|
|
158
159
|
}),
|
|
159
160
|
/* @__PURE__ */ S("div", {
|
|
160
161
|
id: "notifications-more-filters",
|
|
161
|
-
hidden: !
|
|
162
|
+
hidden: !K,
|
|
162
163
|
className: "grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
163
164
|
children: [
|
|
164
165
|
/* @__PURE__ */ x(E, {
|
|
165
166
|
"aria-label": l("notifications.v2.typeFilter", "Type"),
|
|
166
|
-
options:
|
|
167
|
-
value:
|
|
168
|
-
onValueChange: (e) =>
|
|
167
|
+
options: oe,
|
|
168
|
+
value: L.type,
|
|
169
|
+
onValueChange: (e) => H({ type: e })
|
|
169
170
|
}),
|
|
170
171
|
/* @__PURE__ */ x(E, {
|
|
171
172
|
"aria-label": l("notifications.v2.priorityFilter", "Priority"),
|
|
172
|
-
options:
|
|
173
|
-
value:
|
|
174
|
-
onValueChange: (e) =>
|
|
173
|
+
options: $,
|
|
174
|
+
value: L.priority,
|
|
175
|
+
onValueChange: (e) => H({ priority: e })
|
|
175
176
|
}),
|
|
176
177
|
/* @__PURE__ */ x(E, {
|
|
177
178
|
"aria-label": l("notifications.v2.topicFilter", "Topic"),
|
|
178
|
-
options:
|
|
179
|
-
value:
|
|
180
|
-
onValueChange: (e) =>
|
|
179
|
+
options: se,
|
|
180
|
+
value: L.topicId || k,
|
|
181
|
+
onValueChange: (e) => H({ topicId: e === k ? void 0 : e })
|
|
181
182
|
}),
|
|
182
183
|
/* @__PURE__ */ x(E, {
|
|
183
184
|
"aria-label": l("notifications.v2.readFilter", "Read state"),
|
|
184
|
-
options:
|
|
185
|
-
value:
|
|
185
|
+
options: ce,
|
|
186
|
+
value: le,
|
|
186
187
|
onValueChange: (e) => {
|
|
187
|
-
|
|
188
|
+
G(!1), H({ isRead: e === "ALL" ? null : e === "READ" });
|
|
188
189
|
}
|
|
189
190
|
})
|
|
190
191
|
]
|
|
191
192
|
}),
|
|
192
|
-
|
|
193
|
+
re && /* @__PURE__ */ x("button", {
|
|
193
194
|
type: "button",
|
|
194
|
-
onClick:
|
|
195
|
+
onClick: Q,
|
|
195
196
|
className: "text-sm text-text-tertiary transition-colors hover:text-text-primary",
|
|
196
197
|
children: l("notifications.v2.clearFilters", "Clear filters")
|
|
197
198
|
})
|
|
@@ -200,7 +201,7 @@ function j() {
|
|
|
200
201
|
/* @__PURE__ */ x("div", {
|
|
201
202
|
"data-tour": "notification-center-list",
|
|
202
203
|
className: "space-y-6",
|
|
203
|
-
children:
|
|
204
|
+
children: Y.length > 0 ? Object.entries(X).map(([t, n]) => /* @__PURE__ */ S("section", {
|
|
204
205
|
"aria-label": t,
|
|
205
206
|
children: [/* @__PURE__ */ x("h2", {
|
|
206
207
|
className: "mb-3 text-sm font-semibold text-text-tertiary",
|
|
@@ -209,19 +210,19 @@ function j() {
|
|
|
209
210
|
className: "space-y-2",
|
|
210
211
|
children: n.map((t) => /* @__PURE__ */ x(e, {
|
|
211
212
|
notification: t,
|
|
212
|
-
onMarkAsRead:
|
|
213
|
-
onArchive:
|
|
214
|
-
onAction:
|
|
213
|
+
onMarkAsRead: R,
|
|
214
|
+
onArchive: B,
|
|
215
|
+
onAction: V,
|
|
215
216
|
analyticsSource: "center",
|
|
216
217
|
navigationV2: !0,
|
|
217
|
-
showTopic:
|
|
218
|
+
showTopic: K
|
|
218
219
|
}, t.id))
|
|
219
220
|
})]
|
|
220
221
|
}, t)) : /* @__PURE__ */ x(T, {
|
|
221
|
-
illustration:
|
|
222
|
-
title:
|
|
223
|
-
description:
|
|
224
|
-
action:
|
|
222
|
+
illustration: M.length === 0 ? "empty-notifications" : "empty-search",
|
|
223
|
+
title: M.length === 0 ? l("notifications.v2.emptyTitle", "You're all caught up") : l("notifications.noNotificationsFound", "No notifications found"),
|
|
224
|
+
description: M.length === 0 ? l("notifications.v2.emptyDescription", "Nothing here yet. We'll let you know when something needs you.") : l("notifications.adjustFilters", "Try adjusting your filters to see more notifications."),
|
|
225
|
+
action: M.length === 0 ? /* @__PURE__ */ x(w, {
|
|
225
226
|
asChild: !0,
|
|
226
227
|
variant: "outline",
|
|
227
228
|
children: /* @__PURE__ */ x(b, {
|
|
@@ -231,16 +232,22 @@ function j() {
|
|
|
231
232
|
}) : /* @__PURE__ */ x(w, {
|
|
232
233
|
type: "button",
|
|
233
234
|
variant: "outline",
|
|
234
|
-
onClick:
|
|
235
|
+
onClick: Q,
|
|
235
236
|
children: l("notifications.v2.clearFilters", "Clear filters")
|
|
236
237
|
})
|
|
237
238
|
})
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ x(n, {
|
|
241
|
+
hasMore: N,
|
|
242
|
+
isLoadingMore: P,
|
|
243
|
+
onLoadMore: F,
|
|
244
|
+
shownCount: Y.length
|
|
238
245
|
})
|
|
239
246
|
]
|
|
240
247
|
});
|
|
241
248
|
}
|
|
242
|
-
function
|
|
243
|
-
let n =
|
|
249
|
+
function j({ unreadCount: e, onMarkAllAsRead: t }) {
|
|
250
|
+
let n = o(), r = p();
|
|
244
251
|
return /* @__PURE__ */ S("header", {
|
|
245
252
|
"data-tour": "notification-center-header",
|
|
246
253
|
className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
|
|
@@ -304,6 +311,6 @@ function M({ unreadCount: e, onMarkAllAsRead: t }) {
|
|
|
304
311
|
})]
|
|
305
312
|
});
|
|
306
313
|
}
|
|
307
|
-
export {
|
|
314
|
+
export { A as NotificationInboxV2 };
|
|
308
315
|
|
|
309
316
|
//# sourceMappingURL=NotificationInboxV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationInboxV2.js","names":["CENTER_FILTER","CENTER_UNREAD_FILTER","ALL","NotificationInboxV2","tr","useTr","paths","useNotificationPaths","permissionsLoading","usePermissions","useNotification","useNotifications","useNotificationTopics","onlyNeedsAction","setOnlyNeedsAction","useState","moreFiltersOpen","setMoreFiltersOpen","useRememberedOpen","view","notificationFilter","visible","useMemo","filtered","filterNotifications","notifications","needsAction","grouped","groupNotificationsByDate","moreFiltersActive","anyFilterActive","chooseView","next","updateFilter","clearFilters","resetFilter","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","chips","typeOptions","priorityOptions","topicOptions","topics","topic","readOptions","readValue","InboxHeader","markAllAsRead","PushOptInToggle","SearchField","ViewChips","MoreFiltersButton","NativeSelect","value","group","items","NotificationCard","markAsRead","archiveNotification","recordAction","notification","IllustratedEmptyState","Button","Link","unreadCount","onMarkAllAsRead","CheckCheck","Settings","Archive","AdminToolsMenu"],"sources":["../../src/navigation-v2/NotificationInboxV2.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Archive, CheckCheck, Settings } from 'lucide-react';\nimport { Link } from 'react-router';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n IllustratedEmptyState,\n NativeSelect,\n useRememberedOpen,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\nimport { needsAction, type InboxView } from './inboxFilters';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { AdminToolsMenu } from './AdminToolsMenu';\nimport { MoreFiltersButton, SearchField, ViewChips } from './FilterControls';\nimport { useNotificationPaths } from './paths';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst ALL = 'ALL';\n\n/**\n * Notifications, Navigation v2 (BOFF-11872, mockup 41). Level 1: the title\n * with the unread count, \"Mark all as read\", \"Notification settings\",\n * \"Archived\", search and the All · Unread · Needs action chips. Level 2: the\n * admin tools under \"More\", and Type, Priority, Topic and the full read state\n * under \"More filters\" (remembered per profile). Same queries as the classic\n * Notification Center.\n */\nexport function NotificationInboxV2() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n const [onlyNeedsAction, setOnlyNeedsAction] = useState(false);\n const [moreFiltersOpen, setMoreFiltersOpen] = useRememberedOpen(\n 'notifications.inbox.moreFilters',\n false\n );\n\n const view: InboxView | null = onlyNeedsAction\n ? 'action'\n : notificationFilter.isRead === false\n ? 'unread'\n : notificationFilter.isRead === null\n ? 'all'\n : null;\n\n const visible = useMemo(() => {\n const filtered = filterNotifications(notifications, notificationFilter);\n return onlyNeedsAction ? filtered.filter(needsAction) : filtered;\n }, [notifications, notificationFilter, onlyNeedsAction]);\n const grouped = useMemo(() => groupNotificationsByDate(visible, tr), [visible, tr]);\n\n const moreFiltersActive =\n notificationFilter.type !== ALL ||\n notificationFilter.priority !== ALL ||\n Boolean(notificationFilter.topicId) ||\n notificationFilter.isRead === true;\n const anyFilterActive = Boolean(notificationFilter.search) || moreFiltersActive || view !== 'all';\n\n const chooseView = (next: InboxView) => {\n setOnlyNeedsAction(next === 'action');\n updateFilter({ isRead: next === 'unread' ? false : null });\n };\n\n const clearFilters = () => {\n setOnlyNeedsAction(false);\n resetFilter();\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n // The permission-fallback state (NOTIF-CTR-15), unchanged.\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n const chips: Array<{ id: InboxView; label: string }> = [\n { id: 'all', label: tr('notifications.filterAll', 'All') },\n { id: 'unread', label: tr('notifications.filterUnread', 'Unread') },\n { id: 'action', label: tr('notifications.v2.needsAction', 'Needs action') },\n ];\n\n const typeOptions = [\n { value: ALL, label: tr('notifications.allTypes', 'All Types') },\n { value: 'SYSTEM', label: tr('notifications.typeSystem', 'System') },\n { value: 'ALERT', label: tr('notifications.typeAlert', 'Alert') },\n { value: 'TRANSACTIONAL', label: tr('notifications.typeTransactional', 'Transactional') },\n { value: 'MARKETING', label: tr('notifications.typeMarketing', 'Marketing') },\n ];\n const priorityOptions = [\n { value: ALL, label: tr('notifications.allPriorities', 'All Priorities') },\n { value: 'URGENT', label: tr('notifications.priorityUrgent', 'Urgent') },\n { value: 'HIGH', label: tr('notifications.priorityHigh', 'High') },\n { value: 'NORMAL', label: tr('notifications.priorityNormal', 'Normal') },\n { value: 'LOW', label: tr('notifications.priorityLow', 'Low') },\n ];\n const topicOptions = [\n { value: ALL, label: tr('notifications.allTopics', 'All Topics') },\n ...topics.map((topic) => ({ value: topic.id, label: topic.name })),\n ];\n const readOptions = [\n { value: 'ALL', label: tr('notifications.filterAll', 'All') },\n { value: 'UNREAD', label: tr('notifications.filterUnread', 'Unread') },\n { value: 'READ', label: tr('notifications.filterRead', 'Read') },\n ];\n const readValue =\n notificationFilter.isRead === null ? 'ALL' : notificationFilter.isRead ? 'READ' : 'UNREAD';\n\n return (\n <div className=\"mx-auto w-full max-w-5xl space-y-4 p-3 animate-in fade-in duration-200 sm:space-y-5 sm:p-6\">\n <InboxHeader unreadCount={unreadCount} onMarkAllAsRead={markAllAsRead} />\n\n <PushOptInToggle />\n\n <section\n data-tour=\"notification-center-filters\"\n aria-label={tr('notifications.v2.filters', 'Filters')}\n className=\"space-y-3\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <SearchField\n label={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(search) => updateFilter({ search })}\n tour=\"notification-center-search\"\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <ViewChips\n chips={chips}\n value={view}\n onChange={chooseView}\n testIdPrefix=\"notifications-view\"\n />\n <MoreFiltersButton\n open={moreFiltersOpen}\n active={moreFiltersActive}\n controls=\"notifications-more-filters\"\n onToggle={() => setMoreFiltersOpen(!moreFiltersOpen)}\n />\n </div>\n </div>\n\n <div\n id=\"notifications-more-filters\"\n hidden={!moreFiltersOpen}\n className=\"grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-2 lg:grid-cols-4\"\n >\n <NativeSelect\n aria-label={tr('notifications.v2.typeFilter', 'Type')}\n options={typeOptions}\n value={notificationFilter.type}\n // The options above are exactly ALL plus the NotificationType values.\n onValueChange={(value) => updateFilter({ type: value as NotificationType | 'ALL' })}\n />\n <NativeSelect\n aria-label={tr('notifications.v2.priorityFilter', 'Priority')}\n options={priorityOptions}\n value={notificationFilter.priority}\n // The options above are exactly ALL plus the NotificationPriority values.\n onValueChange={(value) =>\n updateFilter({ priority: value as NotificationPriority | 'ALL' })\n }\n />\n <NativeSelect\n aria-label={tr('notifications.v2.topicFilter', 'Topic')}\n options={topicOptions}\n value={notificationFilter.topicId || ALL}\n onValueChange={(value) => updateFilter({ topicId: value === ALL ? undefined : value })}\n />\n <NativeSelect\n aria-label={tr('notifications.v2.readFilter', 'Read state')}\n options={readOptions}\n value={readValue}\n onValueChange={(value) => {\n setOnlyNeedsAction(false);\n updateFilter({ isRead: value === 'ALL' ? null : value === 'READ' });\n }}\n />\n </div>\n\n {anyFilterActive && (\n <button\n type=\"button\"\n onClick={clearFilters}\n className=\"text-sm text-text-tertiary transition-colors hover:text-text-primary\"\n >\n {tr('notifications.v2.clearFilters', 'Clear filters')}\n </button>\n )}\n </section>\n\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {visible.length > 0 ? (\n Object.entries(grouped).map(([group, items]) => (\n <section key={group} aria-label={group}>\n <h2 className=\"mb-3 text-sm font-semibold text-text-tertiary\">{group}</h2>\n <div className=\"space-y-2\">\n {items.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n navigationV2\n showTopic={moreFiltersOpen}\n />\n ))}\n </div>\n </section>\n ))\n ) : (\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={\n notifications.length === 0\n ? tr('notifications.v2.emptyTitle', \"You're all caught up\")\n : tr('notifications.noNotificationsFound', 'No notifications found')\n }\n description={\n notifications.length === 0\n ? tr(\n 'notifications.v2.emptyDescription',\n \"Nothing here yet. We'll let you know when something needs you.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n action={\n notifications.length === 0 ? (\n <Button asChild variant=\"outline\">\n <Link to={paths.preferences}>\n {tr('notifications.v2.chooseHow', 'Choose how we reach you')}\n </Link>\n </Button>\n ) : (\n <Button type=\"button\" variant=\"outline\" onClick={clearFilters}>\n {tr('notifications.v2.clearFilters', 'Clear filters')}\n </Button>\n )\n }\n />\n )}\n </div>\n </div>\n );\n}\n\n/** The inbox header: title with the unread count and the level-1 actions. */\nfunction InboxHeader({\n unreadCount,\n onMarkAllAsRead,\n}: {\n unreadCount: number;\n onMarkAllAsRead: () => void;\n}) {\n const tr = useTr();\n const paths = useNotificationPaths();\n return (\n <header\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\n >\n <div className=\"min-w-0\">\n <h1 className=\"flex flex-wrap items-center gap-2 text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.title', 'Notifications')}\n {unreadCount > 0 && (\n <span\n data-tour=\"notification-center-unread-count\"\n className=\"inline-flex items-center gap-1.5 rounded-full bg-accent-primary/10 px-2.5 py-0.5 text-sm font-medium text-accent-primary\"\n >\n <span\n className=\"inline-block h-2 w-2 rounded-full bg-accent-primary\"\n aria-hidden=\"true\"\n />\n {tr('notifications.v2.unreadCount', '{{count}} unread', { count: unreadCount })}\n </span>\n )}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr('notifications.v2.subtitle', 'Everything the platform told you, in one place.')}\n </p>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={onMarkAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.markAllAsRead', 'Mark all as read')}\n </Button>\n )}\n <Button asChild variant=\"outline\" className=\"gap-2\">\n <Link to={paths.preferences} data-testid=\"notifications-settings-link\">\n <Settings size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.settings', 'Notification settings')}\n </Link>\n </Button>\n <Button asChild variant=\"ghost\" className=\"gap-2\">\n <Link to={paths.archived} data-testid=\"notifications-archived-link\">\n <Archive size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.archived', 'Archived')}\n </Link>\n </Button>\n <AdminToolsMenu />\n </div>\n </header>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,IAAgB;CAAE,UAAU;CAAO,SAAS;AAAkB,GAC9DC,IAAuB,EAAE,SAAS,SAAS,GAC3CC,IAAM;AAUZ,SAAgBC,IAAsB;CACpC,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7B,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBC,EAAgB,GAClC,EACJ,kBACA,gBACA,uBACA,eACA,kBACA,wBACA,iBACA,iBACA,mBACEC,EAAiB;EAAE,YAAYX;EAAe,cAAcC;CAAqB,CAAC,GAChF,EAAE,cAAWW,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,CAACC,GAAiBC,KAAsBC,EAAS,EAAK,GACtD,CAACC,GAAiBC,KAAsBC,EAC5C,mCACA,EACF,GAEMC,IAAyBN,IAC3B,WACAO,EAAmB,WAAW,KAC5B,WACAA,EAAmB,WAAW,OAC5B,QACA,MAEFC,IAAUC,QAAc;EAC5B,IAAMC,IAAWC,EAAoBC,GAAeL,CAAkB;EACtE,OAAOP,IAAkBU,EAAS,OAAOG,CAAW,IAAIH;CAC1D,GAAG;EAACE;EAAeL;EAAoBP;CAAe,CAAC,GACjDc,IAAUL,QAAcM,EAAyBP,GAASjB,CAAE,GAAG,CAACiB,GAASjB,CAAE,CAAC,GAE5EyB,IACJT,EAAmB,SAASlB,KAC5BkB,EAAmB,aAAalB,KAChC,EAAQkB,EAAmB,WAC3BA,EAAmB,WAAW,IAC1BU,IAAkB,EAAQV,EAAmB,UAAWS,KAAqBV,MAAS,OAEtFY,KAAc,MAAoB;EAEtC,AADAjB,EAAmBkB,MAAS,QAAQ,GACpCC,EAAa,EAAE,QAAQD,MAAS,YAAmB,KAAK,CAAC;CAC3D,GAEME,UAAqB;EAEzB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AD;KAAQ,SAAA;KAAQ,SAAQ;KAAU,WAAU;KAC1C,UAAA,kBAACC,GAAD;MAAM,IAAI1D,EAAM;MAAa,eAAY;MAAzC,UAAA,CACE,kBAAC8D,GAAD;OAAU,MAAM;OAAI,eAAY;MAAQ,CAAA,GACvChE,EAAG,6BAA6B,uBAAuB,CACpD;;IACA,CAAA;IACR,kBAAC2D,GAAD;KAAQ,SAAA;KAAQ,SAAQ;KAAQ,WAAU;KACxC,UAAA,kBAACC,GAAD;MAAM,IAAI1D,EAAM;MAAU,eAAY;MAAtC,UAAA,CACE,kBAAC+D,GAAD;OAAS,MAAM;OAAI,eAAY;MAAQ,CAAA,GACtCjE,EAAG,6BAA6B,UAAU,CACvC;;IACA,CAAA;IACR,kBAACkE,GAAD,CAAiB,CAAA;GACd;EACC,CAAA,CAAA;;AAEZ"}
|
|
1
|
+
{"version":3,"file":"NotificationInboxV2.js","names":["CENTER_FILTER","CENTER_UNREAD_FILTER","ALL","NotificationInboxV2","tr","useTr","paths","useNotificationPaths","permissionsLoading","usePermissions","useNotification","useNotifications","useNotificationTopics","onlyNeedsAction","setOnlyNeedsAction","useState","moreFiltersOpen","setMoreFiltersOpen","useRememberedOpen","view","notificationFilter","visible","useMemo","filtered","filterNotifications","notifications","needsAction","grouped","groupNotificationsByDate","moreFiltersActive","anyFilterActive","chooseView","next","updateFilter","clearFilters","resetFilter","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","chips","typeOptions","priorityOptions","topicOptions","topics","topic","readOptions","readValue","InboxHeader","markAllAsRead","PushOptInToggle","SearchField","ViewChips","MoreFiltersButton","NativeSelect","value","group","items","NotificationCard","markAsRead","archiveNotification","recordAction","notification","IllustratedEmptyState","Button","Link","NotificationListFooter","loadMore","unreadCount","onMarkAllAsRead","CheckCheck","Settings","Archive","AdminToolsMenu"],"sources":["../../src/navigation-v2/NotificationInboxV2.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Archive, CheckCheck, Settings } from 'lucide-react';\nimport { Link } from 'react-router';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n IllustratedEmptyState,\n NativeSelect,\n useRememberedOpen,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { NotificationListFooter } from '../components/NotificationListFooter';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\nimport { needsAction, type InboxView } from './inboxFilters';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { AdminToolsMenu } from './AdminToolsMenu';\nimport { MoreFiltersButton, SearchField, ViewChips } from './FilterControls';\nimport { useNotificationPaths } from './paths';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst ALL = 'ALL';\n\n/**\n * Notifications, Navigation v2 (BOFF-11872, mockup 41). Level 1: the title\n * with the unread count, \"Mark all as read\", \"Notification settings\",\n * \"Archived\", search and the All · Unread · Needs action chips. Level 2: the\n * admin tools under \"More\", and Type, Priority, Topic and the full read state\n * under \"More filters\" (remembered per profile). Same queries as the classic\n * Notification Center.\n */\nexport function NotificationInboxV2() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n hasMore,\n isLoadingMore,\n loadMore,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n const [onlyNeedsAction, setOnlyNeedsAction] = useState(false);\n const [moreFiltersOpen, setMoreFiltersOpen] = useRememberedOpen(\n 'notifications.inbox.moreFilters',\n false\n );\n\n const view: InboxView | null = onlyNeedsAction\n ? 'action'\n : notificationFilter.isRead === false\n ? 'unread'\n : notificationFilter.isRead === null\n ? 'all'\n : null;\n\n const visible = useMemo(() => {\n const filtered = filterNotifications(notifications, notificationFilter);\n return onlyNeedsAction ? filtered.filter(needsAction) : filtered;\n }, [notifications, notificationFilter, onlyNeedsAction]);\n const grouped = useMemo(() => groupNotificationsByDate(visible, tr), [visible, tr]);\n\n const moreFiltersActive =\n notificationFilter.type !== ALL ||\n notificationFilter.priority !== ALL ||\n Boolean(notificationFilter.topicId) ||\n notificationFilter.isRead === true;\n const anyFilterActive = Boolean(notificationFilter.search) || moreFiltersActive || view !== 'all';\n\n const chooseView = (next: InboxView) => {\n setOnlyNeedsAction(next === 'action');\n updateFilter({ isRead: next === 'unread' ? false : null });\n };\n\n const clearFilters = () => {\n setOnlyNeedsAction(false);\n resetFilter();\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n // The permission-fallback state (NOTIF-CTR-15), unchanged.\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n const chips: Array<{ id: InboxView; label: string }> = [\n { id: 'all', label: tr('notifications.filterAll', 'All') },\n { id: 'unread', label: tr('notifications.filterUnread', 'Unread') },\n { id: 'action', label: tr('notifications.v2.needsAction', 'Needs action') },\n ];\n\n const typeOptions = [\n { value: ALL, label: tr('notifications.allTypes', 'All Types') },\n { value: 'SYSTEM', label: tr('notifications.typeSystem', 'System') },\n { value: 'ALERT', label: tr('notifications.typeAlert', 'Alert') },\n { value: 'TRANSACTIONAL', label: tr('notifications.typeTransactional', 'Transactional') },\n { value: 'MARKETING', label: tr('notifications.typeMarketing', 'Marketing') },\n ];\n const priorityOptions = [\n { value: ALL, label: tr('notifications.allPriorities', 'All Priorities') },\n { value: 'URGENT', label: tr('notifications.priorityUrgent', 'Urgent') },\n { value: 'HIGH', label: tr('notifications.priorityHigh', 'High') },\n { value: 'NORMAL', label: tr('notifications.priorityNormal', 'Normal') },\n { value: 'LOW', label: tr('notifications.priorityLow', 'Low') },\n ];\n const topicOptions = [\n { value: ALL, label: tr('notifications.allTopics', 'All Topics') },\n ...topics.map((topic) => ({ value: topic.id, label: topic.name })),\n ];\n const readOptions = [\n { value: 'ALL', label: tr('notifications.filterAll', 'All') },\n { value: 'UNREAD', label: tr('notifications.filterUnread', 'Unread') },\n { value: 'READ', label: tr('notifications.filterRead', 'Read') },\n ];\n const readValue =\n notificationFilter.isRead === null ? 'ALL' : notificationFilter.isRead ? 'READ' : 'UNREAD';\n\n return (\n <div className=\"mx-auto w-full max-w-5xl space-y-4 p-3 animate-in fade-in duration-200 sm:space-y-5 sm:p-6\">\n <InboxHeader unreadCount={unreadCount} onMarkAllAsRead={markAllAsRead} />\n\n <PushOptInToggle />\n\n <section\n data-tour=\"notification-center-filters\"\n aria-label={tr('notifications.v2.filters', 'Filters')}\n className=\"space-y-3\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <SearchField\n label={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(search) => updateFilter({ search })}\n tour=\"notification-center-search\"\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <ViewChips\n chips={chips}\n value={view}\n onChange={chooseView}\n testIdPrefix=\"notifications-view\"\n />\n <MoreFiltersButton\n open={moreFiltersOpen}\n active={moreFiltersActive}\n controls=\"notifications-more-filters\"\n onToggle={() => setMoreFiltersOpen(!moreFiltersOpen)}\n />\n </div>\n </div>\n\n <div\n id=\"notifications-more-filters\"\n hidden={!moreFiltersOpen}\n className=\"grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-2 lg:grid-cols-4\"\n >\n <NativeSelect\n aria-label={tr('notifications.v2.typeFilter', 'Type')}\n options={typeOptions}\n value={notificationFilter.type}\n // The options above are exactly ALL plus the NotificationType values.\n onValueChange={(value) => updateFilter({ type: value as NotificationType | 'ALL' })}\n />\n <NativeSelect\n aria-label={tr('notifications.v2.priorityFilter', 'Priority')}\n options={priorityOptions}\n value={notificationFilter.priority}\n // The options above are exactly ALL plus the NotificationPriority values.\n onValueChange={(value) =>\n updateFilter({ priority: value as NotificationPriority | 'ALL' })\n }\n />\n <NativeSelect\n aria-label={tr('notifications.v2.topicFilter', 'Topic')}\n options={topicOptions}\n value={notificationFilter.topicId || ALL}\n onValueChange={(value) => updateFilter({ topicId: value === ALL ? undefined : value })}\n />\n <NativeSelect\n aria-label={tr('notifications.v2.readFilter', 'Read state')}\n options={readOptions}\n value={readValue}\n onValueChange={(value) => {\n setOnlyNeedsAction(false);\n updateFilter({ isRead: value === 'ALL' ? null : value === 'READ' });\n }}\n />\n </div>\n\n {anyFilterActive && (\n <button\n type=\"button\"\n onClick={clearFilters}\n className=\"text-sm text-text-tertiary transition-colors hover:text-text-primary\"\n >\n {tr('notifications.v2.clearFilters', 'Clear filters')}\n </button>\n )}\n </section>\n\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {visible.length > 0 ? (\n Object.entries(grouped).map(([group, items]) => (\n <section key={group} aria-label={group}>\n <h2 className=\"mb-3 text-sm font-semibold text-text-tertiary\">{group}</h2>\n <div className=\"space-y-2\">\n {items.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n navigationV2\n showTopic={moreFiltersOpen}\n />\n ))}\n </div>\n </section>\n ))\n ) : (\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={\n notifications.length === 0\n ? tr('notifications.v2.emptyTitle', \"You're all caught up\")\n : tr('notifications.noNotificationsFound', 'No notifications found')\n }\n description={\n notifications.length === 0\n ? tr(\n 'notifications.v2.emptyDescription',\n \"Nothing here yet. We'll let you know when something needs you.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n action={\n notifications.length === 0 ? (\n <Button asChild variant=\"outline\">\n <Link to={paths.preferences}>\n {tr('notifications.v2.chooseHow', 'Choose how we reach you')}\n </Link>\n </Button>\n ) : (\n <Button type=\"button\" variant=\"outline\" onClick={clearFilters}>\n {tr('notifications.v2.clearFilters', 'Clear filters')}\n </Button>\n )\n }\n />\n )}\n </div>\n\n <NotificationListFooter\n hasMore={hasMore}\n isLoadingMore={isLoadingMore}\n onLoadMore={loadMore}\n shownCount={visible.length}\n />\n </div>\n );\n}\n\n/** The inbox header: title with the unread count and the level-1 actions. */\nfunction InboxHeader({\n unreadCount,\n onMarkAllAsRead,\n}: {\n unreadCount: number;\n onMarkAllAsRead: () => void;\n}) {\n const tr = useTr();\n const paths = useNotificationPaths();\n return (\n <header\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\n >\n <div className=\"min-w-0\">\n <h1 className=\"flex flex-wrap items-center gap-2 text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.title', 'Notifications')}\n {unreadCount > 0 && (\n <span\n data-tour=\"notification-center-unread-count\"\n className=\"inline-flex items-center gap-1.5 rounded-full bg-accent-primary/10 px-2.5 py-0.5 text-sm font-medium text-accent-primary\"\n >\n <span\n className=\"inline-block h-2 w-2 rounded-full bg-accent-primary\"\n aria-hidden=\"true\"\n />\n {tr('notifications.v2.unreadCount', '{{count}} unread', { count: unreadCount })}\n </span>\n )}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr('notifications.v2.subtitle', 'Everything the platform told you, in one place.')}\n </p>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={onMarkAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.markAllAsRead', 'Mark all as read')}\n </Button>\n )}\n <Button asChild variant=\"outline\" className=\"gap-2\">\n <Link to={paths.preferences} data-testid=\"notifications-settings-link\">\n <Settings size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.settings', 'Notification settings')}\n </Link>\n </Button>\n <Button asChild variant=\"ghost\" className=\"gap-2\">\n <Link to={paths.archived} data-testid=\"notifications-archived-link\">\n <Archive size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.archived', 'Archived')}\n </Link>\n </Button>\n <AdminToolsMenu />\n </div>\n </header>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAMA,IAAgB;CAAE,UAAU;CAAO,SAAS;AAAkB,GAC9DC,IAAuB,EAAE,SAAS,SAAS,GAC3CC,IAAM;AAUZ,SAAgBC,IAAsB;CACpC,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7B,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBC,EAAgB,GAClC,EACJ,kBACA,YACA,kBACA,aACA,gBACA,uBACA,eACA,kBACA,wBACA,iBACA,iBACA,oBACEC,EAAiB;EAAE,YAAYX;EAAe,cAAcC;CAAqB,CAAC,GAChF,EAAE,cAAWW,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,CAACC,GAAiBC,KAAsBC,EAAS,EAAK,GACtD,CAACC,GAAiBC,KAAsBC,GAC5C,mCACA,EACF,GAEMC,IAAyBN,IAC3B,WACAO,EAAmB,WAAW,KAC5B,WACAA,EAAmB,WAAW,OAC5B,QACA,MAEFC,IAAUC,QAAc;EAC5B,IAAMC,IAAWC,EAAoBC,GAAeL,CAAkB;EACtE,OAAOP,IAAkBU,EAAS,OAAOG,EAAW,I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