@apptegy/nuxt-navigation 0.1.97 → 0.1.99
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/module.json +1 -1
- package/dist/runtime/components/Nav/Header.vue +262 -2
- package/dist/runtime/components/Nav/Header.vue.d.ts +18 -3
- package/dist/runtime/components/Nav/NotificationItem.vue +353 -0
- package/dist/runtime/components/Nav/NotificationItem.vue.d.ts +12 -0
- package/dist/runtime/components/Nav/NotificationsPanel.vue +517 -0
- package/dist/runtime/components/Nav/NotificationsPanel.vue.d.ts +49 -0
- package/dist/runtime/components/Nav/Sidebar.vue.d.ts +1 -1
- package/dist/runtime/composables/useSidebar.d.ts +1 -1
- package/dist/runtime/constants/notification-types.d.ts +19 -0
- package/dist/runtime/constants/notification-types.js +48 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/notifications.d.ts +79 -0
- package/dist/runtime/types/notifications.js +0 -0
- package/dist/runtime/utils/notification-api.d.ts +26 -0
- package/dist/runtime/utils/notification-api.js +83 -0
- package/dist/runtime/utils/notification-dates.d.ts +15 -0
- package/dist/runtime/utils/notification-dates.js +81 -0
- package/dist/runtime/utils/notifications.d.ts +21 -0
- package/dist/runtime/utils/notifications.js +117 -0
- package/locale/en.json +22 -1
- package/package.json +15 -16
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="notifications-panel"
|
|
4
|
+
:class="{ 'notifications-panel--fullscreen': isMobilePanel }"
|
|
5
|
+
role="dialog"
|
|
6
|
+
:aria-label="$t('navigation.notifications')"
|
|
7
|
+
>
|
|
8
|
+
<div class="notifications-panel__header">
|
|
9
|
+
<div class="notifications-panel__title-row">
|
|
10
|
+
<h2 class="notifications-panel__title">
|
|
11
|
+
{{ $t("navigation.notifications") }}
|
|
12
|
+
</h2>
|
|
13
|
+
<span
|
|
14
|
+
v-if="data.retentionLabel && !isMobilePanel"
|
|
15
|
+
class="notifications-panel__retention"
|
|
16
|
+
>
|
|
17
|
+
{{ data.retentionLabel }}
|
|
18
|
+
</span>
|
|
19
|
+
<button
|
|
20
|
+
v-if="isMobilePanel"
|
|
21
|
+
type="button"
|
|
22
|
+
class="notifications-panel__close"
|
|
23
|
+
:aria-label="$t('navigation.notificationsPanel.close')"
|
|
24
|
+
@click="$emit('close')"
|
|
25
|
+
>
|
|
26
|
+
<svg
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
width="20"
|
|
29
|
+
height="20"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
>
|
|
38
|
+
<path d="M18 6 6 18" />
|
|
39
|
+
<path d="m6 6 12 12" />
|
|
40
|
+
</svg>
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div
|
|
45
|
+
class="notifications-panel__tabs"
|
|
46
|
+
role="tablist"
|
|
47
|
+
:aria-label="$t('navigation.notificationsPanel.tabsLabel')"
|
|
48
|
+
>
|
|
49
|
+
<button
|
|
50
|
+
v-for="tab in data.tabs"
|
|
51
|
+
:key="tab.id"
|
|
52
|
+
type="button"
|
|
53
|
+
role="tab"
|
|
54
|
+
class="notifications-panel__tab"
|
|
55
|
+
:class="{ 'notifications-panel__tab--active': tab.id === activeTabId }"
|
|
56
|
+
:aria-selected="tab.id === activeTabId"
|
|
57
|
+
@click="selectTab(tab.id)"
|
|
58
|
+
>
|
|
59
|
+
<span>{{ tab.label }}</span>
|
|
60
|
+
<span
|
|
61
|
+
v-if="getTabBadgeCount(tab) > 0"
|
|
62
|
+
class="notifications-panel__tab-badge"
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
>
|
|
65
|
+
{{ formatCount(getTabBadgeCount(tab)) }}
|
|
66
|
+
</span>
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div
|
|
72
|
+
v-if="showFilterChips"
|
|
73
|
+
class="notifications-panel__filters"
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
ref="filtersRef"
|
|
77
|
+
class="notifications-panel__filters-scroll"
|
|
78
|
+
>
|
|
79
|
+
<button
|
|
80
|
+
v-for="filter in visibleFilters"
|
|
81
|
+
:key="filter.id"
|
|
82
|
+
type="button"
|
|
83
|
+
class="notifications-panel__filter"
|
|
84
|
+
:class="{ 'notifications-panel__filter--active': filter.id === activeFilterId }"
|
|
85
|
+
@click="selectFilter(filter.id)"
|
|
86
|
+
>
|
|
87
|
+
<span>{{ filter.label }}</span>
|
|
88
|
+
<span v-if="getFilterBadgeCount(filter) > 0">{{ formatCount(getFilterBadgeCount(filter)) }}</span>
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
class="notifications-panel__filters-next"
|
|
94
|
+
:aria-label="$t('navigation.notificationsPanel.scrollFilters')"
|
|
95
|
+
@click="scrollFilters"
|
|
96
|
+
>
|
|
97
|
+
<svg
|
|
98
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
99
|
+
width="16"
|
|
100
|
+
height="16"
|
|
101
|
+
viewBox="0 0 24 24"
|
|
102
|
+
fill="none"
|
|
103
|
+
stroke="currentColor"
|
|
104
|
+
stroke-width="2"
|
|
105
|
+
stroke-linecap="round"
|
|
106
|
+
stroke-linejoin="round"
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
>
|
|
109
|
+
<path d="m9 18 6-6-6-6" />
|
|
110
|
+
</svg>
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div class="notifications-panel__body">
|
|
115
|
+
<div v-if="loading" class="notifications-panel__loading">
|
|
116
|
+
{{ $t("navigation.notificationsPanel.loading") }}
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<template v-else>
|
|
120
|
+
<section
|
|
121
|
+
v-for="(group, groupIndex) in filteredGroups"
|
|
122
|
+
:key="group.id"
|
|
123
|
+
class="notifications-panel__group"
|
|
124
|
+
>
|
|
125
|
+
<div class="notifications-panel__group-header">
|
|
126
|
+
<h3 class="notifications-panel__group-label">
|
|
127
|
+
{{ group.label }}
|
|
128
|
+
</h3>
|
|
129
|
+
<button
|
|
130
|
+
v-if="showClearAll(groupIndex)"
|
|
131
|
+
type="button"
|
|
132
|
+
class="notifications-panel__clear-all"
|
|
133
|
+
@click="$emit('clear-all', { groupId: group.id, tabId: activeTabId, filterId: activeFilterId })"
|
|
134
|
+
>
|
|
135
|
+
{{ $t("navigation.notificationsPanel.clearAll") }}
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="notifications-panel__list">
|
|
140
|
+
<NavNotificationItem
|
|
141
|
+
v-for="notification in group.notifications"
|
|
142
|
+
:key="notification.id"
|
|
143
|
+
:item="notification"
|
|
144
|
+
@dismiss="(id) => $emit('dismiss', { id, tabId: activeTabId, filterId: activeFilterId })"
|
|
145
|
+
@select="(item) => $emit('select', { item, tabId: activeTabId, filterId: activeFilterId })"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
</section>
|
|
149
|
+
|
|
150
|
+
<p
|
|
151
|
+
v-if="isEmpty"
|
|
152
|
+
class="notifications-panel__empty"
|
|
153
|
+
>
|
|
154
|
+
{{ $t("navigation.notificationsPanel.empty") }}
|
|
155
|
+
</p>
|
|
156
|
+
</template>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<script setup>
|
|
162
|
+
import { computed, ref, watch } from "vue";
|
|
163
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
164
|
+
import {
|
|
165
|
+
flattenNotifications,
|
|
166
|
+
formatNotificationCount,
|
|
167
|
+
getFilterBadgeCount as resolveFilterBadgeCount,
|
|
168
|
+
getTabBadgeCount as resolveTabBadgeCount,
|
|
169
|
+
getVisibleFilters,
|
|
170
|
+
isInBadge,
|
|
171
|
+
notificationMatchesFilter,
|
|
172
|
+
resolveNotificationFilters,
|
|
173
|
+
shouldShowFilterChips
|
|
174
|
+
} from "../../utils/notifications";
|
|
175
|
+
const props = defineProps({
|
|
176
|
+
data: { type: Object, required: true },
|
|
177
|
+
loading: { type: Boolean, required: false, default: false },
|
|
178
|
+
activeTabId: { type: String, required: false },
|
|
179
|
+
activeFilterId: { type: String, required: false }
|
|
180
|
+
});
|
|
181
|
+
const emit = defineEmits(["update:activeTabId", "update:activeFilterId", "clear-all", "dismiss", "select", "close"]);
|
|
182
|
+
const isMobilePanel = useMediaQuery("(max-width: 960px)");
|
|
183
|
+
const filtersRef = ref();
|
|
184
|
+
const activeTabId = ref(props.activeTabId || props.data.tabs[0]?.id || "");
|
|
185
|
+
const activeFilterId = ref(props.activeFilterId || props.data.filters?.[0]?.id || "all-types");
|
|
186
|
+
watch(
|
|
187
|
+
() => props.activeTabId,
|
|
188
|
+
(value) => {
|
|
189
|
+
if (value) {
|
|
190
|
+
activeTabId.value = value;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
watch(
|
|
195
|
+
() => props.activeFilterId,
|
|
196
|
+
(value) => {
|
|
197
|
+
if (value) {
|
|
198
|
+
activeFilterId.value = value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
watch(
|
|
203
|
+
() => props.data.tabs,
|
|
204
|
+
(tabs) => {
|
|
205
|
+
if (!tabs.some((tab) => tab.id === activeTabId.value)) {
|
|
206
|
+
activeTabId.value = tabs[0]?.id || "";
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{ deep: true }
|
|
210
|
+
);
|
|
211
|
+
const allNotifications = computed(() => flattenNotifications(props.data.groups));
|
|
212
|
+
const usesDynamicFilters = computed(() => !props.data.filters?.length);
|
|
213
|
+
const activeTab = computed(
|
|
214
|
+
() => props.data.tabs.find((tab) => tab.id === activeTabId.value)
|
|
215
|
+
);
|
|
216
|
+
const resolvedFilters = computed(
|
|
217
|
+
() => resolveNotificationFilters(allNotifications.value, activeTab.value, props.data.filters)
|
|
218
|
+
);
|
|
219
|
+
const visibleFilters = computed(() => {
|
|
220
|
+
if (usesDynamicFilters.value) {
|
|
221
|
+
return resolvedFilters.value;
|
|
222
|
+
}
|
|
223
|
+
return getVisibleFilters(allNotifications.value, resolvedFilters.value, activeTab.value);
|
|
224
|
+
});
|
|
225
|
+
const showFilterChips = computed(
|
|
226
|
+
() => shouldShowFilterChips(
|
|
227
|
+
allNotifications.value,
|
|
228
|
+
resolvedFilters.value,
|
|
229
|
+
activeTab.value,
|
|
230
|
+
usesDynamicFilters.value
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
watch(
|
|
234
|
+
visibleFilters,
|
|
235
|
+
(filters) => {
|
|
236
|
+
if (filters.length && !filters.some((filter) => filter.id === activeFilterId.value)) {
|
|
237
|
+
activeFilterId.value = filters[0]?.id || "all-types";
|
|
238
|
+
}
|
|
239
|
+
if (!filters.length && activeFilterId.value !== "all-types") {
|
|
240
|
+
activeFilterId.value = "all-types";
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{ deep: true }
|
|
244
|
+
);
|
|
245
|
+
function getTabBadgeCount(tab) {
|
|
246
|
+
return resolveTabBadgeCount(allNotifications.value, tab);
|
|
247
|
+
}
|
|
248
|
+
function getFilterBadgeCount(filter) {
|
|
249
|
+
return resolveFilterBadgeCount(allNotifications.value, filter);
|
|
250
|
+
}
|
|
251
|
+
function formatCount(count) {
|
|
252
|
+
return formatNotificationCount(count);
|
|
253
|
+
}
|
|
254
|
+
const activeFilter = computed(
|
|
255
|
+
() => visibleFilters.value.find((filter) => filter.id === activeFilterId.value) || resolvedFilters.value.find((filter) => filter.id === activeFilterId.value)
|
|
256
|
+
);
|
|
257
|
+
function showClearAll(groupIndex) {
|
|
258
|
+
return groupIndex === 0 && (activeTabId.value === "new" || activeTab.value?.unreadOnly);
|
|
259
|
+
}
|
|
260
|
+
function matchesTab(notification) {
|
|
261
|
+
const tab = activeTab.value;
|
|
262
|
+
if (!tab) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
if (tab.unreadOnly || tab.id === "new") {
|
|
266
|
+
return isInBadge(notification);
|
|
267
|
+
}
|
|
268
|
+
return notification.dismissed !== true;
|
|
269
|
+
}
|
|
270
|
+
function matchesFilter(notification) {
|
|
271
|
+
if (activeTabId.value === "all") {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
const filter = activeFilter.value;
|
|
275
|
+
if (!filter) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return notificationMatchesFilter(notification, filter);
|
|
279
|
+
}
|
|
280
|
+
const filteredGroups = computed(
|
|
281
|
+
() => props.data.groups.map((group) => ({
|
|
282
|
+
...group,
|
|
283
|
+
notifications: group.notifications.filter(
|
|
284
|
+
(notification) => matchesTab(notification) && matchesFilter(notification)
|
|
285
|
+
)
|
|
286
|
+
})).filter((group) => group.notifications.length > 0)
|
|
287
|
+
);
|
|
288
|
+
const isEmpty = computed(
|
|
289
|
+
() => !props.loading && filteredGroups.value.length === 0
|
|
290
|
+
);
|
|
291
|
+
function selectTab(id) {
|
|
292
|
+
activeTabId.value = id;
|
|
293
|
+
emit("update:activeTabId", id);
|
|
294
|
+
if (id === "all") {
|
|
295
|
+
activeFilterId.value = "all-types";
|
|
296
|
+
emit("update:activeFilterId", "all-types");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function selectFilter(id) {
|
|
300
|
+
activeFilterId.value = id;
|
|
301
|
+
emit("update:activeFilterId", id);
|
|
302
|
+
}
|
|
303
|
+
function scrollFilters() {
|
|
304
|
+
filtersRef.value?.scrollBy({ left: 160, behavior: "smooth" });
|
|
305
|
+
}
|
|
306
|
+
</script>
|
|
307
|
+
|
|
308
|
+
<style scoped>
|
|
309
|
+
.notifications-panel {
|
|
310
|
+
position: absolute;
|
|
311
|
+
top: calc(100% + 8px);
|
|
312
|
+
right: 0;
|
|
313
|
+
z-index: 100;
|
|
314
|
+
display: flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
width: min(480px, 100vw - 32px);
|
|
317
|
+
max-height: calc(100vh - 80px);
|
|
318
|
+
border: 1px solid var(--grey-20, #e5e7eb);
|
|
319
|
+
border-radius: 12px;
|
|
320
|
+
background: var(--primary-white, #fff);
|
|
321
|
+
box-shadow: 0 20px 48px rgba(0, 0, 0, 0.16);
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
}
|
|
324
|
+
.notifications-panel__header {
|
|
325
|
+
padding: 16px 16px 0;
|
|
326
|
+
}
|
|
327
|
+
.notifications-panel__title-row {
|
|
328
|
+
display: flex;
|
|
329
|
+
align-items: center;
|
|
330
|
+
justify-content: space-between;
|
|
331
|
+
gap: 12px;
|
|
332
|
+
margin-bottom: 12px;
|
|
333
|
+
}
|
|
334
|
+
.notifications-panel__title {
|
|
335
|
+
margin: 0;
|
|
336
|
+
font-size: 18px;
|
|
337
|
+
font-weight: 600;
|
|
338
|
+
line-height: 24px;
|
|
339
|
+
color: var(--grey-90, #111827);
|
|
340
|
+
}
|
|
341
|
+
.notifications-panel__retention {
|
|
342
|
+
font-size: 12px;
|
|
343
|
+
line-height: 16px;
|
|
344
|
+
color: var(--grey-60, #6b7280);
|
|
345
|
+
white-space: nowrap;
|
|
346
|
+
}
|
|
347
|
+
.notifications-panel__tabs {
|
|
348
|
+
display: flex;
|
|
349
|
+
gap: 20px;
|
|
350
|
+
border-bottom: 1px solid var(--grey-20, #e5e7eb);
|
|
351
|
+
}
|
|
352
|
+
.notifications-panel__tab {
|
|
353
|
+
display: inline-flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
gap: 8px;
|
|
356
|
+
margin-bottom: -1px;
|
|
357
|
+
padding: 0 0 12px;
|
|
358
|
+
border: none;
|
|
359
|
+
border-bottom: 2px solid transparent;
|
|
360
|
+
background: transparent;
|
|
361
|
+
color: var(--grey-60, #6b7280);
|
|
362
|
+
font-size: 13px;
|
|
363
|
+
font-weight: 700;
|
|
364
|
+
line-height: 20px;
|
|
365
|
+
cursor: pointer;
|
|
366
|
+
}
|
|
367
|
+
.notifications-panel__tab--active {
|
|
368
|
+
border-bottom-color: #662e80;
|
|
369
|
+
color: #662e80;
|
|
370
|
+
}
|
|
371
|
+
.notifications-panel__tab-badge {
|
|
372
|
+
min-width: 16px;
|
|
373
|
+
height: 16px;
|
|
374
|
+
padding: 0 4px;
|
|
375
|
+
border: 2px solid var(--primary-white, #fff);
|
|
376
|
+
border-radius: 8px;
|
|
377
|
+
background: #c84b31;
|
|
378
|
+
color: var(--primary-white, #fff);
|
|
379
|
+
font-size: 10px;
|
|
380
|
+
font-weight: 800;
|
|
381
|
+
line-height: 12px;
|
|
382
|
+
text-align: center;
|
|
383
|
+
box-sizing: border-box;
|
|
384
|
+
}
|
|
385
|
+
.notifications-panel__filters {
|
|
386
|
+
display: flex;
|
|
387
|
+
align-items: center;
|
|
388
|
+
gap: 8px;
|
|
389
|
+
padding: 12px 16px;
|
|
390
|
+
border-bottom: 1px solid var(--grey-20, #e5e7eb);
|
|
391
|
+
}
|
|
392
|
+
.notifications-panel__filters-scroll {
|
|
393
|
+
display: flex;
|
|
394
|
+
gap: 8px;
|
|
395
|
+
overflow-x: auto;
|
|
396
|
+
scrollbar-width: none;
|
|
397
|
+
}
|
|
398
|
+
.notifications-panel__filters-scroll::-webkit-scrollbar {
|
|
399
|
+
display: none;
|
|
400
|
+
}
|
|
401
|
+
.notifications-panel__filter {
|
|
402
|
+
display: inline-flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
gap: 6px;
|
|
405
|
+
padding: 6px 12px;
|
|
406
|
+
border: 1px solid var(--grey-20, #e5e7eb);
|
|
407
|
+
border-radius: 999px;
|
|
408
|
+
background: var(--primary-white, #fff);
|
|
409
|
+
color: var(--grey-80, #374151);
|
|
410
|
+
font-size: 11.5px;
|
|
411
|
+
line-height: 16px;
|
|
412
|
+
white-space: nowrap;
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
}
|
|
415
|
+
.notifications-panel__filter--active {
|
|
416
|
+
border-color: #662e80;
|
|
417
|
+
background: #f5f2fb;
|
|
418
|
+
color: #662e80;
|
|
419
|
+
}
|
|
420
|
+
.notifications-panel__filters-next {
|
|
421
|
+
display: flex;
|
|
422
|
+
align-items: center;
|
|
423
|
+
justify-content: center;
|
|
424
|
+
width: 28px;
|
|
425
|
+
height: 28px;
|
|
426
|
+
padding: 0;
|
|
427
|
+
border: 1px solid var(--grey-20, #e5e7eb);
|
|
428
|
+
border-radius: 999px;
|
|
429
|
+
background: var(--primary-white, #fff);
|
|
430
|
+
color: var(--grey-70, #4b5563);
|
|
431
|
+
flex-shrink: 0;
|
|
432
|
+
cursor: pointer;
|
|
433
|
+
}
|
|
434
|
+
.notifications-panel__body {
|
|
435
|
+
overflow-y: auto;
|
|
436
|
+
padding: 16px;
|
|
437
|
+
}
|
|
438
|
+
.notifications-panel__loading, .notifications-panel__empty {
|
|
439
|
+
margin: 0;
|
|
440
|
+
padding: 24px 0;
|
|
441
|
+
text-align: center;
|
|
442
|
+
font-size: 14px;
|
|
443
|
+
line-height: 20px;
|
|
444
|
+
color: var(--grey-60, #6b7280);
|
|
445
|
+
}
|
|
446
|
+
.notifications-panel__group + .notifications-panel__group {
|
|
447
|
+
margin-top: 20px;
|
|
448
|
+
}
|
|
449
|
+
.notifications-panel__group-header {
|
|
450
|
+
display: flex;
|
|
451
|
+
align-items: center;
|
|
452
|
+
justify-content: space-between;
|
|
453
|
+
gap: 12px;
|
|
454
|
+
margin-bottom: 12px;
|
|
455
|
+
}
|
|
456
|
+
.notifications-panel__group-label {
|
|
457
|
+
margin: 0;
|
|
458
|
+
font-size: 10.5px;
|
|
459
|
+
font-weight: 800;
|
|
460
|
+
line-height: 16px;
|
|
461
|
+
letter-spacing: 0.04em;
|
|
462
|
+
text-transform: uppercase;
|
|
463
|
+
color: var(--grey-40, #adadad);
|
|
464
|
+
}
|
|
465
|
+
.notifications-panel__clear-all {
|
|
466
|
+
padding: 0;
|
|
467
|
+
border: none;
|
|
468
|
+
background: transparent;
|
|
469
|
+
color: #662e80;
|
|
470
|
+
font-size: 12px;
|
|
471
|
+
font-weight: 600;
|
|
472
|
+
line-height: 18px;
|
|
473
|
+
cursor: pointer;
|
|
474
|
+
}
|
|
475
|
+
.notifications-panel__list {
|
|
476
|
+
display: flex;
|
|
477
|
+
flex-direction: column;
|
|
478
|
+
gap: 8px;
|
|
479
|
+
}
|
|
480
|
+
.notifications-panel__close {
|
|
481
|
+
display: flex;
|
|
482
|
+
align-items: center;
|
|
483
|
+
justify-content: center;
|
|
484
|
+
width: 32px;
|
|
485
|
+
height: 32px;
|
|
486
|
+
margin-left: auto;
|
|
487
|
+
padding: 0;
|
|
488
|
+
border: none;
|
|
489
|
+
border-radius: 8px;
|
|
490
|
+
background: transparent;
|
|
491
|
+
color: var(--grey-70, #4b5563);
|
|
492
|
+
cursor: pointer;
|
|
493
|
+
}
|
|
494
|
+
.notifications-panel__close:hover {
|
|
495
|
+
background: var(--grey-10, #f3f4f6);
|
|
496
|
+
}
|
|
497
|
+
.notifications-panel--fullscreen {
|
|
498
|
+
position: fixed;
|
|
499
|
+
inset: 0;
|
|
500
|
+
top: 0;
|
|
501
|
+
right: 0;
|
|
502
|
+
bottom: 0;
|
|
503
|
+
left: 0;
|
|
504
|
+
z-index: 10000;
|
|
505
|
+
width: 100%;
|
|
506
|
+
max-width: none;
|
|
507
|
+
height: 100dvh;
|
|
508
|
+
max-height: none;
|
|
509
|
+
border: none;
|
|
510
|
+
border-radius: 0;
|
|
511
|
+
box-shadow: none;
|
|
512
|
+
}
|
|
513
|
+
.notifications-panel--fullscreen .notifications-panel__body {
|
|
514
|
+
flex: 1;
|
|
515
|
+
min-height: 0;
|
|
516
|
+
}
|
|
517
|
+
</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { INotificationsPanelData } from '../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
data: INotificationsPanelData;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
activeTabId?: string;
|
|
6
|
+
activeFilterId?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:activeTabId": (id: string) => any;
|
|
10
|
+
"update:activeFilterId": (id: string) => any;
|
|
11
|
+
"clear-all": (payload: {
|
|
12
|
+
groupId: string;
|
|
13
|
+
tabId: string;
|
|
14
|
+
filterId: string;
|
|
15
|
+
}) => any;
|
|
16
|
+
dismiss: (payload: {
|
|
17
|
+
id: string;
|
|
18
|
+
tabId: string;
|
|
19
|
+
filterId: string;
|
|
20
|
+
}) => any;
|
|
21
|
+
select: (payload: {
|
|
22
|
+
item: INotificationsPanelData["groups"][number]["notifications"][number];
|
|
23
|
+
tabId: string;
|
|
24
|
+
filterId: string;
|
|
25
|
+
}) => any;
|
|
26
|
+
close: () => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
"onUpdate:activeTabId"?: ((id: string) => any) | undefined;
|
|
29
|
+
"onUpdate:activeFilterId"?: ((id: string) => any) | undefined;
|
|
30
|
+
"onClear-all"?: ((payload: {
|
|
31
|
+
groupId: string;
|
|
32
|
+
tabId: string;
|
|
33
|
+
filterId: string;
|
|
34
|
+
}) => any) | undefined;
|
|
35
|
+
onDismiss?: ((payload: {
|
|
36
|
+
id: string;
|
|
37
|
+
tabId: string;
|
|
38
|
+
filterId: string;
|
|
39
|
+
}) => any) | undefined;
|
|
40
|
+
onSelect?: ((payload: {
|
|
41
|
+
item: INotificationsPanelData["groups"][number]["notifications"][number];
|
|
42
|
+
tabId: string;
|
|
43
|
+
filterId: string;
|
|
44
|
+
}) => any) | undefined;
|
|
45
|
+
onClose?: (() => any) | undefined;
|
|
46
|
+
}>, {
|
|
47
|
+
loading: boolean;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
|
+
export default _default;
|
|
@@ -37,11 +37,11 @@ declare const __VLS_component: import("vue").DefineComponent<ISidebarProps, void
|
|
|
37
37
|
"onToggle-expand"?: ((width: number) => any) | undefined;
|
|
38
38
|
}>, {
|
|
39
39
|
impersonatedUser: IUser;
|
|
40
|
+
fixed: boolean;
|
|
40
41
|
helpArticleOptions: Array<unknown>;
|
|
41
42
|
settingsRoute: string;
|
|
42
43
|
schoolWebsite: string;
|
|
43
44
|
showHelpArticles: boolean;
|
|
44
|
-
fixed: boolean;
|
|
45
45
|
clientId: number;
|
|
46
46
|
applications: Array<IApplication>;
|
|
47
47
|
currentApplication: IApplication["text"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NotificationType } from '../types/index.js';
|
|
2
|
+
/** Type accent colors from NC v2 Visual Spec (section 3). */
|
|
3
|
+
export declare const NOTIFICATION_TYPE_ACCENTS: Record<NotificationType, string>;
|
|
4
|
+
export declare const NOTIFICATION_BADGE_COLOR = "#C84B31";
|
|
5
|
+
/** Category definitions used to derive filter pills from notification data. */
|
|
6
|
+
export declare const NOTIFICATION_FILTER_CATEGORIES: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
types: NotificationType[];
|
|
10
|
+
}>;
|
|
11
|
+
/** @deprecated Use NOTIFICATION_FILTER_CATEGORIES */
|
|
12
|
+
export declare const DEFAULT_NOTIFICATION_FILTERS: ({
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
types: NotificationType[];
|
|
16
|
+
} | {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
})[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const NOTIFICATION_TYPE_ACCENTS = {
|
|
2
|
+
announcement: "#D67A11",
|
|
3
|
+
message: "#1372B3",
|
|
4
|
+
comment: "#139A4F",
|
|
5
|
+
mention: "#5A2496",
|
|
6
|
+
reply: "#1372B3",
|
|
7
|
+
reaction: "#62626E",
|
|
8
|
+
"school-post": "#1E3FBA",
|
|
9
|
+
system: "#62626E",
|
|
10
|
+
unknown: "#62626E"
|
|
11
|
+
};
|
|
12
|
+
export const NOTIFICATION_BADGE_COLOR = "#C84B31";
|
|
13
|
+
export const NOTIFICATION_FILTER_CATEGORIES = [
|
|
14
|
+
{
|
|
15
|
+
id: "announcements",
|
|
16
|
+
label: "Announcements",
|
|
17
|
+
types: ["announcement"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "messages",
|
|
21
|
+
label: "Messages",
|
|
22
|
+
types: ["message"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "comments-mentions",
|
|
26
|
+
label: "Comments & Mentions",
|
|
27
|
+
types: ["comment", "mention", "reply", "reaction"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "school-posts",
|
|
31
|
+
label: "School Posts",
|
|
32
|
+
types: ["school-post"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "system",
|
|
36
|
+
label: "System",
|
|
37
|
+
types: ["system"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "other",
|
|
41
|
+
label: "Other",
|
|
42
|
+
types: ["unknown"]
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
export const DEFAULT_NOTIFICATION_FILTERS = [
|
|
46
|
+
{ id: "all-types", label: "All types" },
|
|
47
|
+
...NOTIFICATION_FILTER_CATEGORIES
|
|
48
|
+
];
|
|
@@ -11,3 +11,4 @@ export interface IUser {
|
|
|
11
11
|
client: string;
|
|
12
12
|
admin_email: string;
|
|
13
13
|
}
|
|
14
|
+
export type { NotificationType, NotificationApiState, INotificationApiActor, INotificationApiRecord, INotificationsPagination, INotificationsApiResponse, INotificationActor, INotificationItem, INotificationGroup, INotificationTab, INotificationFilter, INotificationsPanelData, } from './notifications.js';
|