@burdenoff/microfe-notification 2026.1124.1 → 2026.1127.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/AdminNotificationRoutes.js +59 -51
- package/dist/AdminNotificationRoutes.js.map +1 -1
- package/dist/NotificationRoutes.js +76 -68
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/UserNotificationRoutes.js +39 -31
- package/dist/UserNotificationRoutes.js.map +1 -1
- package/dist/components/NotificationListFooter.js +1 -1
- package/dist/components/NotificationListFooter.js.map +1 -1
- package/dist/components/NotificationPanel.js +0 -1
- package/dist/components/NotificationPanel.js.map +1 -1
- package/dist/components/loadingSystem.d.ts +64 -0
- package/dist/components/loadingSystem.js +34 -0
- package/dist/components/loadingSystem.js.map +1 -0
- package/dist/graphql/global-client.js +34 -34
- package/dist/index.js +9 -11
- package/dist/navigation-v2/AdminPageV2.js +23 -16
- package/dist/navigation-v2/AdminPageV2.js.map +1 -1
- package/dist/navigation-v2/NotificationArchivedV2.js +104 -98
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +133 -127
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/navigation-v2/NotificationSettingsV2.js +91 -85
- package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
- package/dist/navigation-v2/NotificationsV2Landing.js +31 -23
- package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +442 -432
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +93 -87
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +231 -225
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +72 -66
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationLandingPage.js +42 -34
- package/dist/pages/NotificationLandingPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +80 -71
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +192 -181
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +124 -118
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +248 -233
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/package.json +5 -2
- package/dist/components/index.js +0 -4
- package/dist/hooks/index.js +0 -8
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +0 -23
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +0 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +0 -15
- package/dist/node_modules/@apollo/client/errors/utils.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +0 -51
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +0 -40
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +0 -33
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -5
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +0 -15
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +0 -18
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +0 -20
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +0 -16
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +0 -22
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +0 -56
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/version.js +0 -5
- package/dist/node_modules/@apollo/client/version.js.map +0 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +0 -66
- package/dist/node_modules/@wry/caches/lib/weak.js.map +0 -1
- package/dist/node_modules/@wry/trie/lib/index.js +0 -52
- package/dist/node_modules/@wry/trie/lib/index.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/client.js +0 -279
- package/dist/node_modules/graphql-ws/dist/client.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +0 -61
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +0 -20
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -77
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -116
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -96
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -21
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +0 -1
- package/dist/node_modules/tslib/tslib.es6.js +0 -51
- package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
|
@@ -1,182 +1,188 @@
|
|
|
1
1
|
import { NotificationCard as e } from "../components/NotificationCard.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "../hooks/index.js";
|
|
2
|
+
import { NotificationListFooter as t } from "../components/NotificationListFooter.js";
|
|
3
|
+
import { NOTIFICATION_PERMISSIONS as n } from "../constants/permissions.js";
|
|
4
|
+
import { useNotifications as r } from "../hooks/useNotifications.js";
|
|
5
|
+
import { useNotificationTopics as i } from "../hooks/useNotificationTopics.js";
|
|
7
6
|
import { useNotification as a } from "../providers/NotificationProvider.js";
|
|
8
7
|
import { useTr as o } from "../shared/hooks/useTr.js";
|
|
9
8
|
import { inArchivedView as s } from "./inboxFilters.js";
|
|
10
9
|
import { exportNotificationsAsCsv as c } from "../utils/notificationHistoryExport.js";
|
|
11
10
|
import { BackToNotifications as l } from "./BackToNotifications.js";
|
|
12
11
|
import { MoreFiltersButton as u, SearchField as d, ViewChips as f } from "./FilterControls.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { CompactMarkOr as p, SectionLoaderOr as ee } from "../components/loadingSystem.js";
|
|
13
|
+
import { useMemo as m, useState as h } from "react";
|
|
14
|
+
import { usePermissions as g } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
15
|
+
import { Download as _, MoreHorizontal as v } from "lucide-react";
|
|
16
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
17
|
+
import { Button as x, DropdownMenu as S, DropdownMenuContent as C, DropdownMenuItem as w, DropdownMenuTrigger as T, IllustratedEmptyState as E, Input as D, NativeSelect as O, useRememberedOpen as k } from "@burdenoff/fe-libs/ui";
|
|
18
18
|
// src/navigation-v2/NotificationArchivedV2.tsx
|
|
19
|
-
var
|
|
19
|
+
var A = {
|
|
20
20
|
archived: null,
|
|
21
21
|
channel: "ALL"
|
|
22
|
-
},
|
|
23
|
-
function
|
|
22
|
+
}, j = "ALL";
|
|
23
|
+
function M(e) {
|
|
24
24
|
return e ? e.toISOString().split("T")[0] : "";
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
function N() {
|
|
27
|
+
let N = o(), { hasPermission: P, isLoading: F } = g(), { currentUser: I } = a(), { topics: L } = i({ isActive: !0 }), { notifications: R, hasMore: z, isLoadingMore: B, loadMore: V, notificationFilter: H, updateFilter: U, archiveNotification: W, unarchiveNotification: G, recordAction: K } = r({ baseFilter: A }), [q, J] = h("archived"), [Y, X] = k("notifications.archived.moreFilters", !1), Z = m(() => R.filter((e) => s(e, q)), [R, q]), Q = !!(H.topicId || H.dateRange.start || H.dateRange.end), $ = !!H.search || Q;
|
|
28
|
+
if (F) return /* @__PURE__ */ y(ee, {
|
|
29
|
+
minHeight: "16rem",
|
|
30
|
+
today: /* @__PURE__ */ y("div", {
|
|
31
|
+
className: "flex h-64 items-center justify-center",
|
|
32
|
+
children: /* @__PURE__ */ y(p, {
|
|
33
|
+
className: "h-8 w-8",
|
|
34
|
+
today: /* @__PURE__ */ y("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
35
|
+
})
|
|
36
|
+
})
|
|
31
37
|
});
|
|
32
|
-
if (!
|
|
38
|
+
if (!P(n.NOTIFICATION_LIST) && !I?.id) return /* @__PURE__ */ y("div", {
|
|
33
39
|
className: "p-8 text-center text-text-secondary",
|
|
34
|
-
children:
|
|
40
|
+
children: N("notifications.noPermissionHistory", "You don't have permission to view notification history.")
|
|
35
41
|
});
|
|
36
|
-
let
|
|
42
|
+
let te = [{
|
|
37
43
|
id: "archived",
|
|
38
|
-
label:
|
|
44
|
+
label: N("notifications.v2.archived", "Archived")
|
|
39
45
|
}, {
|
|
40
46
|
id: "everything",
|
|
41
|
-
label:
|
|
42
|
-
}],
|
|
43
|
-
value:
|
|
44
|
-
label:
|
|
45
|
-
}, ...
|
|
47
|
+
label: N("notifications.v2.everything", "Everything")
|
|
48
|
+
}], ne = [{
|
|
49
|
+
value: j,
|
|
50
|
+
label: N("notifications.allTopics", "All Topics")
|
|
51
|
+
}, ...L.map((e) => ({
|
|
46
52
|
value: e.id,
|
|
47
53
|
label: e.name
|
|
48
54
|
}))];
|
|
49
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ b("div", {
|
|
50
56
|
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",
|
|
51
57
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ y(l, {}),
|
|
59
|
+
/* @__PURE__ */ b("header", {
|
|
54
60
|
"data-tour": "notification-history-header",
|
|
55
61
|
className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
|
|
56
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("h1", {
|
|
57
63
|
className: "text-xl font-semibold text-text-primary sm:text-2xl",
|
|
58
|
-
children:
|
|
59
|
-
}), /* @__PURE__ */
|
|
64
|
+
children: N("notifications.v2.archivedTitle", "Archived")
|
|
65
|
+
}), /* @__PURE__ */ y("p", {
|
|
60
66
|
className: "mt-1 text-sm text-text-secondary",
|
|
61
|
-
children:
|
|
62
|
-
})] }), /* @__PURE__ */
|
|
67
|
+
children: N("notifications.v2.archivedSubtitle", "Notifications you archived. Restore one to put it back in your inbox.")
|
|
68
|
+
})] }), /* @__PURE__ */ b(S, { children: [/* @__PURE__ */ y(T, {
|
|
63
69
|
asChild: !0,
|
|
64
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ y(x, {
|
|
65
71
|
variant: "ghost",
|
|
66
72
|
size: "icon",
|
|
67
|
-
"aria-label":
|
|
73
|
+
"aria-label": N("notifications.v2.moreActions", "More actions"),
|
|
68
74
|
"data-testid": "notifications-archived-overflow",
|
|
69
|
-
children: /* @__PURE__ */ v
|
|
75
|
+
children: /* @__PURE__ */ y(v, {
|
|
70
76
|
size: 18,
|
|
71
77
|
"aria-hidden": "true"
|
|
72
78
|
})
|
|
73
79
|
})
|
|
74
|
-
}), /* @__PURE__ */
|
|
80
|
+
}), /* @__PURE__ */ y(C, {
|
|
75
81
|
align: "end",
|
|
76
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ b(w, {
|
|
77
83
|
"data-tour": "notification-history-export",
|
|
78
|
-
disabled:
|
|
79
|
-
onSelect: () => c(
|
|
80
|
-
children: [/* @__PURE__ */
|
|
84
|
+
disabled: R.length === 0,
|
|
85
|
+
onSelect: () => c(N, R),
|
|
86
|
+
children: [/* @__PURE__ */ y(_, {
|
|
81
87
|
size: 16,
|
|
82
88
|
"aria-hidden": "true"
|
|
83
|
-
}),
|
|
89
|
+
}), N("notifications.v2.downloadSpreadsheet", "Download as spreadsheet")]
|
|
84
90
|
})
|
|
85
91
|
})] })]
|
|
86
92
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
"aria-label":
|
|
93
|
+
/* @__PURE__ */ b("section", {
|
|
94
|
+
"aria-label": N("notifications.v2.filters", "Filters"),
|
|
89
95
|
className: "space-y-3",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ b("div", {
|
|
91
97
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
93
|
-
label:
|
|
94
|
-
value:
|
|
95
|
-
onChange: (e) =>
|
|
96
|
-
}), /* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ y(d, {
|
|
99
|
+
label: N("notifications.searchByTitleOrContent", "Search by title or content..."),
|
|
100
|
+
value: H.search,
|
|
101
|
+
onChange: (e) => U({ search: e })
|
|
102
|
+
}), /* @__PURE__ */ b("div", {
|
|
97
103
|
className: "flex flex-wrap items-center gap-2",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
99
|
-
chips:
|
|
100
|
-
value:
|
|
101
|
-
onChange:
|
|
104
|
+
children: [/* @__PURE__ */ y(f, {
|
|
105
|
+
chips: te,
|
|
106
|
+
value: q,
|
|
107
|
+
onChange: J,
|
|
102
108
|
testIdPrefix: "notifications-archived-view"
|
|
103
|
-
}), /* @__PURE__ */
|
|
104
|
-
open:
|
|
105
|
-
active:
|
|
109
|
+
}), /* @__PURE__ */ y(u, {
|
|
110
|
+
open: Y,
|
|
111
|
+
active: Q,
|
|
106
112
|
controls: "notifications-archived-more-filters",
|
|
107
|
-
onToggle: () =>
|
|
113
|
+
onToggle: () => X(!Y)
|
|
108
114
|
})]
|
|
109
115
|
})]
|
|
110
|
-
}), /* @__PURE__ */
|
|
116
|
+
}), /* @__PURE__ */ b("div", {
|
|
111
117
|
id: "notifications-archived-more-filters",
|
|
112
|
-
hidden: !
|
|
118
|
+
hidden: !Y,
|
|
113
119
|
className: "grid gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 sm:grid-cols-3",
|
|
114
120
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
"aria-label":
|
|
117
|
-
options:
|
|
118
|
-
value:
|
|
119
|
-
onValueChange: (e) =>
|
|
121
|
+
/* @__PURE__ */ y(O, {
|
|
122
|
+
"aria-label": N("notifications.v2.topicFilter", "Topic"),
|
|
123
|
+
options: ne,
|
|
124
|
+
value: H.topicId || j,
|
|
125
|
+
onValueChange: (e) => U({ topicId: e === j ? void 0 : e })
|
|
120
126
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ y(D, {
|
|
122
128
|
type: "date",
|
|
123
|
-
"aria-label":
|
|
124
|
-
value:
|
|
125
|
-
onChange: (e) =>
|
|
126
|
-
...
|
|
129
|
+
"aria-label": N("notifications.startDate", "Start date"),
|
|
130
|
+
value: M(H.dateRange.start),
|
|
131
|
+
onChange: (e) => U({ dateRange: {
|
|
132
|
+
...H.dateRange,
|
|
127
133
|
start: e.target.value ? new Date(e.target.value) : null
|
|
128
134
|
} })
|
|
129
135
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ y(D, {
|
|
131
137
|
type: "date",
|
|
132
|
-
"aria-label":
|
|
133
|
-
value:
|
|
134
|
-
onChange: (e) =>
|
|
135
|
-
...
|
|
138
|
+
"aria-label": N("notifications.endDate", "End date"),
|
|
139
|
+
value: M(H.dateRange.end),
|
|
140
|
+
onChange: (e) => U({ dateRange: {
|
|
141
|
+
...H.dateRange,
|
|
136
142
|
end: e.target.value ? new Date(e.target.value) : null
|
|
137
143
|
} })
|
|
138
144
|
})
|
|
139
145
|
]
|
|
140
146
|
})]
|
|
141
147
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ y("div", {
|
|
143
149
|
className: "space-y-2",
|
|
144
|
-
children:
|
|
150
|
+
children: Z.length > 0 ? Z.map((t) => /* @__PURE__ */ b("div", {
|
|
145
151
|
className: "space-y-2",
|
|
146
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ y(e, {
|
|
147
153
|
notification: t,
|
|
148
|
-
onArchive: t.archivedAt ? void 0 :
|
|
149
|
-
onAction:
|
|
154
|
+
onArchive: t.archivedAt ? void 0 : W,
|
|
155
|
+
onAction: K,
|
|
150
156
|
showArchivedState: !0,
|
|
151
157
|
analyticsSource: "history",
|
|
152
158
|
navigationV2: !0,
|
|
153
|
-
showTopic:
|
|
154
|
-
}), t.archivedAt && /* @__PURE__ */
|
|
159
|
+
showTopic: Y
|
|
160
|
+
}), t.archivedAt && /* @__PURE__ */ y("div", {
|
|
155
161
|
className: "flex justify-end",
|
|
156
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ y(x, {
|
|
157
163
|
type: "button",
|
|
158
164
|
variant: "outline",
|
|
159
165
|
size: "sm",
|
|
160
|
-
onClick: () =>
|
|
161
|
-
children:
|
|
166
|
+
onClick: () => G(t.id),
|
|
167
|
+
children: N("notifications.restore", "Restore")
|
|
162
168
|
})
|
|
163
169
|
})]
|
|
164
|
-
}, t.id)) : /* @__PURE__ */
|
|
165
|
-
illustration:
|
|
166
|
-
title:
|
|
167
|
-
description:
|
|
168
|
-
kind:
|
|
170
|
+
}, t.id)) : /* @__PURE__ */ y(E, {
|
|
171
|
+
illustration: $ ? "empty-search" : "empty-notifications",
|
|
172
|
+
title: $ ? N("notifications.noNotificationsFound", "No notifications found") : q === "archived" ? N("notifications.v2.archivedEmptyTitle", "Nothing archived") : N("notifications.historyEmptyTitle", "No history yet"),
|
|
173
|
+
description: $ ? N("notifications.adjustSearchOrDateRange", "Try adjusting your filters") : q === "archived" ? N("notifications.v2.archivedEmptyDescription", "Archive a notification from your inbox and it moves here.") : N("notifications.historyEmptyDescription", "Notifications you receive will be archived here so you can always find them again."),
|
|
174
|
+
kind: H.search ? "no-results" : $ ? "filtered" : "first-use"
|
|
169
175
|
})
|
|
170
176
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
hasMore:
|
|
173
|
-
isLoadingMore:
|
|
174
|
-
onLoadMore:
|
|
175
|
-
shownCount:
|
|
177
|
+
/* @__PURE__ */ y(t, {
|
|
178
|
+
hasMore: z,
|
|
179
|
+
isLoadingMore: B,
|
|
180
|
+
onLoadMore: V,
|
|
181
|
+
shownCount: Z.length
|
|
176
182
|
})
|
|
177
183
|
]
|
|
178
184
|
});
|
|
179
185
|
}
|
|
180
|
-
export {
|
|
186
|
+
export { N as NotificationArchivedV2 };
|
|
181
187
|
|
|
182
188
|
//# sourceMappingURL=NotificationArchivedV2.js.map
|
|
@@ -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 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,EAA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ACEoB,IACIpB,EAAG,yCAAyC,4BAA4B,IACxEO,MAAS,aACPP,EACE,6CACA,2DACF,IACAA,EACE,yCACA,oFACF;KAER,MACEmB,EAAmB,SAAS,eAAeC,IAAmB,aAAa;IAE9E,CAAA;GAEA,CAAA;GAEL,kBAAC4B,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","SectionLoaderOr","CompactMarkOr","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';\nimport { CompactMarkOr, SectionLoaderOr } from '../components/loadingSystem';\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 <SectionLoaderOr\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\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":";;;;;;;;;;;;;;;;;;AA0BA,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,MAAuBC,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,GA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