@rapidmx/web-client 0.4.0 → 0.5.0
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/apps/admin/audit-log/index.tsx +35 -8
- package/apps/admin/data-requests/index.tsx +480 -485
- package/apps/admin/distribution-lists/[uid].tsx +19 -1
- package/apps/admin/escrow-scopes/[uid].tsx +348 -237
- package/apps/admin/escrow-scopes/new/index.tsx +8 -2
- package/apps/admin/index.tsx +19 -1
- package/apps/admin/ingest-queue/index.tsx +44 -5
- package/apps/admin/mailboxes/[uid].tsx +211 -184
- package/apps/admin/quarantine/index.tsx +46 -14
- package/apps/admin/transport-rules/[uid].tsx +30 -1
- package/apps/admin/transport-rules/_transportRuleConfig.tsx +38 -2
- package/apps/admin/transport-rules/index.tsx +24 -6
- package/apps/admin/transport-rules/new/index.tsx +30 -1
- package/apps/escrow/_layout.tsx +2 -3
- package/apps/escrow/audit-log/index.tsx +196 -168
- package/apps/escrow/matters/[uid].tsx +621 -521
- package/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.tsx +22 -1
- package/apps/shared/components/admin/layout/AdminShell.tsx +3 -1
- package/apps/shared/components/admin/mailboxes/EscrowScopeCard.tsx +152 -0
- package/apps/shared/components/admin/mailboxes/ResourceSettingsCard.tsx +3 -3
- package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +55 -11
- package/apps/shared/components/admin/settings/BrandingForm.tsx +15 -4
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +18 -7
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +10 -2
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +6 -0
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +45 -12
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1235 -595
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +174 -98
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +49 -13
- package/apps/shared/components/admin/setup/SetupWizard.tsx +150 -34
- package/apps/shared/components/admin/signOut.ts +79 -0
- package/apps/shared/components/admin/usePagedList.tsx +129 -0
- package/apps/shared/components/calendar/EventModal.tsx +717 -549
- package/apps/shared/components/calendar/MonthView.tsx +173 -139
- package/apps/shared/components/calendar/RecurrenceEditor.tsx +222 -180
- package/apps/shared/components/calendar/SplitDayView.tsx +143 -137
- package/apps/shared/components/calendar/TimeGridView.tsx +244 -198
- package/apps/shared/components/calendar/allDay.ts +124 -0
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +1 -1
- package/apps/shared/components/contacts/ContactDetailPane.tsx +100 -21
- package/apps/shared/components/contacts/ContactForm.tsx +377 -348
- package/apps/shared/components/contacts/ContactsSidebar.tsx +6 -2
- package/apps/shared/components/contacts/KeyChangeReview.tsx +192 -0
- package/apps/shared/components/contacts/contactKeys.ts +78 -0
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +148 -134
- package/apps/shared/components/layout/AppShell.tsx +87 -15
- package/apps/shared/components/layout/BrandingChrome.tsx +48 -10
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +389 -298
- package/apps/shared/components/layout/MailboxProvisioning.tsx +19 -3
- package/apps/shared/components/layout/RecoveryCodeUnlock.tsx +350 -0
- package/apps/shared/components/layout/UnlockPromptProvider.tsx +257 -128
- package/apps/shared/components/mail/ConversationThreadPane.tsx +216 -181
- package/apps/shared/components/mail/MessageDetailPane.tsx +1318 -630
- package/apps/shared/components/mail/compose/ComposeContext.tsx +20 -15
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +854 -132
- package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +12 -2
- package/apps/shared/components/mail/pinnedSigners.ts +124 -0
- package/apps/shared/components/mail/verificationSeals.ts +125 -0
- package/apps/shared/components/mail/writableMailboxes.ts +101 -0
- package/apps/shared/components/rules/RuleBuilder.tsx +311 -276
- package/apps/shared/mail/listAllPages.ts +39 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +64 -55
- package/apps/shared/search/localIndexBuilder.ts +481 -179
- package/apps/shared/search/localIndexRpcClient.ts +228 -28
- package/apps/shared/search/localIndexSchema.ts +15 -6
- package/apps/shared/search/localIndexStorage.ts +98 -0
- package/apps/shared/search/localIndexVFS.ts +32 -1
- package/apps/shared/search/localIndexWorker.ts +648 -186
- package/apps/www/calendar/index.tsx +438 -417
- package/apps/www/contacts/[uid].tsx +21 -2
- package/apps/www/contacts/index.tsx +116 -12
- package/apps/www/index.tsx +1314 -1041
- package/apps/www/messages/[uid].tsx +18 -6
- package/apps/www/settings/auto-reply/index.tsx +134 -129
- package/apps/www/settings/booking-types/[uid].tsx +306 -300
- package/apps/www/settings/encryption/index.tsx +739 -216
- package/apps/www/settings/filters/[uid].tsx +171 -155
- package/apps/www/settings/filters/new/index.tsx +8 -1
- package/apps/www/settings/focused-inbox/index.tsx +150 -148
- package/apps/www/settings/privacy/index.tsx +494 -436
- package/apps/www/settings/read-receipts/index.tsx +148 -125
- package/apps/www/settings/sharing/index.tsx +17 -14
- package/apps/www/tasks/index.tsx +638 -579
- package/dist/apps/admin/audit-log/index.js +38 -8
- package/dist/apps/admin/data-requests/index.js +52 -72
- package/dist/apps/admin/distribution-lists/[uid].js +1 -1
- package/dist/apps/admin/escrow-scopes/[uid].js +91 -12
- package/dist/apps/admin/escrow-scopes/new/index.js +8 -3
- package/dist/apps/admin/index.js +4 -1
- package/dist/apps/admin/ingest-queue/index.js +24 -6
- package/dist/apps/admin/mailboxes/[uid].js +20 -4
- package/dist/apps/admin/quarantine/index.js +20 -11
- package/dist/apps/admin/transport-rules/[uid].js +18 -2
- package/dist/apps/admin/transport-rules/_transportRuleConfig.js +19 -0
- package/dist/apps/admin/transport-rules/index.js +22 -6
- package/dist/apps/admin/transport-rules/new/index.js +18 -2
- package/dist/apps/escrow/_layout.js +3 -3
- package/dist/apps/escrow/audit-log/index.js +26 -1
- package/dist/apps/escrow/matters/[uid].js +77 -42
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js +11 -2
- package/dist/apps/shared/components/admin/layout/AdminShell.js +3 -1
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.js +72 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.js +3 -3
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +22 -4
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +15 -4
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +13 -7
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +7 -2
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +6 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +34 -12
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +390 -78
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +40 -11
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +29 -13
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +87 -21
- package/dist/apps/shared/components/admin/signOut.js +75 -0
- package/dist/apps/shared/components/admin/usePagedList.js +99 -0
- package/dist/apps/shared/components/calendar/EventModal.js +142 -21
- package/dist/apps/shared/components/calendar/MonthView.js +12 -5
- package/dist/apps/shared/components/calendar/RecurrenceEditor.js +40 -5
- package/dist/apps/shared/components/calendar/SplitDayView.js +10 -4
- package/dist/apps/shared/components/calendar/TimeGridView.js +23 -7
- package/dist/apps/shared/components/calendar/allDay.js +111 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +1 -1
- package/dist/apps/shared/components/contacts/ContactDetailPane.js +43 -5
- package/dist/apps/shared/components/contacts/ContactForm.js +32 -10
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +2 -2
- package/dist/apps/shared/components/contacts/KeyChangeReview.js +63 -0
- package/dist/apps/shared/components/contacts/contactKeys.js +64 -0
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +24 -5
- package/dist/apps/shared/components/layout/AppShell.js +83 -14
- package/dist/apps/shared/components/layout/BrandingChrome.js +45 -10
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +49 -12
- package/dist/apps/shared/components/layout/MailboxProvisioning.js +10 -2
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.js +174 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.js +73 -14
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +50 -12
- package/dist/apps/shared/components/mail/MessageDetailPane.js +441 -36
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +9 -6
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +699 -128
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.js +50 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +12 -3
- package/dist/apps/shared/components/mail/pinnedSigners.js +98 -0
- package/dist/apps/shared/components/mail/verificationSeals.js +112 -0
- package/dist/apps/shared/components/mail/writableMailboxes.js +87 -0
- package/dist/apps/shared/components/rules/RuleBuilder.js +34 -6
- package/dist/apps/shared/mail/listAllPages.js +25 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.js +58 -54
- package/dist/apps/shared/search/localIndexBuilder.js +292 -37
- package/dist/apps/shared/search/localIndexRpcClient.js +188 -25
- package/dist/apps/shared/search/localIndexSchema.js +12 -6
- package/dist/apps/shared/search/localIndexStorage.js +86 -0
- package/dist/apps/shared/search/localIndexVFS.js +68 -40
- package/dist/apps/shared/search/localIndexWorker.js +519 -173
- package/dist/apps/www/calendar/index.js +28 -10
- package/dist/apps/www/contacts/[uid].js +13 -2
- package/dist/apps/www/contacts/index.js +80 -10
- package/dist/apps/www/index.js +339 -108
- package/dist/apps/www/messages/[uid].js +18 -6
- package/dist/apps/www/settings/auto-reply/index.js +9 -4
- package/dist/apps/www/settings/booking-types/[uid].js +17 -12
- package/dist/apps/www/settings/encryption/index.js +514 -97
- package/dist/apps/www/settings/filters/[uid].js +22 -7
- package/dist/apps/www/settings/filters/new/index.js +8 -2
- package/dist/apps/www/settings/focused-inbox/index.js +3 -1
- package/dist/apps/www/settings/privacy/index.js +57 -22
- package/dist/apps/www/settings/read-receipts/index.js +10 -3
- package/dist/apps/www/settings/sharing/index.js +7 -11
- package/dist/apps/www/tasks/index.js +50 -10
- package/package.json +2 -2
|
@@ -1,417 +1,438 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
6
|
-
import { DndContext, DragEndEvent, MouseSensor, TouchSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
7
|
-
import { HiOutlineBars3 } from "react-icons/hi2";
|
|
8
|
-
import {
|
|
9
|
-
addDays,
|
|
10
|
-
addMonths,
|
|
11
|
-
addWeeks,
|
|
12
|
-
eachDayOfInterval,
|
|
13
|
-
endOfDay,
|
|
14
|
-
endOfMonth,
|
|
15
|
-
endOfWeek,
|
|
16
|
-
format,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const [
|
|
74
|
-
const [
|
|
75
|
-
const [
|
|
76
|
-
const [
|
|
77
|
-
const [
|
|
78
|
-
const [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
{
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { DndContext, DragEndEvent, MouseSensor, TouchSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
7
|
+
import { HiOutlineBars3 } from "react-icons/hi2";
|
|
8
|
+
import {
|
|
9
|
+
addDays,
|
|
10
|
+
addMonths,
|
|
11
|
+
addWeeks,
|
|
12
|
+
eachDayOfInterval,
|
|
13
|
+
endOfDay,
|
|
14
|
+
endOfMonth,
|
|
15
|
+
endOfWeek,
|
|
16
|
+
format,
|
|
17
|
+
parseISO,
|
|
18
|
+
startOfDay,
|
|
19
|
+
startOfMonth,
|
|
20
|
+
startOfWeek,
|
|
21
|
+
} from "date-fns";
|
|
22
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
23
|
+
import { CalendarEvent, listCalendarEvents } from "@rapidmx/react-shared/calendar/calendarApi.js";
|
|
24
|
+
import { moveOccurrence, resizeOccurrenceEnd } from "@rapidmx/react-shared/calendar/calendarMutations.js";
|
|
25
|
+
import { resolveDragAction } from "@rapidmx/react-shared/calendar/calendarDragIds.js";
|
|
26
|
+
import { createFolder } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
27
|
+
import { CalendarOccurrence, expandAllOccurrences } from "@rapidmx/react-shared/calendar/recurrence.js";
|
|
28
|
+
import Drawer from "@rapidmx/react-shared/components/overlays/Drawer.js";
|
|
29
|
+
import CalendarShell, { CalendarShellProps, useCalendarShell } from "../../shared/components/calendar/layout/CalendarShell.js";
|
|
30
|
+
import CalendarListSidebar from "../../shared/components/calendar/CalendarListSidebar.js";
|
|
31
|
+
import { useWritableMailboxes } from "../../shared/components/mail/writableMailboxes.js";
|
|
32
|
+
import EventModal from "../../shared/components/calendar/EventModal.js";
|
|
33
|
+
import MiniDatePicker from "@rapidmx/react-shared/components/pickers/MiniDatePicker.js";
|
|
34
|
+
import MonthView from "../../shared/components/calendar/MonthView.js";
|
|
35
|
+
import SplitDayView from "../../shared/components/calendar/SplitDayView.js";
|
|
36
|
+
import TimeGridView from "../../shared/components/calendar/TimeGridView.js";
|
|
37
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
38
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
39
|
+
|
|
40
|
+
export default function CalendarPage(props: CalendarShellProps) {
|
|
41
|
+
return (
|
|
42
|
+
<CalendarShell {...props}>
|
|
43
|
+
<CalendarContent userUid={props.userUid} />
|
|
44
|
+
</CalendarShell>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type ViewType = "month" | "week" | "workWeek" | "day" | "split";
|
|
49
|
+
const VIEW_TYPES: ViewType[] = ["month", "week", "workWeek", "day", "split"];
|
|
50
|
+
const VIEW_LABELS: Record<ViewType, string> = { month: "Month", week: "Week", workWeek: "Work Week", day: "Day", split: "Split" };
|
|
51
|
+
|
|
52
|
+
interface ModalState {
|
|
53
|
+
occurrence: CalendarOccurrence | null;
|
|
54
|
+
initialStart?: Date;
|
|
55
|
+
initialEnd?: Date;
|
|
56
|
+
/** Overrides the default calendar a new event is created into (e.g. the column clicked in Split
|
|
57
|
+
* view) — ignored when editing an existing occurrence, which always keeps its own `folderUid`. */
|
|
58
|
+
targetFolderUid?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function CalendarContent({ userUid }: { userUid?: string }) {
|
|
62
|
+
const { mailboxUid, folderUid, calendarFolders, mailboxCalendars, mailboxes, reloadFolders, colorFor } = useCalendarShell();
|
|
63
|
+
// `PointerSensor` alone activates a drag on the very first touch-move, indistinguishable from a
|
|
64
|
+
// scroll gesture on a touch device. `MouseSensor` (a small `distance` — desktop drags still start
|
|
65
|
+
// immediately on a deliberate movement, no change from before) + `TouchSensor` (a `delay`+`tolerance`
|
|
66
|
+
// — a touch drag only activates after a brief press-and-hold, so a quick swipe scrolls normally) is
|
|
67
|
+
// dnd-kit's own documented pattern for this exact conflict.
|
|
68
|
+
const sensors = useSensors(
|
|
69
|
+
useSensor(MouseSensor, { activationConstraint: { distance: 8 } }),
|
|
70
|
+
useSensor(TouchSensor, { activationConstraint: { delay: 250, tolerance: 8 } }),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
74
|
+
const [view, setView] = useState<ViewType>("month");
|
|
75
|
+
const [viewDate, setViewDate] = useState(() => startOfDay(new Date()));
|
|
76
|
+
const [events, setEvents] = useState<CalendarEvent[]>([]);
|
|
77
|
+
const [loading, setLoading] = useState(true);
|
|
78
|
+
const [error, setError] = useState<string | null>(null);
|
|
79
|
+
const [actionError, setActionError] = useState<string | null>(null);
|
|
80
|
+
const [modal, setModal] = useState<ModalState | null>(null);
|
|
81
|
+
// `null` means "not yet customized by the user" — every calendar is treated as checked without
|
|
82
|
+
// needing to be seeded from `calendarFolders` the moment it loads (see `checkedFolderUids` below).
|
|
83
|
+
// Once the user toggles anything, this becomes a real (possibly empty) set of exactly what's checked.
|
|
84
|
+
const [checkedFolderUidsState, setCheckedFolderUidsState] = useState<Set<string> | null>(null);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const params = new URLSearchParams(window.location.search);
|
|
88
|
+
const requestedView = params.get("view");
|
|
89
|
+
if ((VIEW_TYPES as string[]).includes(requestedView ?? "")) {
|
|
90
|
+
setView(requestedView as ViewType);
|
|
91
|
+
}
|
|
92
|
+
const requestedDate = params.get("date");
|
|
93
|
+
// `parseISO()`, not `new Date()` - `?date=2026-06-16` is a local calendar day, but `new Date()` reads a
|
|
94
|
+
// date-only string as UTC midnight, i.e. the previous day anywhere west of UTC.
|
|
95
|
+
const parsedDate = requestedDate ? parseISO(requestedDate) : null;
|
|
96
|
+
if (parsedDate && !isNaN(parsedDate.getTime())) {
|
|
97
|
+
setViewDate(startOfDay(parsedDate));
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
100
|
+
|
|
101
|
+
const checkedFolderUids = checkedFolderUidsState ?? new Set(calendarFolders.map((f) => f.uid));
|
|
102
|
+
const folderColors = useMemo(
|
|
103
|
+
() => Object.fromEntries(calendarFolders.map((f) => [f.uid, colorFor(f)])),
|
|
104
|
+
[calendarFolders, colorFor],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
function toggleCalendar(toggledUid: string) {
|
|
108
|
+
setCheckedFolderUidsState((prev) => {
|
|
109
|
+
const next = new Set(prev ?? calendarFolders.map((f) => f.uid));
|
|
110
|
+
if (next.has(toggledUid)) {
|
|
111
|
+
next.delete(toggledUid);
|
|
112
|
+
} else {
|
|
113
|
+
next.add(toggledUid);
|
|
114
|
+
}
|
|
115
|
+
return next;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function handleAddCalendar(targetMailboxUid: string, name: string, color: string) {
|
|
120
|
+
const created = await createFolder({ mailboxUid: targetMailboxUid, name, type: "calendar", color });
|
|
121
|
+
setCheckedFolderUidsState((prev) => new Set([...(prev ?? calendarFolders.map((f) => f.uid)), created.uid]));
|
|
122
|
+
reloadFolders();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const { rangeStart, rangeEnd, days } = useMemo(() => {
|
|
126
|
+
if (view === "month") {
|
|
127
|
+
const start = startOfWeek(startOfMonth(viewDate), { weekStartsOn: 1 });
|
|
128
|
+
const end = endOfWeek(endOfMonth(viewDate), { weekStartsOn: 1 });
|
|
129
|
+
return { rangeStart: start, rangeEnd: end, days: [] as Date[] };
|
|
130
|
+
}
|
|
131
|
+
if (view === "week") {
|
|
132
|
+
const start = startOfWeek(viewDate, { weekStartsOn: 1 });
|
|
133
|
+
const end = endOfWeek(viewDate, { weekStartsOn: 1 });
|
|
134
|
+
return { rangeStart: start, rangeEnd: end, days: eachDayOfInterval({ start, end }) };
|
|
135
|
+
}
|
|
136
|
+
if (view === "workWeek") {
|
|
137
|
+
const start = startOfWeek(viewDate, { weekStartsOn: 1 });
|
|
138
|
+
const weekdays = eachDayOfInterval({ start, end: endOfWeek(viewDate, { weekStartsOn: 1 }) }).slice(0, 5);
|
|
139
|
+
return { rangeStart: start, rangeEnd: endOfDay(weekdays[weekdays.length - 1]), days: weekdays };
|
|
140
|
+
}
|
|
141
|
+
// "day" and "split" both show a single day, just laid out differently below.
|
|
142
|
+
const start = startOfDay(viewDate);
|
|
143
|
+
const end = endOfDay(viewDate);
|
|
144
|
+
return { rangeStart: start, rangeEnd: end, days: [start] };
|
|
145
|
+
}, [view, viewDate]);
|
|
146
|
+
|
|
147
|
+
// Only the most recent reload() may apply its results - toggling calendars (or saving/dragging an event)
|
|
148
|
+
// while an earlier, slower fetch is still in flight must not let that stale response overwrite newer
|
|
149
|
+
// events. (No date range is passed: `listCalendarEvents()` deliberately fetches the whole calendar and
|
|
150
|
+
// filters client-side - see its own doc comment on the server-side range query it works around.)
|
|
151
|
+
const reloadSeqRef = useRef(0);
|
|
152
|
+
|
|
153
|
+
function reload() {
|
|
154
|
+
const seq = ++reloadSeqRef.current;
|
|
155
|
+
const targets = calendarFolders.filter((f) => checkedFolderUids.has(f.uid));
|
|
156
|
+
if (targets.length === 0) {
|
|
157
|
+
setEvents([]);
|
|
158
|
+
setLoading(false);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
setLoading(true);
|
|
162
|
+
setError(null);
|
|
163
|
+
void Promise.allSettled(targets.map((f) => listCalendarEvents(f.uid)))
|
|
164
|
+
.then((results) => {
|
|
165
|
+
if (seq !== reloadSeqRef.current) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const loaded: CalendarEvent[] = [];
|
|
169
|
+
const failures: { name: string; err: unknown }[] = [];
|
|
170
|
+
results.forEach((result, i) => {
|
|
171
|
+
if (result.status === "fulfilled") {
|
|
172
|
+
loaded.push(...result.value);
|
|
173
|
+
} else {
|
|
174
|
+
failures.push({ name: targets[i].name, err: result.reason });
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
setEvents(loaded);
|
|
178
|
+
if (failures.length === 0) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// A single calendar's failure (by far the common case — most mailboxes have exactly one)
|
|
182
|
+
// surfaces that calendar's own error message unchanged, matching this page's original
|
|
183
|
+
// single-calendar behavior exactly; only a genuine multi-calendar partial failure falls
|
|
184
|
+
// back to a combined message naming which calendars didn't load.
|
|
185
|
+
if (failures.length === 1 && targets.length === 1) {
|
|
186
|
+
const err = failures[0].err;
|
|
187
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not load your calendar.");
|
|
188
|
+
} else {
|
|
189
|
+
setError(`Could not load events for: ${failures.map((f) => f.name).join(", ")}.`);
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
.finally(() => {
|
|
193
|
+
if (seq === reloadSeqRef.current) {
|
|
194
|
+
setLoading(false);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Keyed on stable string summaries (not the array/set objects themselves, which are new references
|
|
200
|
+
// every render) so this only re-fires when the actual set of folders to fetch changes.
|
|
201
|
+
const calendarFolderUidsKey = calendarFolders.map((f) => f.uid).sort().join(",");
|
|
202
|
+
const checkedFolderUidsKey = Array.from(checkedFolderUids).sort().join(",");
|
|
203
|
+
useEffect(reload, [calendarFolderUidsKey, checkedFolderUidsKey]);
|
|
204
|
+
|
|
205
|
+
const occurrences = useMemo(
|
|
206
|
+
() => expandAllOccurrences(events, rangeStart, rangeEnd),
|
|
207
|
+
[events, rangeStart, rangeEnd],
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
const splitColumns = useMemo(
|
|
211
|
+
() =>
|
|
212
|
+
calendarFolders
|
|
213
|
+
.filter((f) => checkedFolderUids.has(f.uid))
|
|
214
|
+
.map((f) => ({ folderUid: f.uid, name: f.name, color: colorFor(f) })),
|
|
215
|
+
[calendarFolders, checkedFolderUidsKey, colorFor],
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
function shiftView(direction: 1 | -1) {
|
|
219
|
+
setViewDate((d) =>
|
|
220
|
+
view === "month"
|
|
221
|
+
? addMonths(d, direction)
|
|
222
|
+
: view === "week" || view === "workWeek"
|
|
223
|
+
? addWeeks(d, direction)
|
|
224
|
+
: addDays(d, direction),
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function goToday() {
|
|
229
|
+
setViewDate(startOfDay(new Date()));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function handleSelectDay(date: Date) {
|
|
233
|
+
setView("day");
|
|
234
|
+
setViewDate(startOfDay(date));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function openNewEvent(start?: Date, end?: Date, targetFolderUid?: string) {
|
|
238
|
+
if (!mailboxUid || !folderUid) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
setModal({
|
|
242
|
+
occurrence: null,
|
|
243
|
+
initialStart: start ?? new Date(),
|
|
244
|
+
initialEnd: end ?? new Date(Date.now() + 30 * 60_000),
|
|
245
|
+
targetFolderUid,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function openEvent(occurrence: CalendarOccurrence) {
|
|
250
|
+
setModal({ occurrence });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function closeModal() {
|
|
254
|
+
setModal(null);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function handleSaved() {
|
|
258
|
+
setModal(null);
|
|
259
|
+
reload();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function handleDeleted() {
|
|
263
|
+
setModal(null);
|
|
264
|
+
reload();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
async function handleDragEnd(event: DragEndEvent) {
|
|
268
|
+
const overId = event.over ? String(event.over.id) : undefined;
|
|
269
|
+
const action = resolveDragAction(String(event.active.id), overId, occurrences);
|
|
270
|
+
if (!action) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
setActionError(null);
|
|
274
|
+
try {
|
|
275
|
+
if (action.type === "move") {
|
|
276
|
+
await moveOccurrence(action.occurrence, action.deltaMs);
|
|
277
|
+
} else {
|
|
278
|
+
await resizeOccurrenceEnd(action.occurrence, action.newEnd);
|
|
279
|
+
}
|
|
280
|
+
reload();
|
|
281
|
+
} catch (err) {
|
|
282
|
+
setActionError(err instanceof ApiRequestError ? err.message : "Could not update this event.");
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const title =
|
|
287
|
+
view === "month"
|
|
288
|
+
? format(viewDate, "MMMM yyyy")
|
|
289
|
+
: view === "week" || view === "workWeek"
|
|
290
|
+
? `${format(rangeStart, "MMM d")} – ${format(rangeEnd, "MMM d, yyyy")}`
|
|
291
|
+
: format(viewDate, "EEEE, MMMM d, yyyy");
|
|
292
|
+
|
|
293
|
+
const modalFolderUid = modal ? (modal.targetFolderUid ?? modal.occurrence?.folderUid ?? folderUid) : undefined;
|
|
294
|
+
const modalMailboxUid = calendarFolders.find((f) => f.uid === modalFolderUid)?.mailboxUid ?? mailboxUid;
|
|
295
|
+
const modalMailbox = mailboxes.find((mb) => mb.uid === modalMailboxUid);
|
|
296
|
+
// Mailboxes a new event can be created in - only those with at least one calendar that the caller can
|
|
297
|
+
// write to (a view-only share is left out; see writableMailboxes.ts).
|
|
298
|
+
const writableMailboxes = useWritableMailboxes(mailboxes, userUid, modalMailboxUid);
|
|
299
|
+
const mailboxOptions = useMemo(
|
|
300
|
+
() =>
|
|
301
|
+
mailboxCalendars
|
|
302
|
+
.filter((mc) => mc.calendarFolders.length > 0 && writableMailboxes.some((mb) => mb.uid === mc.mailbox.uid))
|
|
303
|
+
.map((mc) => ({ mailbox: mc.mailbox, calendars: mc.calendarFolders.map((f) => ({ uid: f.uid, name: f.name })) })),
|
|
304
|
+
[mailboxCalendars, writableMailboxes],
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
const sidebarContent = (
|
|
308
|
+
<>
|
|
309
|
+
<MiniDatePicker selected={viewDate} onSelect={(date) => setViewDate(startOfDay(date))} />
|
|
310
|
+
<CalendarListSidebar
|
|
311
|
+
mailboxCalendars={mailboxCalendars}
|
|
312
|
+
checkedFolderUids={checkedFolderUids}
|
|
313
|
+
onToggle={toggleCalendar}
|
|
314
|
+
onAddCalendar={handleAddCalendar}
|
|
315
|
+
colorFor={colorFor}
|
|
316
|
+
/>
|
|
317
|
+
</>
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<div className="flex-1 flex min-h-0">
|
|
322
|
+
<div className="hidden md:flex w-56 shrink-0 border-r border-border flex-col overflow-y-auto">{sidebarContent}</div>
|
|
323
|
+
<Drawer open={drawerOpen} onClose={() => setDrawerOpen(false)} title="Calendars">
|
|
324
|
+
<div className="flex flex-col">{sidebarContent}</div>
|
|
325
|
+
</Drawer>
|
|
326
|
+
<div className="flex-1 flex flex-col min-h-0">
|
|
327
|
+
<div className="flex items-center gap-3 p-3 border-b border-border shrink-0">
|
|
328
|
+
<button
|
|
329
|
+
type="button"
|
|
330
|
+
className="md:hidden w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text shrink-0"
|
|
331
|
+
aria-label="Open calendars"
|
|
332
|
+
onClick={() => setDrawerOpen(true)}
|
|
333
|
+
>
|
|
334
|
+
<HiOutlineBars3 size={20} aria-hidden="true" />
|
|
335
|
+
</button>
|
|
336
|
+
<Button type="button" onClick={() => openNewEvent()} className="!w-auto shrink-0">
|
|
337
|
+
+ New event
|
|
338
|
+
</Button>
|
|
339
|
+
<div className="flex items-center gap-1">
|
|
340
|
+
<button type="button" onClick={() => shiftView(-1)} aria-label="Previous" className="w-7 h-7 text-sm rounded-sm hover:bg-surface-alt">
|
|
341
|
+
‹
|
|
342
|
+
</button>
|
|
343
|
+
<button type="button" onClick={goToday} className="px-2 h-7 text-sm rounded-sm hover:bg-surface-alt">
|
|
344
|
+
Today
|
|
345
|
+
</button>
|
|
346
|
+
<button type="button" onClick={() => shiftView(1)} aria-label="Next" className="w-7 h-7 text-sm rounded-sm hover:bg-surface-alt">
|
|
347
|
+
›
|
|
348
|
+
</button>
|
|
349
|
+
</div>
|
|
350
|
+
<h1 className="hidden md:block text-lg font-bold tracking-tight">{title}</h1>
|
|
351
|
+
<div className="ml-auto flex gap-1 overflow-x-auto">
|
|
352
|
+
{VIEW_TYPES.map((v) => (
|
|
353
|
+
<button
|
|
354
|
+
key={v}
|
|
355
|
+
type="button"
|
|
356
|
+
onClick={() => setView(v)}
|
|
357
|
+
className={[
|
|
358
|
+
"px-3 h-7 text-sm rounded-sm whitespace-nowrap",
|
|
359
|
+
view === v ? "bg-primary text-white" : "hover:bg-surface-alt",
|
|
360
|
+
(v === "workWeek" || v === "split") && "hidden md:inline-block",
|
|
361
|
+
]
|
|
362
|
+
.filter(Boolean)
|
|
363
|
+
.join(" ")}
|
|
364
|
+
>
|
|
365
|
+
{VIEW_LABELS[v]}
|
|
366
|
+
</button>
|
|
367
|
+
))}
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
{error && (
|
|
372
|
+
<div className="p-3">
|
|
373
|
+
<Alert>{error}</Alert>
|
|
374
|
+
</div>
|
|
375
|
+
)}
|
|
376
|
+
{actionError && (
|
|
377
|
+
<div className="p-3">
|
|
378
|
+
<Alert>{actionError}</Alert>
|
|
379
|
+
</div>
|
|
380
|
+
)}
|
|
381
|
+
|
|
382
|
+
{loading ? (
|
|
383
|
+
<p className="p-4 text-sm text-text-muted">Loading…</p>
|
|
384
|
+
) : (
|
|
385
|
+
<DndContext sensors={sensors} onDragEnd={handleDragEnd}>
|
|
386
|
+
{view === "month" ? (
|
|
387
|
+
<MonthView
|
|
388
|
+
viewDate={viewDate}
|
|
389
|
+
occurrences={occurrences}
|
|
390
|
+
folderColors={folderColors}
|
|
391
|
+
onSelectDay={handleSelectDay}
|
|
392
|
+
onSelectEvent={openEvent}
|
|
393
|
+
/>
|
|
394
|
+
) : view === "split" ? (
|
|
395
|
+
<SplitDayView
|
|
396
|
+
day={viewDate}
|
|
397
|
+
columns={splitColumns}
|
|
398
|
+
occurrences={occurrences}
|
|
399
|
+
onSelectEvent={openEvent}
|
|
400
|
+
onSelectSlot={(start, end, targetFolderUid) => openNewEvent(start, end, targetFolderUid)}
|
|
401
|
+
/>
|
|
402
|
+
) : (
|
|
403
|
+
<TimeGridView
|
|
404
|
+
days={days}
|
|
405
|
+
occurrences={occurrences}
|
|
406
|
+
folderColors={folderColors}
|
|
407
|
+
onSelectEvent={openEvent}
|
|
408
|
+
onSelectSlot={openNewEvent}
|
|
409
|
+
/>
|
|
410
|
+
)}
|
|
411
|
+
</DndContext>
|
|
412
|
+
)}
|
|
413
|
+
|
|
414
|
+
{/* `folderUid` is guaranteed defined whenever `modal` is: `openNewEvent` only sets it after
|
|
415
|
+
checking it, and `openEvent` only fires from an occurrence that itself required a
|
|
416
|
+
successful, folder-scoped load to render. The modal is scoped to that folder's own mailbox
|
|
417
|
+
(which may be a shared one) - its organizer address and calendar picker come from there. */}
|
|
418
|
+
{modal && modalMailbox && (
|
|
419
|
+
<EventModal
|
|
420
|
+
open
|
|
421
|
+
onClose={closeModal}
|
|
422
|
+
mailboxUid={modalMailbox.uid}
|
|
423
|
+
folderUid={modalFolderUid!}
|
|
424
|
+
calendars={calendarFolders.filter((f) => f.mailboxUid === modalMailbox.uid).map((f) => ({ uid: f.uid, name: f.name }))}
|
|
425
|
+
mailboxOptions={mailboxOptions}
|
|
426
|
+
organizerAddress={modalMailbox.primarySmtpAddress}
|
|
427
|
+
organizerAliases={modalMailbox.aliasAddresses}
|
|
428
|
+
occurrence={modal.occurrence}
|
|
429
|
+
initialStart={modal.initialStart}
|
|
430
|
+
initialEnd={modal.initialEnd}
|
|
431
|
+
onSaved={handleSaved}
|
|
432
|
+
onDeleted={handleDeleted}
|
|
433
|
+
/>
|
|
434
|
+
)}
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
);
|
|
438
|
+
}
|