@burdenoff/microfe-notification 2026.1118.1 → 2026.1120.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/NotificationPanel.js +30 -24
- package/dist/components/NotificationPanel.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +2 -1
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +2 -1
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +110 -109
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +49 -48
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +127 -122
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +35 -34
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +7 -2
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +142 -141
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +77 -74
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +361 -361
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,14 +5,15 @@ import { NotificationCard as n } from "./NotificationCard.js";
|
|
|
5
5
|
import { useTr as r } from "../shared/hooks/useTr.js";
|
|
6
6
|
import { Bell as i, X as a } from "lucide-react";
|
|
7
7
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { EmptyState as l, useGlassEmptyStates as u } from "@burdenoff/fe-libs/ui";
|
|
8
9
|
// src/components/NotificationPanel.tsx
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
10
|
+
function d({ onViewAll: d }) {
|
|
11
|
+
let f = r(), p = u(), { isPanelOpen: m, togglePanel: h } = e(), { notifications: g, unreadCount: _, markAsRead: v, markAllAsRead: y, archiveNotification: b, recordAction: x } = t();
|
|
12
|
+
if (!m) return null;
|
|
13
|
+
let S = g.slice(0, 5);
|
|
13
14
|
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
|
|
14
15
|
className: "fixed inset-0 z-40",
|
|
15
|
-
onClick:
|
|
16
|
+
onClick: h,
|
|
16
17
|
"aria-hidden": "true"
|
|
17
18
|
}), /* @__PURE__ */ c("div", {
|
|
18
19
|
"data-tour": "notification-panel",
|
|
@@ -29,24 +30,24 @@ function l({ onViewAll: l }) {
|
|
|
29
30
|
}),
|
|
30
31
|
/* @__PURE__ */ s("h2", {
|
|
31
32
|
className: "text-base font-semibold text-primary",
|
|
32
|
-
children:
|
|
33
|
+
children: f("notifCommon.notifications", "Notifications")
|
|
33
34
|
}),
|
|
34
|
-
|
|
35
|
+
_ > 0 && /* @__PURE__ */ s("span", {
|
|
35
36
|
className: "px-2 py-0.5 text-xs font-semibold tabular-nums text-white bg-primary-500 rounded-full",
|
|
36
|
-
children:
|
|
37
|
+
children: _
|
|
37
38
|
})
|
|
38
39
|
]
|
|
39
40
|
}), /* @__PURE__ */ c("div", {
|
|
40
41
|
className: "flex items-center gap-2",
|
|
41
|
-
children: [
|
|
42
|
+
children: [_ > 0 && /* @__PURE__ */ s("button", {
|
|
42
43
|
"data-tour": "notification-panel-mark-all-read",
|
|
43
|
-
onClick:
|
|
44
|
+
onClick: y,
|
|
44
45
|
className: "text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150",
|
|
45
|
-
children:
|
|
46
|
+
children: f("notifCommon.markAllRead", "Mark all read")
|
|
46
47
|
}), /* @__PURE__ */ s("button", {
|
|
47
|
-
onClick:
|
|
48
|
+
onClick: h,
|
|
48
49
|
className: "p-1 hover:bg-bg-sunken rounded transition-colors duration-150",
|
|
49
|
-
"aria-label":
|
|
50
|
+
"aria-label": f("notifCommon.closePanel", "Close panel"),
|
|
50
51
|
children: /* @__PURE__ */ s(a, {
|
|
51
52
|
size: 16,
|
|
52
53
|
className: "text-tertiary"
|
|
@@ -56,16 +57,21 @@ function l({ onViewAll: l }) {
|
|
|
56
57
|
}),
|
|
57
58
|
/* @__PURE__ */ s("div", {
|
|
58
59
|
className: "flex-1 overflow-y-auto",
|
|
59
|
-
children:
|
|
60
|
+
children: S.length > 0 ? /* @__PURE__ */ s("div", {
|
|
60
61
|
className: "flex flex-col gap-2 p-2",
|
|
61
|
-
children:
|
|
62
|
+
children: S.map((e) => /* @__PURE__ */ s(n, {
|
|
62
63
|
notification: e,
|
|
63
|
-
onMarkAsRead:
|
|
64
|
-
onArchive:
|
|
65
|
-
onAction:
|
|
64
|
+
onMarkAsRead: v,
|
|
65
|
+
onArchive: b,
|
|
66
|
+
onAction: x,
|
|
66
67
|
compact: !0,
|
|
67
68
|
analyticsSource: "panel"
|
|
68
69
|
}, e.id))
|
|
70
|
+
}) : p ? /* @__PURE__ */ s(l, {
|
|
71
|
+
kind: "all-done",
|
|
72
|
+
size: "panel",
|
|
73
|
+
title: f("notifCommon.noNotifications", "No notifications"),
|
|
74
|
+
description: f("notifCommon.allCaughtUp", "You're all caught up!")
|
|
69
75
|
}) : /* @__PURE__ */ c("div", {
|
|
70
76
|
className: "flex flex-col items-center justify-center p-8 text-center animate-in fade-in duration-200",
|
|
71
77
|
children: [
|
|
@@ -75,29 +81,29 @@ function l({ onViewAll: l }) {
|
|
|
75
81
|
}),
|
|
76
82
|
/* @__PURE__ */ s("p", {
|
|
77
83
|
className: "text-sm text-text-secondary",
|
|
78
|
-
children:
|
|
84
|
+
children: f("notifCommon.noNotifications", "No notifications")
|
|
79
85
|
}),
|
|
80
86
|
/* @__PURE__ */ s("p", {
|
|
81
87
|
className: "text-xs text-tertiary mt-1",
|
|
82
|
-
children:
|
|
88
|
+
children: f("notifCommon.allCaughtUp", "You're all caught up!")
|
|
83
89
|
})
|
|
84
90
|
]
|
|
85
91
|
})
|
|
86
92
|
}),
|
|
87
|
-
|
|
93
|
+
S.length > 0 && /* @__PURE__ */ s("div", {
|
|
88
94
|
className: "p-3 border-t border-default",
|
|
89
95
|
children: /* @__PURE__ */ s("button", {
|
|
90
96
|
"data-tour": "notification-panel-view-all",
|
|
91
97
|
onClick: () => {
|
|
92
|
-
|
|
98
|
+
h(), d && d();
|
|
93
99
|
},
|
|
94
100
|
className: "w-full py-2 text-sm text-accent-primary hover:text-accent-primary/80 font-medium transition-colors duration-150",
|
|
95
|
-
children:
|
|
101
|
+
children: f("notifCommon.viewAllNotifications", "View All Notifications")
|
|
96
102
|
})
|
|
97
103
|
})
|
|
98
104
|
]
|
|
99
105
|
})] });
|
|
100
106
|
}
|
|
101
|
-
export {
|
|
107
|
+
export { d as NotificationPanel };
|
|
102
108
|
|
|
103
109
|
//# sourceMappingURL=NotificationPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPanel.js","names":["_Fragment","NotificationPanel","tr","useTr","useNotificationStore","useNotifications","isPanelOpen","recentNotifications","notifications","Fragment","togglePanel","Bell","unreadCount","markAllAsRead","X","NotificationCard","markAsRead","archiveNotification","recordAction","notification","onViewAll"],"sources":["../../src/components/NotificationPanel.tsx"],"sourcesContent":["import { X, Bell } from 'lucide-react';\nimport { useNotificationStore } from '../store/notificationStore';\nimport { useNotifications } from '../hooks';\nimport { NotificationCard } from './NotificationCard';\nimport { useTr } from '../shared/hooks/useTr';\n\ninterface NotificationPanelProps {\n onViewAll?: () => void;\n}\n\n/**\n * Notification dropdown panel\n *\n * Quick view of recent notifications that appears when clicking the bell icon\n */\nexport function NotificationPanel({ onViewAll }: NotificationPanelProps) {\n const tr = useTr();\n const { isPanelOpen, togglePanel } = useNotificationStore();\n const {\n notifications,\n unreadCount,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n } = useNotifications();\n\n if (!isPanelOpen) return null;\n\n // Show only the 5 most recent notifications\n const recentNotifications = notifications.slice(0, 5);\n\n return (\n <>\n {/* Backdrop */}\n <div className=\"fixed inset-0 z-40\" onClick={togglePanel} aria-hidden=\"true\" />\n\n {/* Panel */}\n <div\n data-tour=\"notification-panel\"\n className=\"absolute right-0 top-full mt-2 w-96 max-h-[600px] bg-gloss-card border border-border-seam rounded-lg shadow-[var(--shadow-pop)] z-50 overflow-hidden flex flex-col animate-in fade-in slide-in-from-top-2 duration-200\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between p-4 border-b border-border-seam bg-accent-wash\">\n <div className=\"flex items-center gap-2\">\n <Bell size={20} className=\"text-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifCommon.notifications', 'Notifications')}\n </h2>\n {unreadCount > 0 && (\n <span className=\"px-2 py-0.5 text-xs font-semibold tabular-nums text-white bg-primary-500 rounded-full\">\n {unreadCount}\n </span>\n )}\n </div>\n\n <div className=\"flex items-center gap-2\">\n {unreadCount > 0 && (\n <button\n data-tour=\"notification-panel-mark-all-read\"\n onClick={markAllAsRead}\n className=\"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n >\n {tr('notifCommon.markAllRead', 'Mark all read')}\n </button>\n )}\n <button\n onClick={togglePanel}\n className=\"p-1 hover:bg-bg-sunken rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.closePanel', 'Close panel')}\n >\n <X size={16} className=\"text-tertiary\" />\n </button>\n </div>\n </div>\n\n {/* Notifications list */}\n <div className=\"flex-1 overflow-y-auto\">\n {recentNotifications.length > 0 ? (\n <div className=\"flex flex-col gap-2 p-2\">\n {recentNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n compact\n analyticsSource=\"panel\"\n />\n ))}\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center p-8 text-center animate-in fade-in duration-200\">\n <Bell size={48} className=\"text-tertiary mb-4\" />\n <p className=\"text-sm text-text-secondary\">\n {tr('notifCommon.noNotifications', 'No notifications')}\n </p>\n <p className=\"text-xs text-tertiary mt-1\">\n {tr('notifCommon.allCaughtUp', \"You're all caught up!\")}\n </p>\n </div>\n )}\n </div>\n\n {/* Footer */}\n {recentNotifications.length > 0 && (\n <div className=\"p-3 border-t border-default\">\n <button\n data-tour=\"notification-panel-view-all\"\n onClick={() => {\n togglePanel();\n if (onViewAll) onViewAll();\n }}\n className=\"w-full py-2 text-sm text-accent-primary hover:text-accent-primary/80 font-medium transition-colors duration-150\"\n >\n {tr('notifCommon.viewAllNotifications', 'View All Notifications')}\n </button>\n </div>\n )}\n </div>\n </>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationPanel.js","names":["_Fragment","NotificationPanel","tr","useTr","glass","useGlassEmptyStates","useNotificationStore","useNotifications","isPanelOpen","recentNotifications","notifications","Fragment","togglePanel","Bell","unreadCount","markAllAsRead","X","NotificationCard","markAsRead","archiveNotification","recordAction","notification","EmptyState","onViewAll"],"sources":["../../src/components/NotificationPanel.tsx"],"sourcesContent":["import { X, Bell } from 'lucide-react';\nimport { EmptyState, useGlassEmptyStates } from '@burdenoff/fe-libs/ui';\nimport { useNotificationStore } from '../store/notificationStore';\nimport { useNotifications } from '../hooks';\nimport { NotificationCard } from './NotificationCard';\nimport { useTr } from '../shared/hooks/useTr';\n\ninterface NotificationPanelProps {\n onViewAll?: () => void;\n}\n\n/**\n * Notification dropdown panel\n *\n * Quick view of recent notifications that appears when clicking the bell icon\n */\nexport function NotificationPanel({ onViewAll }: NotificationPanelProps) {\n const tr = useTr();\n const glass = useGlassEmptyStates();\n const { isPanelOpen, togglePanel } = useNotificationStore();\n const {\n notifications,\n unreadCount,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n } = useNotifications();\n\n if (!isPanelOpen) return null;\n\n // Show only the 5 most recent notifications\n const recentNotifications = notifications.slice(0, 5);\n\n return (\n <>\n {/* Backdrop */}\n <div className=\"fixed inset-0 z-40\" onClick={togglePanel} aria-hidden=\"true\" />\n\n {/* Panel */}\n <div\n data-tour=\"notification-panel\"\n className=\"absolute right-0 top-full mt-2 w-96 max-h-[600px] bg-gloss-card border border-border-seam rounded-lg shadow-[var(--shadow-pop)] z-50 overflow-hidden flex flex-col animate-in fade-in slide-in-from-top-2 duration-200\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between p-4 border-b border-border-seam bg-accent-wash\">\n <div className=\"flex items-center gap-2\">\n <Bell size={20} className=\"text-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifCommon.notifications', 'Notifications')}\n </h2>\n {unreadCount > 0 && (\n <span className=\"px-2 py-0.5 text-xs font-semibold tabular-nums text-white bg-primary-500 rounded-full\">\n {unreadCount}\n </span>\n )}\n </div>\n\n <div className=\"flex items-center gap-2\">\n {unreadCount > 0 && (\n <button\n data-tour=\"notification-panel-mark-all-read\"\n onClick={markAllAsRead}\n className=\"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n >\n {tr('notifCommon.markAllRead', 'Mark all read')}\n </button>\n )}\n <button\n onClick={togglePanel}\n className=\"p-1 hover:bg-bg-sunken rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.closePanel', 'Close panel')}\n >\n <X size={16} className=\"text-tertiary\" />\n </button>\n </div>\n </div>\n\n {/* Notifications list */}\n <div className=\"flex-1 overflow-y-auto\">\n {recentNotifications.length > 0 ? (\n <div className=\"flex flex-col gap-2 p-2\">\n {recentNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n compact\n analyticsSource=\"panel\"\n />\n ))}\n </div>\n ) : glass ? (\n <EmptyState\n kind=\"all-done\"\n size=\"panel\"\n title={tr('notifCommon.noNotifications', 'No notifications')}\n description={tr('notifCommon.allCaughtUp', \"You're all caught up!\")}\n />\n ) : (\n // BOFF-15570: drop the legacy branch once every product opts in to glassEmptyStates.\n <div className=\"flex flex-col items-center justify-center p-8 text-center animate-in fade-in duration-200\">\n <Bell size={48} className=\"text-tertiary mb-4\" />\n <p className=\"text-sm text-text-secondary\">\n {tr('notifCommon.noNotifications', 'No notifications')}\n </p>\n <p className=\"text-xs text-tertiary mt-1\">\n {tr('notifCommon.allCaughtUp', \"You're all caught up!\")}\n </p>\n </div>\n )}\n </div>\n\n {/* Footer */}\n {recentNotifications.length > 0 && (\n <div className=\"p-3 border-t border-default\">\n <button\n data-tour=\"notification-panel-view-all\"\n onClick={() => {\n togglePanel();\n if (onViewAll) onViewAll();\n }}\n className=\"w-full py-2 text-sm text-accent-primary hover:text-accent-primary/80 font-medium transition-colors duration-150\"\n >\n {tr('notifCommon.viewAllNotifications', 'View All Notifications')}\n </button>\n </div>\n )}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgBC,EAAkB,EAAE,gBAAqC;CACvE,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAoB,GAC5B,EAAE,gBAAa,mBAAgBC,EAAqB,GACpD,EACJ,kBACA,gBACA,eACA,kBACA,wBACA,oBACEC,EAAiB;CAErB,IAAI,CAACC,GAAa,OAAO;CAGzB,IAAMC,IAAsBC,EAAc,MAAM,GAAG,CAAC;CAEpD,OACE,kBAAAV,GAAA,EAAA,UAAA,CAEE,kBAAC,OAAD;EAAK,WAAU;EAAqB,SAASY;EAAa,eAAY;CAAQ,CAAA,GAG9E,kBAAC,OAAD;EACE,aAAU;EACV,WAAU;EAFZ,UAAA;GAKE,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAACC,GAAD;OAAM,MAAM;OAAI,WAAU;MAAgB,CAAA;MAC1C,kBAAC,MAAD;OAAI,WAAU;OACX,UAAAX,EAAG,6BAA6B,eAAe;MAC9C,CAAA;MACHY,IAAc,KACb,kBAAC,QAAD;OAA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CAAA;EAEJ;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
|
|
@@ -164,7 +164,8 @@ function M() {
|
|
|
164
164
|
}, t.id)) : /* @__PURE__ */ v(T, {
|
|
165
165
|
illustration: Z ? "empty-search" : "empty-notifications",
|
|
166
166
|
title: Z ? M("notifications.noNotificationsFound", "No notifications found") : G === "archived" ? M("notifications.v2.archivedEmptyTitle", "Nothing archived") : M("notifications.historyEmptyTitle", "No history yet"),
|
|
167
|
-
description: Z ? M("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : G === "archived" ? M("notifications.v2.archivedEmptyDescription", "Archive a notification from your inbox and it moves here.") : M("notifications.historyEmptyDescription", "Notifications you receive will be archived here so you can always find them again.")
|
|
167
|
+
description: Z ? M("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : G === "archived" ? M("notifications.v2.archivedEmptyDescription", "Archive a notification from your inbox and it moves here.") : M("notifications.historyEmptyDescription", "Notifications you receive will be archived here so you can always find them again."),
|
|
168
|
+
kind: B.search ? "no-results" : Z ? "filtered" : "first-use"
|
|
168
169
|
})
|
|
169
170
|
}),
|
|
170
171
|
/* @__PURE__ */ v(r, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationArchivedV2.js","names":["HISTORY_FILTER","ALL","toDateInput","value","NotificationArchivedV2","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotificationTopics","useNotifications","view","setView","useState","moreFiltersOpen","setMoreFiltersOpen","useRememberedOpen","visible","useMemo","notifications","inArchivedView","notification","moreFiltersActive","notificationFilter","hasActiveFilters","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","chips","topicOptions","topics","topic","BackToNotifications","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","exportNotificationsAsCsv","Download","SearchField","updateFilter","ViewChips","MoreFiltersButton","NativeSelect","Input","NotificationCard","archiveNotification","recordAction","unarchiveNotification","IllustratedEmptyState","NotificationListFooter","loadMore"],"sources":["../../src/navigation-v2/NotificationArchivedV2.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Download, MoreHorizontal } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n IllustratedEmptyState,\n Input,\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 { inArchivedView, type ArchivedView } from './inboxFilters';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\nimport { BackToNotifications } from './BackToNotifications';\nimport { MoreFiltersButton, SearchField, ViewChips } from './FilterControls';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\nconst ALL = 'ALL';\n\nfunction toDateInput(value: Date | null): string {\n return value ? value.toISOString().split('T')[0] : '';\n}\n\n/**\n * Archived, Navigation v2 (BOFF-11872; today's personal Notification\n * History). Same query as the classic page (every channel, archived or\n * not); the \"Archived\" chip, on by default, shows what you archived and\n * \"Everything\" shows the full history. Restore on each archived row, search\n * at level 1, topic and dates under \"More filters\", and \"Download as\n * spreadsheet\" in \"⋯\".\n */\nexport function NotificationArchivedV2() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n hasMore,\n isLoadingMore,\n loadMore,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n const [view, setView] = useState<ArchivedView>('archived');\n const [moreFiltersOpen, setMoreFiltersOpen] = useRememberedOpen(\n 'notifications.archived.moreFilters',\n false\n );\n\n const visible = useMemo(\n () => notifications.filter((notification) => inArchivedView(notification, view)),\n [notifications, view]\n );\n\n const moreFiltersActive = Boolean(\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\n );\n const hasActiveFilters = Boolean(notificationFilter.search) || moreFiltersActive;\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 if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n const chips: Array<{ id: ArchivedView; label: string }> = [\n { id: 'archived', label: tr('notifications.v2.archived', 'Archived') },\n { id: 'everything', label: tr('notifications.v2.everything', 'Everything') },\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\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 <BackToNotifications />\n <header\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\n >\n <div>\n <h1 className=\"text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.archivedTitle', 'Archived')}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr(\n 'notifications.v2.archivedSubtitle',\n 'Notifications you archived. Restore one to put it back in your inbox.'\n )}\n </p>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr('notifications.v2.moreActions', 'More actions')}\n data-testid=\"notifications-archived-overflow\"\n >\n <MoreHorizontal size={18} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem\n data-tour=\"notification-history-export\"\n disabled={notifications.length === 0}\n onSelect={() => exportNotificationsAsCsv(tr, notifications)}\n >\n <Download size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.downloadSpreadsheet', 'Download as spreadsheet')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </header>\n\n <section aria-label={tr('notifications.v2.filters', 'Filters')} className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <SearchField\n label={tr('notifications.searchByTitleOrContent', 'Search by title or content...')}\n value={notificationFilter.search}\n onChange={(search) => updateFilter({ search })}\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <ViewChips\n chips={chips}\n value={view}\n onChange={setView}\n testIdPrefix=\"notifications-archived-view\"\n />\n <MoreFiltersButton\n open={moreFiltersOpen}\n active={moreFiltersActive}\n controls=\"notifications-archived-more-filters\"\n onToggle={() => setMoreFiltersOpen(!moreFiltersOpen)}\n />\n </div>\n </div>\n <div\n id=\"notifications-archived-more-filters\"\n hidden={!moreFiltersOpen}\n className=\"grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-3\"\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 <Input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={toDateInput(notificationFilter.dateRange.start)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n <Input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={toDateInput(notificationFilter.dateRange.end)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n </div>\n </section>\n\n <div className=\"space-y-2\">\n {visible.length > 0 ? (\n visible.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={notification.archivedAt ? undefined : archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n navigationV2\n showTopic={moreFiltersOpen}\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => unarchiveNotification(notification.id)}\n >\n {tr('notifications.restore', 'Restore')}\n </Button>\n </div>\n )}\n </div>\n ))\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : view === 'archived'\n ? tr('notifications.v2.archivedEmptyTitle', 'Nothing archived')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : view === 'archived'\n ? tr(\n 'notifications.v2.archivedEmptyDescription',\n 'Archive a notification from your inbox and it moves here.'\n )\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\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"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe,GAC3DC,IAAM;AAEZ,SAASC,EAAY,GAA4B;CAC/C,OAAOC,IAAQA,EAAM,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK;AACrD;AAUA,SAAgBC,IAAyB;CACvC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,OAAuBC,E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IAED,kBAAC8B,GAAD;KACE,cAAc3B,IAAmB,iBAAiB;KAClD,OACEA,IACIpB,EAAG,sCAAsC,wBAAwB,IACjEO,MAAS,aACPP,EAAG,uCAAuC,kBAAkB,IAC5DA,EAAG,mCAAmC,gBAAgB;KAE9D,aACEoB,IACIpB,EAAG,yCAAyC,4BAA4B,IACxEO,MAAS,aACPP,EACE,6CACA,2DACF,IACAA,EACE,yCACA,oFACF;IAET,CAAA;GAEA,CAAA;GAEL,kBAACgD,GAAD;IACW;IACM;IACf,YAAYC;IACZ,YAAYpC,EAAQ;GACrB,CAAA;EACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"NotificationArchivedV2.js","names":["HISTORY_FILTER","ALL","toDateInput","value","NotificationArchivedV2","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotificationTopics","useNotifications","view","setView","useState","moreFiltersOpen","setMoreFiltersOpen","useRememberedOpen","visible","useMemo","notifications","inArchivedView","notification","moreFiltersActive","notificationFilter","hasActiveFilters","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","chips","topicOptions","topics","topic","BackToNotifications","DropdownMenu","DropdownMenuTrigger","Button","MoreHorizontal","DropdownMenuContent","DropdownMenuItem","exportNotificationsAsCsv","Download","SearchField","updateFilter","ViewChips","MoreFiltersButton","NativeSelect","Input","NotificationCard","archiveNotification","recordAction","unarchiveNotification","IllustratedEmptyState","NotificationListFooter","loadMore"],"sources":["../../src/navigation-v2/NotificationArchivedV2.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Download, MoreHorizontal } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n IllustratedEmptyState,\n Input,\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 { inArchivedView, type ArchivedView } from './inboxFilters';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\nimport { BackToNotifications } from './BackToNotifications';\nimport { MoreFiltersButton, SearchField, ViewChips } from './FilterControls';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\nconst ALL = 'ALL';\n\nfunction toDateInput(value: Date | null): string {\n return value ? value.toISOString().split('T')[0] : '';\n}\n\n/**\n * Archived, Navigation v2 (BOFF-11872; today's personal Notification\n * History). Same query as the classic page (every channel, archived or\n * not); the \"Archived\" chip, on by default, shows what you archived and\n * \"Everything\" shows the full history. Restore on each archived row, search\n * at level 1, topic and dates under \"More filters\", and \"Download as\n * spreadsheet\" in \"⋯\".\n */\nexport function NotificationArchivedV2() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n hasMore,\n isLoadingMore,\n loadMore,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n const [view, setView] = useState<ArchivedView>('archived');\n const [moreFiltersOpen, setMoreFiltersOpen] = useRememberedOpen(\n 'notifications.archived.moreFilters',\n false\n );\n\n const visible = useMemo(\n () => notifications.filter((notification) => inArchivedView(notification, view)),\n [notifications, view]\n );\n\n const moreFiltersActive = Boolean(\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\n );\n const hasActiveFilters = Boolean(notificationFilter.search) || moreFiltersActive;\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 if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n const chips: Array<{ id: ArchivedView; label: string }> = [\n { id: 'archived', label: tr('notifications.v2.archived', 'Archived') },\n { id: 'everything', label: tr('notifications.v2.everything', 'Everything') },\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\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 <BackToNotifications />\n <header\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\"\n >\n <div>\n <h1 className=\"text-xl font-semibold text-text-primary sm:text-2xl\">\n {tr('notifications.v2.archivedTitle', 'Archived')}\n </h1>\n <p className=\"mt-1 text-sm text-text-secondary\">\n {tr(\n 'notifications.v2.archivedSubtitle',\n 'Notifications you archived. Restore one to put it back in your inbox.'\n )}\n </p>\n </div>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tr('notifications.v2.moreActions', 'More actions')}\n data-testid=\"notifications-archived-overflow\"\n >\n <MoreHorizontal size={18} aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuItem\n data-tour=\"notification-history-export\"\n disabled={notifications.length === 0}\n onSelect={() => exportNotificationsAsCsv(tr, notifications)}\n >\n <Download size={16} aria-hidden=\"true\" />\n {tr('notifications.v2.downloadSpreadsheet', 'Download as spreadsheet')}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </header>\n\n <section aria-label={tr('notifications.v2.filters', 'Filters')} className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center\">\n <SearchField\n label={tr('notifications.searchByTitleOrContent', 'Search by title or content...')}\n value={notificationFilter.search}\n onChange={(search) => updateFilter({ search })}\n />\n <div className=\"flex flex-wrap items-center gap-2\">\n <ViewChips\n chips={chips}\n value={view}\n onChange={setView}\n testIdPrefix=\"notifications-archived-view\"\n />\n <MoreFiltersButton\n open={moreFiltersOpen}\n active={moreFiltersActive}\n controls=\"notifications-archived-more-filters\"\n onToggle={() => setMoreFiltersOpen(!moreFiltersOpen)}\n />\n </div>\n </div>\n <div\n id=\"notifications-archived-more-filters\"\n hidden={!moreFiltersOpen}\n className=\"grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-3\"\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 <Input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={toDateInput(notificationFilter.dateRange.start)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n <Input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={toDateInput(notificationFilter.dateRange.end)}\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n />\n </div>\n </section>\n\n <div className=\"space-y-2\">\n {visible.length > 0 ? (\n visible.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={notification.archivedAt ? undefined : archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n navigationV2\n showTopic={moreFiltersOpen}\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => unarchiveNotification(notification.id)}\n >\n {tr('notifications.restore', 'Restore')}\n </Button>\n </div>\n )}\n </div>\n ))\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : view === 'archived'\n ? tr('notifications.v2.archivedEmptyTitle', 'Nothing archived')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : view === 'archived'\n ? tr(\n 'notifications.v2.archivedEmptyDescription',\n 'Archive a notification from your inbox and it moves here.'\n )\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n kind={\n notificationFilter.search ? 'no-results' : hasActiveFilters ? 'filtered' : 'first-use'\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"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe,GAC3DC,IAAM;AAEZ,SAASC,EAAY,GAA4B;CAC/C,OAAOC,IAAQA,EAAM,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK;AACrD;AAUA,SAAgBC,IAAyB;CACvC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,OAAuBC,EAAe,GAClE,EAAE,mBAAgBC,EAAgB,GAClC,EAAE,cAAWC,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,EACJ,kBACA,YACA,kBACA,aACA,uBACA,iBACA,wBACA,0BACA,oBACEC,EAAiB,EAAE,YAAYX,EAAe,CAAC,GAC7C,CAACY,GAAMC,KAAWC,EAAuB,UAAU,GACnD,CAACC,GAAiBC,KAAsBC,EAC5C,sCACA,EACF,GAEMC,IAAUC,QACRC,EAAc,QAAQ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IAAmB,aAAa;IAE9E,CAAA;GAEA,CAAA;GAEL,kBAAC4B,GAAD;IACW;IACM;IACf,YAAYC;IACZ,YAAYpC,EAAQ;GACrB,CAAA;EACE;;AAET"}
|
|
@@ -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","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,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,KAAkB,EAAQV,EAAmB,UAAWS,KAAqBV,MAAS,OAEtFY,MAAc,MAAoB;EAEtC,AADAjB,EAAmBkB,MAAS,QAAQ,GACpCC,EAAa,EAAE,QAAQD,MAAS,YAA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,UAAA,CAME,kBAACC,GAAD;MAAY,MAAM;MAAI,eAAY;KAAQ,CAAA,GACzCjE,EAAG,kCAAkC,kBAAkB,CAClD;;IAEV,kBAAC2D,GAAD;KAAQ,SAAA;KAAQ,SAAQ;KAAU,WAAU;KAC1C,UAAA,kBAACC,GAAD;MAAM,IAAI1D,EAAM;MAAa,eAAY;MAAzC,UAAA,CACE,kBAACgE,GAAD;OAAU,MAAM;OAAI,eAAY;MAAQ,CAAA,GACvClE,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,kBAACiE,GAAD;OAAS,MAAM;OAAI,eAAY;MAAQ,CAAA,GACtCnE,EAAG,6BAA6B,UAAU,CACvC;;IACA,CAAA;IACR,kBAACoE,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 // The server applies the search and the filters, so an empty list says nothing about\n // whether there are notifications: the kind follows the filters. An empty inbox, or an\n // empty Unread / Needs action view, means everything is handled.\n kind={\n notificationFilter.search ? 'no-results' : moreFiltersActive ? 'filtered' : 'all-done'\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,C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