@rapidmx/web-client 0.14.1 → 0.16.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/README.md +373 -373
- package/apps/admin/branding/index.tsx +39 -39
- package/apps/admin/data-requests/index.tsx +482 -480
- package/apps/admin/domains/[uid].tsx +164 -163
- package/apps/admin/escrow-scopes/[uid].tsx +348 -348
- package/apps/admin/index.tsx +127 -124
- package/apps/admin/mailboxes/[uid].tsx +269 -224
- package/apps/admin/mailboxes/new/index.tsx +28 -28
- package/apps/admin/plugins/index.tsx +15 -15
- package/apps/admin/retention-policy/index.tsx +39 -39
- package/apps/admin/signing-certificates/index.tsx +343 -343
- package/apps/escrow/audit-log/index.tsx +196 -196
- package/apps/escrow/matters/[uid].tsx +621 -621
- package/apps/shared/appearance/AppearanceForm.tsx +9 -1
- package/apps/shared/auth/adminAccess.ts +99 -99
- package/apps/shared/calendar/bookingPlugin.ts +100 -0
- package/apps/shared/calendar/calendarLiveUpdates.ts +27 -0
- package/apps/shared/components/admin/layout/AdminShell.tsx +378 -346
- package/apps/shared/components/admin/mailboxes/EraseLeftoverDataDialog.tsx +238 -0
- package/apps/shared/components/admin/mailboxes/EscrowScopeCard.tsx +152 -152
- package/apps/shared/components/admin/mailboxes/LeftoverMailboxesSection.tsx +194 -0
- package/apps/shared/components/admin/settings/BrandingForm.tsx +423 -423
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +119 -119
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +53 -4
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +198 -198
- package/apps/shared/components/admin/settings/PluginsManager.tsx +64 -10
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +182 -182
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +288 -288
- package/apps/shared/components/admin/setup/SetupWizard.tsx +444 -444
- package/apps/shared/components/admin/usePagedList.tsx +129 -129
- package/apps/shared/components/calendar/AppointmentQuickForm.tsx +327 -0
- package/apps/shared/components/calendar/DescriptionEditor.tsx +274 -0
- package/apps/shared/components/calendar/EventDescriptionView.tsx +70 -0
- package/apps/shared/components/calendar/EventDetails.tsx +401 -0
- package/apps/shared/components/calendar/EventEditor.tsx +635 -0
- package/apps/shared/components/calendar/EventExpandedForm.tsx +210 -0
- package/apps/shared/components/calendar/EventFormParts.tsx +591 -0
- package/apps/shared/components/calendar/EventModal.tsx +206 -946
- package/apps/shared/components/calendar/EventQuickForm.tsx +116 -0
- package/apps/shared/components/calendar/EventShell.tsx +202 -0
- package/apps/shared/components/calendar/FindATime.tsx +379 -0
- package/apps/shared/components/calendar/GuestInput.tsx +100 -0
- package/apps/shared/components/calendar/LazyDescriptionEditor.tsx +70 -0
- package/apps/shared/components/calendar/MonthView.tsx +185 -173
- package/apps/shared/components/calendar/QuickCreateFaces.tsx +87 -0
- package/apps/shared/components/calendar/QuickCreateTabs.tsx +81 -0
- package/apps/shared/components/calendar/QuickFaceFrame.tsx +81 -0
- package/apps/shared/components/calendar/RecurrenceEditor.tsx +227 -222
- package/apps/shared/components/calendar/RequestChangeForm.tsx +240 -0
- package/apps/shared/components/calendar/SplitDayView.tsx +144 -143
- package/apps/shared/components/calendar/TaskQuickForm.tsx +289 -0
- package/apps/shared/components/calendar/TimeGridView.tsx +246 -244
- package/apps/shared/components/calendar/allDay.ts +124 -124
- package/apps/shared/components/calendar/eventDialogFields.ts +86 -0
- package/apps/shared/components/calendar/eventForm.ts +108 -0
- package/apps/shared/components/calendar/eventFormat.ts +210 -0
- package/apps/shared/components/calendar/findTimeGrid.ts +90 -0
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +201 -200
- package/apps/shared/components/calendar/swipeNavigation.ts +14 -0
- package/apps/shared/components/contacts/ContactForm.tsx +383 -383
- package/apps/shared/components/contacts/ContactsSidebar.tsx +1 -1
- package/apps/shared/components/contacts/ContactsToolbar.tsx +103 -98
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +217 -216
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +155 -155
- package/apps/shared/components/layout/AppShell.tsx +480 -480
- package/apps/shared/components/layout/FloatingActionButton.tsx +31 -0
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +398 -398
- package/apps/shared/components/layout/MailboxProvisioning.tsx +168 -168
- package/apps/shared/components/layout/ResponsiveToolbar.tsx +315 -315
- package/apps/shared/components/layout/ThemeSwitch.tsx +84 -84
- package/apps/shared/components/layout/UserMenu.tsx +439 -372
- package/apps/shared/components/mail/ConversationList.tsx +323 -271
- package/apps/shared/components/mail/ConversationThreadPane.tsx +130 -5
- package/apps/shared/components/mail/InviteCard.tsx +387 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +236 -227
- package/apps/shared/components/mail/MessageDetailPane.tsx +1559 -1537
- package/apps/shared/components/mail/SwipeRow.tsx +120 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +312 -312
- package/apps/shared/components/mail/compose/ComposeToolbar.tsx +422 -422
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1681 -1673
- package/apps/shared/components/mail/compose/RecipientInput.tsx +54 -11
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +147 -147
- package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -60
- package/apps/shared/components/mail/compose/quotedBody.ts +161 -161
- package/apps/shared/components/mail/invite/InviteRowChip.tsx +104 -0
- package/apps/shared/components/mail/invite/InviteRsvpPopover.tsx +271 -0
- package/apps/shared/components/mail/invite/InviteTimeline.tsx +200 -0
- package/apps/shared/components/mail/invite/ProposeTimeForm.tsx +109 -0
- package/apps/shared/components/mail/invite/inviteFormat.ts +110 -0
- package/apps/shared/components/mail/invite/inviteStore.ts +114 -0
- package/apps/shared/components/mail/layout/FolderBadgeChip.tsx +21 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +546 -490
- package/apps/shared/components/mail/layout/SidebarSection.tsx +66 -0
- package/apps/shared/components/mail/reading/PendingMessageCard.tsx +68 -0
- package/apps/shared/components/mail/verificationSeals.ts +125 -125
- package/apps/shared/components/rules/RuleBuilder.tsx +311 -311
- package/apps/shared/components/settings/SigningCertificateCard.tsx +344 -344
- package/apps/shared/components/settings/layout/SettingsShell.tsx +255 -253
- package/apps/shared/components/tasks/TasksSidebar.tsx +1 -1
- package/apps/shared/components/tasks/layout/TasksShell.tsx +218 -217
- package/apps/shared/gestures/useEnterSlide.ts +54 -0
- package/apps/shared/gestures/useSwipe.ts +114 -0
- package/apps/shared/gestures/useSwipeSlide.ts +113 -0
- package/apps/shared/gestures/useWheelPaging.ts +107 -0
- package/apps/shared/keyboard/GlobalShortcuts.tsx +51 -51
- package/apps/shared/keyboard/ShortcutProvider.tsx +62 -62
- package/apps/shared/keyboard/ShortcutsDialog.tsx +84 -84
- package/apps/shared/keyboard/dispatch.ts +124 -124
- package/apps/shared/keyboard/format.ts +89 -89
- package/apps/shared/keyboard/keymap.ts +114 -114
- package/apps/shared/keyboard/registry.ts +65 -65
- package/apps/shared/keyboard/targets.ts +79 -79
- package/apps/shared/mail/folderCounts.ts +17 -0
- package/apps/shared/mail/folderTree.ts +143 -143
- package/apps/shared/mail/listAllPages.ts +39 -39
- package/apps/shared/mail/newMailNotifications.ts +3 -15
- package/apps/shared/mail/outbox/outgoingReplies.ts +192 -0
- package/apps/shared/mail/outbox/sendJob.ts +19 -1
- package/apps/shared/mail/outbox/sendOutcomes.ts +13 -4
- package/apps/shared/mail/primaryMailbox.ts +71 -0
- package/apps/shared/mail/useCollapsedSections.ts +146 -0
- package/apps/shared/mail/useMailConnection.ts +205 -203
- package/apps/shared/mail/useMailLiveUpdates.ts +277 -277
- package/apps/shared/mail/useMarkMessageRead.ts +47 -47
- package/apps/shared/mail/useNewMailNotifications.ts +2 -2
- package/apps/shared/navigation/AppRouter.tsx +300 -300
- package/apps/shared/navigation/routerContext.tsx +83 -83
- package/apps/shared/notifications/preferences.ts +36 -0
- package/apps/shared/notifications/store.ts +9 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +114 -114
- package/apps/shared/search/crossMailboxSearch.ts +169 -0
- package/apps/shared/search/localIndexBuilder.ts +481 -481
- package/apps/shared/signing/enrollmentStorage.ts +33 -33
- package/apps/shared/signing/enrollmentTracker.ts +385 -385
- package/apps/shared/signing/enrollmentView.ts +251 -251
- package/apps/shared/signing/useNow.ts +19 -19
- package/apps/shared/signing/useSigningEnrollmentWatcher.ts +90 -90
- package/apps/shared/styles/app.css +396 -386
- package/apps/www/_routes.ts +1 -0
- package/apps/www/calendar/index.tsx +578 -469
- package/apps/www/contacts/[uid].tsx +109 -109
- package/apps/www/contacts/index.tsx +6 -0
- package/apps/www/index.tsx +2847 -2332
- package/apps/www/messages/[uid].tsx +135 -108
- package/apps/www/settings/auto-reply/index.tsx +133 -133
- package/apps/www/settings/encryption/index.tsx +1287 -1287
- package/apps/www/settings/filters/[uid].tsx +176 -176
- package/apps/www/settings/filters/index.tsx +102 -102
- package/apps/www/settings/filters/new/index.tsx +140 -140
- package/apps/www/settings/labels/index.tsx +204 -204
- package/apps/www/settings/privacy/index.tsx +492 -492
- package/apps/www/settings/profile/index.tsx +248 -0
- package/apps/www/settings/read-receipts/index.tsx +147 -147
- package/apps/www/settings/sharing/index.tsx +256 -256
- package/apps/www/settings/signatures/[uid].tsx +172 -172
- package/apps/www/settings/signatures/index.tsx +88 -88
- package/apps/www/settings/signatures/new/index.tsx +135 -135
- package/apps/www/tasks/index.tsx +649 -649
- package/dist/apps/admin/data-requests/index.js +1 -1
- package/dist/apps/admin/domains/[uid].js +4 -2
- package/dist/apps/admin/index.js +2 -1
- package/dist/apps/admin/mailboxes/[uid].js +12 -2
- package/dist/apps/shared/appearance/AppearanceForm.js +9 -1
- package/dist/apps/shared/calendar/bookingPlugin.d.ts +50 -0
- package/dist/apps/shared/calendar/bookingPlugin.js +57 -0
- package/dist/apps/shared/calendar/calendarLiveUpdates.d.ts +11 -0
- package/dist/apps/shared/calendar/calendarLiveUpdates.js +23 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +1 -1
- package/dist/apps/shared/components/admin/layout/AdminShell.js +7 -3
- package/dist/apps/shared/components/admin/mailboxes/EraseLeftoverDataDialog.d.ts +35 -0
- package/dist/apps/shared/components/admin/mailboxes/EraseLeftoverDataDialog.js +115 -0
- package/dist/apps/shared/components/admin/mailboxes/LeftoverMailboxesSection.d.ts +16 -0
- package/dist/apps/shared/components/admin/mailboxes/LeftoverMailboxesSection.js +92 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +3 -3
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +28 -4
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +40 -6
- package/dist/apps/shared/components/calendar/AppointmentQuickForm.d.ts +47 -0
- package/dist/apps/shared/components/calendar/AppointmentQuickForm.js +135 -0
- package/dist/apps/shared/components/calendar/DescriptionEditor.d.ts +26 -0
- package/dist/apps/shared/components/calendar/DescriptionEditor.js +192 -0
- package/dist/apps/shared/components/calendar/EventDescriptionView.d.ts +14 -0
- package/dist/apps/shared/components/calendar/EventDescriptionView.js +39 -0
- package/dist/apps/shared/components/calendar/EventDetails.d.ts +33 -0
- package/dist/apps/shared/components/calendar/EventDetails.js +137 -0
- package/dist/apps/shared/components/calendar/EventEditor.d.ts +59 -0
- package/dist/apps/shared/components/calendar/EventEditor.js +544 -0
- package/dist/apps/shared/components/calendar/EventExpandedForm.d.ts +14 -0
- package/dist/apps/shared/components/calendar/EventExpandedForm.js +44 -0
- package/dist/apps/shared/components/calendar/EventFormParts.d.ts +70 -0
- package/dist/apps/shared/components/calendar/EventFormParts.js +191 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +26 -13
- package/dist/apps/shared/components/calendar/EventModal.js +57 -459
- package/dist/apps/shared/components/calendar/EventQuickForm.d.ts +18 -0
- package/dist/apps/shared/components/calendar/EventQuickForm.js +25 -0
- package/dist/apps/shared/components/calendar/EventShell.d.ts +64 -0
- package/dist/apps/shared/components/calendar/EventShell.js +134 -0
- package/dist/apps/shared/components/calendar/FindATime.d.ts +18 -0
- package/dist/apps/shared/components/calendar/FindATime.js +190 -0
- package/dist/apps/shared/components/calendar/GuestInput.d.ts +45 -0
- package/dist/apps/shared/components/calendar/GuestInput.js +30 -0
- package/dist/apps/shared/components/calendar/LazyDescriptionEditor.d.ts +8 -0
- package/dist/apps/shared/components/calendar/LazyDescriptionEditor.js +44 -0
- package/dist/apps/shared/components/calendar/MonthView.d.ts +5 -1
- package/dist/apps/shared/components/calendar/MonthView.js +11 -5
- package/dist/apps/shared/components/calendar/QuickCreateFaces.d.ts +30 -0
- package/dist/apps/shared/components/calendar/QuickCreateFaces.js +44 -0
- package/dist/apps/shared/components/calendar/QuickCreateTabs.d.ts +24 -0
- package/dist/apps/shared/components/calendar/QuickCreateTabs.js +46 -0
- package/dist/apps/shared/components/calendar/QuickFaceFrame.d.ts +25 -0
- package/dist/apps/shared/components/calendar/QuickFaceFrame.js +19 -0
- package/dist/apps/shared/components/calendar/RecurrenceEditor.d.ts +4 -1
- package/dist/apps/shared/components/calendar/RecurrenceEditor.js +2 -2
- package/dist/apps/shared/components/calendar/RequestChangeForm.d.ts +36 -0
- package/dist/apps/shared/components/calendar/RequestChangeForm.js +127 -0
- package/dist/apps/shared/components/calendar/SplitDayView.d.ts +3 -2
- package/dist/apps/shared/components/calendar/SplitDayView.js +3 -2
- package/dist/apps/shared/components/calendar/TaskQuickForm.d.ts +40 -0
- package/dist/apps/shared/components/calendar/TaskQuickForm.js +101 -0
- package/dist/apps/shared/components/calendar/TimeGridView.d.ts +4 -2
- package/dist/apps/shared/components/calendar/TimeGridView.js +3 -2
- package/dist/apps/shared/components/calendar/eventDialogFields.d.ts +28 -0
- package/dist/apps/shared/components/calendar/eventDialogFields.js +59 -0
- package/dist/apps/shared/components/calendar/eventForm.d.ts +98 -0
- package/dist/apps/shared/components/calendar/eventForm.js +1 -0
- package/dist/apps/shared/components/calendar/eventFormat.d.ts +80 -0
- package/dist/apps/shared/components/calendar/eventFormat.js +190 -0
- package/dist/apps/shared/components/calendar/findTimeGrid.d.ts +30 -0
- package/dist/apps/shared/components/calendar/findTimeGrid.js +83 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +3 -2
- package/dist/apps/shared/components/calendar/swipeNavigation.d.ts +9 -0
- package/dist/apps/shared/components/calendar/swipeNavigation.js +8 -0
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +1 -1
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +3 -1
- package/dist/apps/shared/components/contacts/ContactsToolbar.js +4 -2
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +4 -3
- package/dist/apps/shared/components/layout/FloatingActionButton.d.ts +13 -0
- package/dist/apps/shared/components/layout/FloatingActionButton.js +9 -0
- package/dist/apps/shared/components/layout/UserMenu.d.ts +14 -9
- package/dist/apps/shared/components/layout/UserMenu.js +74 -26
- package/dist/apps/shared/components/mail/ConversationList.d.ts +12 -1
- package/dist/apps/shared/components/mail/ConversationList.js +21 -4
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +4 -1
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +127 -22
- package/dist/apps/shared/components/mail/InviteCard.d.ts +20 -0
- package/dist/apps/shared/components/mail/InviteCard.js +150 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +6 -1
- package/dist/apps/shared/components/mail/MailSelectionBar.js +3 -3
- package/dist/apps/shared/components/mail/MessageDetailPane.js +13 -2
- package/dist/apps/shared/components/mail/SwipeRow.d.ts +22 -0
- package/dist/apps/shared/components/mail/SwipeRow.js +71 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +16 -7
- package/dist/apps/shared/components/mail/compose/RecipientInput.d.ts +21 -1
- package/dist/apps/shared/components/mail/compose/RecipientInput.js +18 -10
- package/dist/apps/shared/components/mail/invite/InviteRowChip.d.ts +23 -0
- package/dist/apps/shared/components/mail/invite/InviteRowChip.js +46 -0
- package/dist/apps/shared/components/mail/invite/InviteRsvpPopover.d.ts +20 -0
- package/dist/apps/shared/components/mail/invite/InviteRsvpPopover.js +141 -0
- package/dist/apps/shared/components/mail/invite/InviteTimeline.d.ts +27 -0
- package/dist/apps/shared/components/mail/invite/InviteTimeline.js +120 -0
- package/dist/apps/shared/components/mail/invite/ProposeTimeForm.d.ts +17 -0
- package/dist/apps/shared/components/mail/invite/ProposeTimeForm.js +45 -0
- package/dist/apps/shared/components/mail/invite/inviteFormat.d.ts +28 -0
- package/dist/apps/shared/components/mail/invite/inviteFormat.js +94 -0
- package/dist/apps/shared/components/mail/invite/inviteStore.d.ts +28 -0
- package/dist/apps/shared/components/mail/invite/inviteStore.js +95 -0
- package/dist/apps/shared/components/mail/layout/FolderBadgeChip.d.ts +6 -0
- package/dist/apps/shared/components/mail/layout/FolderBadgeChip.js +9 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +10 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +76 -46
- package/dist/apps/shared/components/mail/layout/SidebarSection.d.ts +23 -0
- package/dist/apps/shared/components/mail/layout/SidebarSection.js +16 -0
- package/dist/apps/shared/components/mail/reading/PendingMessageCard.d.ts +14 -0
- package/dist/apps/shared/components/mail/reading/PendingMessageCard.js +16 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +7 -5
- package/dist/apps/shared/components/tasks/TasksSidebar.js +1 -1
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +4 -3
- package/dist/apps/shared/gestures/useEnterSlide.d.ts +14 -0
- package/dist/apps/shared/gestures/useEnterSlide.js +47 -0
- package/dist/apps/shared/gestures/useSwipe.d.ts +45 -0
- package/dist/apps/shared/gestures/useSwipe.js +90 -0
- package/dist/apps/shared/gestures/useSwipeSlide.d.ts +40 -0
- package/dist/apps/shared/gestures/useSwipeSlide.js +95 -0
- package/dist/apps/shared/gestures/useWheelPaging.d.ts +32 -0
- package/dist/apps/shared/gestures/useWheelPaging.js +85 -0
- package/dist/apps/shared/mail/folderCounts.d.ts +10 -0
- package/dist/apps/shared/mail/folderCounts.js +12 -0
- package/dist/apps/shared/mail/newMailNotifications.d.ts +3 -8
- package/dist/apps/shared/mail/newMailNotifications.js +3 -12
- package/dist/apps/shared/mail/outbox/outgoingReplies.d.ts +80 -0
- package/dist/apps/shared/mail/outbox/outgoingReplies.js +131 -0
- package/dist/apps/shared/mail/outbox/sendJob.d.ts +5 -1
- package/dist/apps/shared/mail/outbox/sendJob.js +14 -1
- package/dist/apps/shared/mail/outbox/sendOutcomes.js +13 -4
- package/dist/apps/shared/mail/primaryMailbox.d.ts +29 -0
- package/dist/apps/shared/mail/primaryMailbox.js +61 -0
- package/dist/apps/shared/mail/useCollapsedSections.d.ts +32 -0
- package/dist/apps/shared/mail/useCollapsedSections.js +110 -0
- package/dist/apps/shared/mail/useMailConnection.js +3 -1
- package/dist/apps/shared/mail/useNewMailNotifications.js +3 -2
- package/dist/apps/shared/notifications/preferences.d.ts +13 -0
- package/dist/apps/shared/notifications/preferences.js +36 -0
- package/dist/apps/shared/notifications/store.d.ts +1 -0
- package/dist/apps/shared/notifications/store.js +7 -23
- package/dist/apps/shared/search/crossMailboxSearch.d.ts +72 -0
- package/dist/apps/shared/search/crossMailboxSearch.js +136 -0
- package/dist/apps/shared/styles/app.css +396 -386
- package/dist/apps/www/_routes.js +1 -0
- package/dist/apps/www/calendar/index.js +78 -7
- package/dist/apps/www/contacts/index.js +3 -1
- package/dist/apps/www/index.js +548 -210
- package/dist/apps/www/messages/[uid].js +13 -5
- package/dist/apps/www/settings/profile/index.d.ts +4 -0
- package/dist/apps/www/settings/profile/index.js +124 -0
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ import Skeleton, { SkeletonList } from "@rapidmx/react-shared/components/feedbac
|
|
|
12
12
|
import AppShell from "../../layout/AppShell.js";
|
|
13
13
|
import { useLocationSearch } from "../../../navigation/AppRouter.js";
|
|
14
14
|
import MailboxProvisioning from "../../layout/MailboxProvisioning.js";
|
|
15
|
+
import { orderMailboxes, primaryMailboxUid } from "../../../mail/primaryMailbox.js";
|
|
15
16
|
const CalendarShellContext = createContext({
|
|
16
17
|
calendarFolders: [],
|
|
17
18
|
mailboxCalendars: [],
|
|
@@ -49,7 +50,7 @@ export default function CalendarShell({ userUid, authServerUrl, impersonating, i
|
|
|
49
50
|
}
|
|
50
51
|
listMailboxes({ limit: 100 })
|
|
51
52
|
.then((result) => {
|
|
52
|
-
setMailboxes(result);
|
|
53
|
+
setMailboxes(orderMailboxes(result, userUid));
|
|
53
54
|
setStatus("ready");
|
|
54
55
|
})
|
|
55
56
|
.catch((err) => {
|
|
@@ -57,7 +58,7 @@ export default function CalendarShell({ userUid, authServerUrl, impersonating, i
|
|
|
57
58
|
setStatus("error");
|
|
58
59
|
});
|
|
59
60
|
}, [userUid]);
|
|
60
|
-
const ownMailboxUid = mailboxes
|
|
61
|
+
const ownMailboxUid = primaryMailboxUid(mailboxes, userUid);
|
|
61
62
|
const mailboxUid = (requestedMailboxUid && mailboxes.some((mb) => mb.uid === requestedMailboxUid) ? requestedMailboxUid : undefined) ??
|
|
62
63
|
ownMailboxUid;
|
|
63
64
|
useEffect(() => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SwipeDirection } from "../../gestures/useSwipe.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a horizontal swipe on the phone layout's calendar does, as the direction the visible period moves: `-1` is the previous
|
|
4
|
+
* month/week/day, `1` the next. This is the one place that mapping lives, so it flips in a single line.
|
|
5
|
+
*
|
|
6
|
+
* Swiping left (finger right to left) shows the next period and swiping right shows the previous, as most calendar apps do: the page is
|
|
7
|
+
* dragged along with the finger, and what was to its right comes in.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SWIPE_PERIOD_SHIFT: Readonly<Record<SwipeDirection, 1 | -1>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a horizontal swipe on the phone layout's calendar does, as the direction the visible period moves: `-1` is the previous
|
|
3
|
+
* month/week/day, `1` the next. This is the one place that mapping lives, so it flips in a single line.
|
|
4
|
+
*
|
|
5
|
+
* Swiping left (finger right to left) shows the next period and swiping right shows the previous, as most calendar apps do: the page is
|
|
6
|
+
* dragged along with the finger, and what was to its right comes in.
|
|
7
|
+
*/
|
|
8
|
+
export const SWIPE_PERIOD_SHIFT = { left: 1, right: -1 };
|
|
@@ -103,5 +103,5 @@ export default function ContactsSidebar({ mailboxUid, contacts, active, onSelect
|
|
|
103
103
|
// `Drawer` (see MailShell/ContactsShell for the identical pattern and the duplicate-id reasoning
|
|
104
104
|
// behind the `idPrefix`).
|
|
105
105
|
const navContent = (idPrefix) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col gap-0.5", children: [_jsx(NavItem, { label: "Your contacts", count: contacts.length, active: active.type === "all", onClick: () => handleSelect({ type: "all" }) }), _jsx(NavItem, { label: "Favorites", count: favoriteCount, active: active.type === "favorites", onClick: () => handleSelect({ type: "favorites" }) }), showDeleted && _jsx(NavItem, { label: "Deleted", active: active.type === "deleted", onClick: () => handleSelect({ type: "deleted" }) })] }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-2.5 mb-1", children: [_jsx("h2", { className: "text-xs font-bold uppercase tracking-wide text-text-muted", children: "Your contact lists" }), _jsx("button", { type: "button", onClick: () => setAddingList(true), "aria-label": "New contact list", className: "text-xs font-bold text-primary-dark hover:underline", children: "+" })] }), listsError && _jsx("p", { className: "px-2.5 text-xs text-danger", children: listsError }), _jsx("div", { className: "flex flex-col gap-0.5", children: lists.map((list) => (_jsx(NavItem, { label: list.name, count: listCounts.get(list.uid) ?? 0, active: active.type === "list" && active.uid === list.uid, onClick: () => handleSelect({ type: "list", uid: list.uid, name: list.name }) }, list.uid))) }), addingList && (_jsxs("form", { onSubmit: handleAddList, className: "flex items-center gap-1 px-2.5 mt-1", children: [_jsx("input", { type: "text", autoFocus: true, "aria-label": "New list name", id: `${idPrefix}-new-list-name`, value: newListName, onChange: (e) => setNewListName(e.target.value), className: "flex-1 text-xs py-1 px-1.5 border border-border rounded-sm bg-surface" }), _jsx("button", { type: "submit", className: "text-xs font-semibold text-primary-dark", children: "Add" })] }))] }), categories.length > 0 && (_jsxs("div", { children: [_jsx("h2", { className: "text-xs font-bold uppercase tracking-wide text-text-muted px-2.5 mb-1", children: "Categories" }), _jsx("div", { className: "flex flex-col gap-0.5", children: categories.map((name) => (_jsx(NavItem, { label: name, swatch: categoryColor(name), active: active.type === "category" && active.name === name, onClick: () => handleSelect({ type: "category", name }) }, name))) })] }))] }));
|
|
106
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "lg:hidden m-3 mb-0 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open contacts menu", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) }), _jsx("nav", { "aria-label": "Contacts", className: "hidden lg:flex w-56 shrink-0 border-r border-border flex-col gap-4 p-3 overflow-y-auto", children: navContent("desktop") }), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Contacts", children: _jsx("div", { className: "flex flex-col gap-4", children: navContent("mobile") }) })] }));
|
|
106
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "lg:hidden m-3 mb-0 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open contacts menu", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) }), _jsx("nav", { "aria-label": "Contacts", className: "hidden lg:flex w-56 shrink-0 border-r border-border flex-col gap-4 p-3 overflow-y-auto", children: navContent("desktop") }), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Contacts", fullScreen: true, children: _jsx("div", { className: "flex flex-col gap-4", children: navContent("mobile") }) })] }));
|
|
107
107
|
}
|
|
@@ -16,6 +16,8 @@ export interface ContactsToolbarProps {
|
|
|
16
16
|
onImportFile: (file: File) => void;
|
|
17
17
|
/** The keyboard's "New contact" is registered by the page: the button names its shortcut in its tooltip and `aria-keyshortcuts`. */
|
|
18
18
|
shortcuts?: boolean;
|
|
19
|
+
/** Leaves the New contact button out - the phone layout offers it as a floating button instead. */
|
|
20
|
+
hideNew?: boolean;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Contacts' Outlook-style ribbon toolbar, fitted to its column (`ResponsiveToolbar`): captions under the icons while there is room, then icons
|
|
@@ -26,4 +28,4 @@ export interface ContactsToolbarProps {
|
|
|
26
28
|
* needs. "New contact list" isn't duplicated here — `ContactsSidebar` already has its own inline
|
|
27
29
|
* "+ New list" affordance next to the "Your contact lists" heading.
|
|
28
30
|
*/
|
|
29
|
-
export default function ContactsToolbar({ selectedCount, allSelectedFavorited, onNewContact, onEdit, onDelete, onEmail, onToggleFavorite, onAddCategory, onExportVCard, onImportFile, shortcuts, }: ContactsToolbarProps): React.JSX.Element;
|
|
31
|
+
export default function ContactsToolbar({ selectedCount, allSelectedFavorited, onNewContact, onEdit, onDelete, onEmail, onToggleFavorite, onAddCategory, onExportVCard, onImportFile, shortcuts, hideNew, }: ContactsToolbarProps): React.JSX.Element;
|
|
@@ -17,7 +17,7 @@ import ResponsiveToolbar from "../layout/ResponsiveToolbar.js";
|
|
|
17
17
|
* needs. "New contact list" isn't duplicated here — `ContactsSidebar` already has its own inline
|
|
18
18
|
* "+ New list" affordance next to the "Your contact lists" heading.
|
|
19
19
|
*/
|
|
20
|
-
export default function ContactsToolbar({ selectedCount, allSelectedFavorited, onNewContact, onEdit, onDelete, onEmail, onToggleFavorite, onAddCategory, onExportVCard, onImportFile, shortcuts, }) {
|
|
20
|
+
export default function ContactsToolbar({ selectedCount, allSelectedFavorited, onNewContact, onEdit, onDelete, onEmail, onToggleFavorite, onAddCategory, onExportVCard, onImportFile, shortcuts, hideNew, }) {
|
|
21
21
|
const newContactHint = useShortcutProps("New contact", SHORTCUTS.contacts.create, !!shortcuts);
|
|
22
22
|
const importInputRef = useRef(null);
|
|
23
23
|
const hasSelection = selectedCount > 0;
|
|
@@ -29,7 +29,9 @@ export default function ContactsToolbar({ selectedCount, allSelectedFavorited, o
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const actions = [
|
|
32
|
-
|
|
32
|
+
...(hideNew
|
|
33
|
+
? []
|
|
34
|
+
: [{ id: "new", label: "New contact", icon: HiOutlineUserPlus, onClick: onNewContact, hint: shortcuts ? newContactHint : undefined, group: 0, rank: 99, essential: true }]),
|
|
33
35
|
{ id: "edit", label: "Edit", icon: HiOutlinePencil, onClick: onEdit, disabled: selectedCount !== 1, group: 1, rank: 6 },
|
|
34
36
|
{ id: "delete", label: "Delete", icon: HiOutlineTrash, onClick: onDelete, disabled: !hasSelection, group: 1, rank: 5 },
|
|
35
37
|
{ id: "email", label: "Email", icon: HiOutlineEnvelope, onClick: onEmail, disabled: !hasSelection, group: 2, rank: 4 },
|
|
@@ -13,6 +13,7 @@ import Skeleton, { SkeletonList } from "@rapidmx/react-shared/components/feedbac
|
|
|
13
13
|
import AppShell from "../../layout/AppShell.js";
|
|
14
14
|
import { useLocationSearch, useNavigate } from "../../../navigation/AppRouter.js";
|
|
15
15
|
import MailboxProvisioning from "../../layout/MailboxProvisioning.js";
|
|
16
|
+
import { orderMailboxes, primaryMailboxUid } from "../../../mail/primaryMailbox.js";
|
|
16
17
|
const ContactsShellContext = createContext({ mailboxes: [] });
|
|
17
18
|
/** Reads the mailbox/folder Contacts is currently showing, as resolved by the enclosing `ContactsShell`. */
|
|
18
19
|
export function useContactsShell() {
|
|
@@ -51,7 +52,7 @@ export default function ContactsShell({ userUid, authServerUrl, impersonating, i
|
|
|
51
52
|
}
|
|
52
53
|
listMailboxes({ limit: 100 })
|
|
53
54
|
.then((result) => {
|
|
54
|
-
setMailboxes(result);
|
|
55
|
+
setMailboxes(orderMailboxes(result, userUid));
|
|
55
56
|
setStatus("ready");
|
|
56
57
|
})
|
|
57
58
|
.catch((err) => {
|
|
@@ -60,7 +61,7 @@ export default function ContactsShell({ userUid, authServerUrl, impersonating, i
|
|
|
60
61
|
});
|
|
61
62
|
}, [userUid]);
|
|
62
63
|
const mailboxUid = (requestedMailboxUid && mailboxes.some((mb) => mb.uid === requestedMailboxUid) ? requestedMailboxUid : undefined) ??
|
|
63
|
-
mailboxes
|
|
64
|
+
primaryMailboxUid(mailboxes, userUid);
|
|
64
65
|
useEffect(() => {
|
|
65
66
|
if (!mailboxUid) {
|
|
66
67
|
setFolders([]);
|
|
@@ -100,7 +101,7 @@ export default function ContactsShell({ userUid, authServerUrl, impersonating, i
|
|
|
100
101
|
// The mailbox switcher (or an error) is all this column holds: with a single mailbox and no error there is nothing to put in it, and an empty
|
|
101
102
|
// 224 px column beside the contacts' own menu is wasted room.
|
|
102
103
|
const hasSidebar = mailboxes.length > 1 || !!folderError;
|
|
103
|
-
inner = (_jsxs(_Fragment, { children: [hasSidebar && (_jsx("aside", { className: "hidden lg:flex w-56 shrink-0 bg-surface border-r border-border flex-col p-3 gap-3", children: sidebarContent("desktop") })), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Mailbox", children: _jsx("div", { className: "flex flex-col gap-3", children: sidebarContent("mobile") }) }), _jsxs("main", { className: "flex-1 min-w-0 flex flex-col", children: [hasSidebar && (_jsx("button", { type: "button", className: "lg:hidden m-3 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open mailbox switcher", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) })), _jsx(ContactsShellContext.Provider, { value: contextValue, children: children })] })] }));
|
|
104
|
+
inner = (_jsxs(_Fragment, { children: [hasSidebar && (_jsx("aside", { className: "hidden lg:flex w-56 shrink-0 bg-surface border-r border-border flex-col p-3 gap-3", children: sidebarContent("desktop") })), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Mailbox", fullScreen: true, children: _jsx("div", { className: "flex flex-col gap-3", children: sidebarContent("mobile") }) }), _jsxs("main", { className: "flex-1 min-w-0 flex flex-col", children: [hasSidebar && (_jsx("button", { type: "button", className: "lg:hidden m-3 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open mailbox switcher", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) })), _jsx(ContactsShellContext.Provider, { value: contextValue, children: children })] })] }));
|
|
104
105
|
}
|
|
105
106
|
return (_jsx(AppShell, { active: "contacts", userUid: userUid, authServerUrl: authServerUrl, impersonating: impersonating, impersonationBaseUrl: impersonationBaseUrl, trusted: trusted, trustedRoles: trustedRoles, pluginNav: pluginNav, children: inner }));
|
|
106
107
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes } from "react";
|
|
2
|
+
import type { IconType } from "react-icons";
|
|
3
|
+
export interface FloatingActionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "aria-label" | "children" | "className" | "type"> {
|
|
4
|
+
/** The button's accessible name (it shows only the icon). */
|
|
5
|
+
label: string;
|
|
6
|
+
icon: IconType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The phone layout's primary action - "New message" in Mail, "New event" in Calendar, "New contact" in Contacts - as a small round accent button
|
|
10
|
+
* floating at the bottom right, just above the bottom tab bar (which is `h-14`, fixed). A real `<button>` named by `label`; hidden from `md` up,
|
|
11
|
+
* where each page keeps its own toolbar button. Any other button attribute (`onPointerEnter`, `onFocus`, ...) is passed through.
|
|
12
|
+
*/
|
|
13
|
+
export default function FloatingActionButton({ label, icon: Icon, ...rest }: FloatingActionButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The phone layout's primary action - "New message" in Mail, "New event" in Calendar, "New contact" in Contacts - as a small round accent button
|
|
4
|
+
* floating at the bottom right, just above the bottom tab bar (which is `h-14`, fixed). A real `<button>` named by `label`; hidden from `md` up,
|
|
5
|
+
* where each page keeps its own toolbar button. Any other button attribute (`onPointerEnter`, `onFocus`, ...) is passed through.
|
|
6
|
+
*/
|
|
7
|
+
export default function FloatingActionButton({ label, icon: Icon, ...rest }) {
|
|
8
|
+
return (_jsx("button", { ...rest, type: "button", "aria-label": label, className: "md:hidden fixed right-4 bottom-[4.5rem] z-30 w-12 h-12 flex items-center justify-center rounded-full bg-primary text-white shadow-lg hover:bg-primary-dark", children: _jsx(Icon, { size: 22, "aria-hidden": "true" }) }));
|
|
9
|
+
}
|
|
@@ -21,17 +21,20 @@ export interface UserMenuProps {
|
|
|
21
21
|
* `/settings/auto-reply`, the only settings section that exists today; repoint this at a real
|
|
22
22
|
* `/settings` landing page once a second section (Mail Filters, Signatures) makes one worth building. */
|
|
23
23
|
showSettingsLink?: boolean;
|
|
24
|
-
/** Shows the
|
|
25
|
-
* the browser hasn't been asked, "Turn on desktop notifications". Both are per browser (see `
|
|
26
|
-
* For the shells that
|
|
24
|
+
/** Shows the notification controls, above "Admin Console"/"Sign Out": a "Notifications" on/off switch for every pop-up and,
|
|
25
|
+
* while the browser hasn't been asked, "Turn on desktop notifications". Both are per browser (see `notifications/preferences.ts`
|
|
26
|
+
* and `newMailNotifications.ts`). For the shells that draw pop-ups (`AppShell`). */
|
|
27
27
|
showNotificationSettings?: boolean;
|
|
28
|
-
/** Shows a "Keyboard shortcuts" item that calls this - opening the help dialog (`?` and Ctrl+/ do too). For the shells that have the
|
|
28
|
+
/** Shows a "Keyboard shortcuts" item that calls this - opening the help dialog (`?` and Ctrl+/ do too); not on the phone layout. For the shells that have the
|
|
29
29
|
* keyboard layer (`AppChrome`); the consoles don't offer it. */
|
|
30
30
|
onShowShortcuts?: () => void;
|
|
31
31
|
/** Which way the menu opens from its button: `"down"` (the default; in a header) or `"up"` (in a footer, where there is no room below). */
|
|
32
32
|
placement?: "down" | "up";
|
|
33
33
|
/** Shows a "Recent notifications" item that calls this - opening the history of the last pop-ups (`AppChrome` only). */
|
|
34
34
|
onShowNotifications?: () => void;
|
|
35
|
+
/** Shows a "Back to mail" item, first in the menu, linking to the main application (`/`, on this same host). For the consoles
|
|
36
|
+
* (`AdminShell`), which are a step away from the app; the app itself has no need of it. */
|
|
37
|
+
showMailLink?: boolean;
|
|
35
38
|
/** Errors in that history nobody has looked at yet: a count beside the item, and a dot on the menu button. */
|
|
36
39
|
unseenErrors?: number;
|
|
37
40
|
}
|
|
@@ -40,9 +43,11 @@ export interface UserMenuProps {
|
|
|
40
43
|
* trigger that opens a dropdown showing the caller's avatar/name, an "Account" link to auth-server's account page,
|
|
41
44
|
* an optional "Settings" and "Admin Console" link, and "Sign Out". This service has no local user directory (see
|
|
42
45
|
* `.claude/NOTES.md`), so the name and avatar come from auth-server, and the displayed name (and the initials badge)
|
|
43
|
-
* falls back down a chain: the profile's name (`GET /api/profiles/me`), else the
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* falls back down a chain: the profile's name (`GET /api/profiles/me`), else the display name of the mailbox the
|
|
47
|
+
* caller owns (`listMailboxes()`, or the list the app frame already holds; a shared or delegated mailbox does not count), else the caller's username - their first
|
|
48
|
+
* verified `name` alias (`GET /api/aliases?type=name`) - else the bare uid. The mailbox and the username are asked for
|
|
49
|
+
* only when the profile gave no name, and the username only when the mailbox gave none. Every lookup can fail
|
|
50
|
+
* (auth-server's CORS list not including this origin, or no profile document at all - a 404 for some accounts) and none
|
|
51
|
+
* ever surfaces as an error. The avatar image comes from the profile alone.
|
|
47
52
|
*/
|
|
48
|
-
export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminLink, detectAdmin, trustedRoles, showSettingsLink, showNotificationSettings, onShowShortcuts, placement, onShowNotifications, unseenErrors, }: UserMenuProps): React.JSX.Element;
|
|
53
|
+
export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminLink, detectAdmin, trustedRoles, showSettingsLink, showNotificationSettings, onShowShortcuts, placement, onShowNotifications, showMailLink, unseenErrors, }: UserMenuProps): React.JSX.Element;
|
|
@@ -3,18 +3,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
4
|
// SPDX-License-Identifier: MPL-2.0
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
|
-
import
|
|
8
|
+
import useIsMobile from "@rapidmx/react-shared/util/useIsMobile.js";
|
|
9
|
+
import { HiOutlineArrowUturnLeft, HiOutlineShieldCheck } from "react-icons/hi2";
|
|
9
10
|
import { formatProfileName, getMyProfile, getMyUsername, profileInitials } from "@rapidmx/react-shared/auth/profileApi.js";
|
|
11
|
+
import { listMailboxes } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
10
12
|
import { accountUrlOf } from "../../auth/accountUrl.js";
|
|
11
13
|
import { DEFAULT_TRUSTED_ROLES, lookUpAdminAccess } from "../../auth/adminAccess.js";
|
|
12
14
|
import { ariaKeyShortcuts } from "../../keyboard/format.js";
|
|
13
15
|
import { SHORTCUTS } from "../../keyboard/keymap.js";
|
|
14
16
|
import { useKeyEnvironment } from "../../keyboard/ShortcutProvider.js";
|
|
15
|
-
import { SETTINGS_HREF } from "../../navigation/appHrefs.js";
|
|
17
|
+
import { APP_HREFS, SETTINGS_HREF } from "../../navigation/appHrefs.js";
|
|
18
|
+
import { MailConnectionContext } from "../../mail/useMailConnection.js";
|
|
19
|
+
import { ownMailboxes } from "../../mail/primaryMailbox.js";
|
|
16
20
|
import ThemeSwitch from "./ThemeSwitch.js";
|
|
17
|
-
import { desktopPermission,
|
|
21
|
+
import { desktopPermission, requestDesktopPermission, setDesktopOfferDismissed, } from "../../mail/newMailNotifications.js";
|
|
22
|
+
import { getNotificationsEnabled, setNotificationsEnabled } from "../../notifications/preferences.js";
|
|
23
|
+
import { dismissAll } from "../../notifications/store.js";
|
|
18
24
|
function Avatar({ profile, initials, large }) {
|
|
19
25
|
const sizeClass = large ? "w-10 h-10 text-base" : "w-8 h-8 text-sm";
|
|
20
26
|
if (profile?.avatar) {
|
|
@@ -27,13 +33,17 @@ function Avatar({ profile, initials, large }) {
|
|
|
27
33
|
* trigger that opens a dropdown showing the caller's avatar/name, an "Account" link to auth-server's account page,
|
|
28
34
|
* an optional "Settings" and "Admin Console" link, and "Sign Out". This service has no local user directory (see
|
|
29
35
|
* `.claude/NOTES.md`), so the name and avatar come from auth-server, and the displayed name (and the initials badge)
|
|
30
|
-
* falls back down a chain: the profile's name (`GET /api/profiles/me`), else the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
36
|
+
* falls back down a chain: the profile's name (`GET /api/profiles/me`), else the display name of the mailbox the
|
|
37
|
+
* caller owns (`listMailboxes()`, or the list the app frame already holds; a shared or delegated mailbox does not count), else the caller's username - their first
|
|
38
|
+
* verified `name` alias (`GET /api/aliases?type=name`) - else the bare uid. The mailbox and the username are asked for
|
|
39
|
+
* only when the profile gave no name, and the username only when the mailbox gave none. Every lookup can fail
|
|
40
|
+
* (auth-server's CORS list not including this origin, or no profile document at all - a 404 for some accounts) and none
|
|
41
|
+
* ever surfaces as an error. The avatar image comes from the profile alone.
|
|
34
42
|
*/
|
|
35
|
-
export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminLink, detectAdmin, trustedRoles = DEFAULT_TRUSTED_ROLES, showSettingsLink, showNotificationSettings, onShowShortcuts, placement = "down", onShowNotifications, unseenErrors = 0, }) {
|
|
43
|
+
export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminLink, detectAdmin, trustedRoles = DEFAULT_TRUSTED_ROLES, showSettingsLink, showNotificationSettings, onShowShortcuts, placement = "down", onShowNotifications, showMailLink, unseenErrors = 0, }) {
|
|
36
44
|
const env = useKeyEnvironment();
|
|
45
|
+
// A phone has no keyboard to speak of, so the shortcuts list (and the dialog it opens) has nothing to offer there.
|
|
46
|
+
const isMobile = useIsMobile();
|
|
37
47
|
const [open, setOpen] = useState(false);
|
|
38
48
|
// Where the menu sits, in window coordinates: it is drawn through a portal into `<body>` with `position: fixed`, so no ancestor's
|
|
39
49
|
// `overflow`, `z-index` or stacking context - a custom branding header's, say - can clip it or put it behind the page.
|
|
@@ -43,7 +53,14 @@ export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminL
|
|
|
43
53
|
const [popups, setPopups] = useState(true);
|
|
44
54
|
const [permission, setPermission] = useState("unsupported");
|
|
45
55
|
const [profile, setProfile] = useState(undefined);
|
|
56
|
+
// Whether the profile lookup has answered, with a profile or without: the fallback names are only worth asking for after that.
|
|
57
|
+
const [profileSettled, setProfileSettled] = useState(false);
|
|
46
58
|
const [username, setUsername] = useState(undefined);
|
|
59
|
+
// The mailboxes this menu listed itself; `null` until it has, or when it has no need to.
|
|
60
|
+
const [ownListing, setOwnListing] = useState(null);
|
|
61
|
+
// Inside the app frame the mailboxes are already listed for the whole session (see `useMailConnection()`), so they are reused, not listed again.
|
|
62
|
+
const connection = useContext(MailConnectionContext);
|
|
63
|
+
const framed = connection !== null;
|
|
47
64
|
const containerRef = useRef(null);
|
|
48
65
|
useEffect(() => {
|
|
49
66
|
if (!authServerUrl) {
|
|
@@ -56,24 +73,50 @@ export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminL
|
|
|
56
73
|
loaded = await getMyProfile(authServerUrl);
|
|
57
74
|
}
|
|
58
75
|
catch {
|
|
59
|
-
// Unreachable, blocked, or no profile document (404) - fall through to the
|
|
76
|
+
// Unreachable, blocked, or no profile document (404) - fall through to the fallback names.
|
|
60
77
|
}
|
|
61
|
-
if (cancelled) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setProfile(loaded);
|
|
65
|
-
// The username is only the fallback for a missing name - no second request when the profile has one.
|
|
66
|
-
if (!formatProfileName(loaded)) {
|
|
67
|
-
const alias = await getMyUsername(authServerUrl);
|
|
68
|
-
if (!cancelled) {
|
|
69
|
-
setUsername(alias);
|
|
70
|
-
}
|
|
78
|
+
if (!cancelled) {
|
|
79
|
+
setProfile(loaded);
|
|
80
|
+
setProfileSettled(true);
|
|
71
81
|
}
|
|
72
82
|
})();
|
|
73
83
|
return () => {
|
|
74
84
|
cancelled = true;
|
|
75
85
|
};
|
|
76
86
|
}, [authServerUrl]);
|
|
87
|
+
// The mailbox's display name and then the username are only fallbacks for a missing name - nothing more is asked when the profile has
|
|
88
|
+
// one, and no username is asked for when the mailbox has a name. Without `authServerUrl` the profile never settles, so nothing is.
|
|
89
|
+
const needsFallbackName = profileSettled && !formatProfileName(profile);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (!needsFallbackName || framed) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let cancelled = false;
|
|
95
|
+
// A failure (no mail server, no access) is just "no mailbox name" - the username is asked for next.
|
|
96
|
+
listMailboxes({ limit: 50 }).then((list) => !cancelled && setOwnListing(Array.isArray(list) ? list : []), () => !cancelled && setOwnListing([]));
|
|
97
|
+
return () => {
|
|
98
|
+
cancelled = true;
|
|
99
|
+
};
|
|
100
|
+
}, [needsFallbackName, framed]);
|
|
101
|
+
// `null` while the mailboxes are still on their way.
|
|
102
|
+
const listed = framed ? (connection.status === "checking" ? null : connection.mailboxes) : ownListing;
|
|
103
|
+
const mailboxesKnown = listed !== null;
|
|
104
|
+
// Only a mailbox the caller owns counts: a shared or delegated one carries somebody else's name.
|
|
105
|
+
const mailboxName = needsFallbackName ? ownMailboxes(listed ?? [], userUid)[0]?.displayName?.trim() || undefined : undefined;
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (!authServerUrl || !needsFallbackName || !mailboxesKnown || mailboxName) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let cancelled = false;
|
|
111
|
+
void getMyUsername(authServerUrl).then((alias) => {
|
|
112
|
+
if (!cancelled) {
|
|
113
|
+
setUsername(alias);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return () => {
|
|
117
|
+
cancelled = true;
|
|
118
|
+
};
|
|
119
|
+
}, [authServerUrl, needsFallbackName, mailboxesKnown, mailboxName]);
|
|
77
120
|
// Keyed on the joined names, not the array: a caller's fresh `["admin"]` each render must not re-ask.
|
|
78
121
|
const trustedRolesKey = JSON.stringify(trustedRoles);
|
|
79
122
|
useEffect(() => {
|
|
@@ -94,13 +137,17 @@ export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminL
|
|
|
94
137
|
// Read fresh each time the menu opens - another tab may have changed either since - and only on the client.
|
|
95
138
|
useEffect(() => {
|
|
96
139
|
if (open && showNotificationSettings) {
|
|
97
|
-
setPopups(
|
|
140
|
+
setPopups(getNotificationsEnabled());
|
|
98
141
|
setPermission(desktopPermission());
|
|
99
142
|
}
|
|
100
143
|
}, [open, showNotificationSettings]);
|
|
101
144
|
function togglePopups() {
|
|
102
|
-
|
|
145
|
+
setNotificationsEnabled(!popups);
|
|
103
146
|
setPopups(!popups);
|
|
147
|
+
if (popups) {
|
|
148
|
+
// Turned off: what is on screen goes too (it stays in "Recent notifications").
|
|
149
|
+
dismissAll();
|
|
150
|
+
}
|
|
104
151
|
}
|
|
105
152
|
async function enableDesktopNotifications() {
|
|
106
153
|
// Asked from this click, as browsers require; a "no" (or "yes") answers the first pop-up's offer as well.
|
|
@@ -151,15 +198,16 @@ export default function UserMenu({ userUid, authServerUrl, onSignOut, showAdminL
|
|
|
151
198
|
window.removeEventListener("scroll", place, true);
|
|
152
199
|
};
|
|
153
200
|
}, [open, placement]);
|
|
154
|
-
const name = formatProfileName(profile) ?? username ?? userUid;
|
|
155
|
-
|
|
201
|
+
const name = formatProfileName(profile) ?? mailboxName ?? username ?? userUid;
|
|
202
|
+
// The badge takes its letter from whichever fallback name is shown, so it never disagrees with the name beside it.
|
|
203
|
+
const initials = profileInitials(profile, userUid, mailboxName ?? username);
|
|
156
204
|
const accountUrl = accountUrlOf(authServerUrl);
|
|
157
205
|
return (_jsxs("div", { className: "relative", ref: containerRef, children: [_jsxs("button", { type: "button", onClick: () => setOpen((o) => !o), "aria-haspopup": "true", "aria-expanded": open, "aria-label": "Account menu", className: "relative flex items-center gap-1.5 rounded-pill py-1 pl-1 pr-2 hover:bg-surface-alt", children: [_jsx(Avatar, { profile: profile, initials: initials }), unseenErrors > 0 && (_jsx("span", { "data-testid": "unseen-errors-dot", "aria-hidden": "true", className: "absolute right-0.5 top-0.5 h-2.5 w-2.5 rounded-full border-2 border-surface bg-danger" })), _jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", className: `text-text-muted transition-transform ${open ? "rotate-180" : ""}`, "aria-hidden": "true", children: _jsx("path", { d: "M5 7.5L10 12.5L15 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open &&
|
|
158
206
|
anchor &&
|
|
159
|
-
createPortal(_jsxs("div", { ref: menuRef, role: "menu", style: { position: "fixed", right: anchor.right, top: anchor.top, bottom: anchor.bottom }, className: "w-60 max-w-[calc(100vw-1rem)] max-h-[calc(100vh-5rem)] overflow-y-auto bg-surface border border-border rounded-md shadow-modal py-1.5 z-[70]", children: [_jsxs("div", { className: "flex items-center gap-3 px-3.5 py-2.5 border-b border-border", children: [_jsx(Avatar, { profile: profile, initials: initials, large: true }), _jsx("span", { className: "text-sm font-semibold text-text truncate", children: name })] }), _jsx(ThemeSwitch, {}), accountUrl && (_jsx("a", { role: "menuitem", href: accountUrl, className: "block px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: "Account" })), showSettingsLink && (_jsx("a", { role: "menuitem", href: SETTINGS_HREF, className: "block px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: "Settings" })), showNotificationSettings && (_jsxs("button", { role: "menuitemcheckbox", "aria-checked": popups, type: "button", onClick: togglePopups, className: "flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: [_jsx("span", { children: "
|
|
207
|
+
createPortal(_jsxs("div", { ref: menuRef, role: "menu", style: { position: "fixed", right: anchor.right, top: anchor.top, bottom: anchor.bottom }, className: "w-60 max-w-[calc(100vw-1rem)] max-h-[calc(100vh-5rem)] overflow-y-auto bg-surface border border-border rounded-md shadow-modal py-1.5 z-[70]", children: [_jsxs("div", { className: "flex items-center gap-3 px-3.5 py-2.5 border-b border-border", children: [_jsx(Avatar, { profile: profile, initials: initials, large: true }), _jsx("span", { className: "text-sm font-semibold text-text truncate", children: name })] }), showMailLink && (_jsxs("a", { role: "menuitem", href: APP_HREFS.mail, className: "flex items-center gap-2 px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: [_jsx(HiOutlineArrowUturnLeft, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-muted" }), "Back to mail"] })), _jsx(ThemeSwitch, {}), accountUrl && (_jsx("a", { role: "menuitem", href: accountUrl, className: "block px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: "Account" })), showSettingsLink && (_jsx("a", { role: "menuitem", href: SETTINGS_HREF, className: "block px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: "Settings" })), showNotificationSettings && (_jsxs("button", { role: "menuitemcheckbox", "aria-checked": popups, type: "button", onClick: togglePopups, className: "flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: [_jsx("span", { children: "Notifications" }), _jsx("span", { className: "text-xs font-semibold text-text-muted", children: popups ? "On" : "Off" })] })), showNotificationSettings && permission === "default" && (_jsx("button", { role: "menuitem", type: "button", onClick: () => void enableDesktopNotifications(), className: "block w-full px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: "Turn on desktop notifications" })), onShowNotifications && (_jsxs("button", { role: "menuitem", type: "button", onClick: () => {
|
|
160
208
|
setOpen(false);
|
|
161
209
|
onShowNotifications();
|
|
162
|
-
}, className: "flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: [_jsx("span", { children: "Recent notifications" }), unseenErrors > 0 && (_jsxs("span", { className: "rounded-pill bg-danger px-1.5 text-xs font-bold text-white", children: [_jsx("span", { "aria-hidden": "true", children: unseenErrors }), _jsxs("span", { className: "sr-only", children: [unseenErrors, " unseen ", unseenErrors === 1 ? "error" : "errors"] })] }))] })), onShowShortcuts && (_jsx("button", { role: "menuitem", type: "button", "aria-keyshortcuts": ariaKeyShortcuts(SHORTCUTS.global.help, env), onClick: () => {
|
|
210
|
+
}, className: "flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: [_jsx("span", { children: "Recent notifications" }), unseenErrors > 0 && (_jsxs("span", { className: "rounded-pill bg-danger px-1.5 text-xs font-bold text-white", children: [_jsx("span", { "aria-hidden": "true", children: unseenErrors }), _jsxs("span", { className: "sr-only", children: [unseenErrors, " unseen ", unseenErrors === 1 ? "error" : "errors"] })] }))] })), onShowShortcuts && !isMobile && (_jsx("button", { role: "menuitem", type: "button", "aria-keyshortcuts": ariaKeyShortcuts(SHORTCUTS.global.help, env), onClick: () => {
|
|
163
211
|
setOpen(false);
|
|
164
212
|
onShowShortcuts();
|
|
165
213
|
}, className: "block w-full px-3.5 py-2 text-left text-sm text-text hover:bg-surface-alt", children: "Keyboard shortcuts" })), (showAdminLink || detectedAdmin) && (_jsxs("a", { role: "menuitem", href: "/admin", className: "flex items-center gap-2 px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: [_jsx(HiOutlineShieldCheck, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-muted" }), "Admin Console"] })), _jsx("button", { role: "menuitem", type: "button", onClick: onSignOut, className: "block w-full text-left px-3.5 py-2 text-sm text-text hover:bg-surface-alt", children: "Sign Out" })] }), document.body)] }));
|
|
@@ -17,6 +17,8 @@ export interface ConversationListProps {
|
|
|
17
17
|
* read, which this list would otherwise keep showing as unread until the thread is collapsed and
|
|
18
18
|
* expanded again. */
|
|
19
19
|
messageOverrides?: Record<string, Message>;
|
|
20
|
+
/** Called with one of a conversation's own messages carrying the answer the reader just gave to its meeting request (from that row's RSVP chip), so the caller can keep it. An answer given from the conversation's own (parent) row is kept by this list itself. */
|
|
21
|
+
onMeetingResponded?: (updated: Message) => void;
|
|
20
22
|
/** Turns each parent row into a checkbox row: select mode here ticks whole conversations, since a
|
|
21
23
|
* conversation is what this list's rows are. A child row stays a plain "open this message" button - a
|
|
22
24
|
* mixed conversation/message selection has no sensible bulk semantics (see `MailListToolbar`). */
|
|
@@ -24,6 +26,15 @@ export interface ConversationListProps {
|
|
|
24
26
|
/** The `conversationId`s currently ticked. */
|
|
25
27
|
selectedConversationIds?: Set<string>;
|
|
26
28
|
onToggleSelected?: (conversation: ConversationSummary) => void;
|
|
29
|
+
/**
|
|
30
|
+
* What swiping a parent row does on a phone: right to left archives the conversation (resolving whether it went through), left
|
|
31
|
+
* to right asks where to move it. Absent, or `enabled: false` (a desktop), rows don't follow a finger.
|
|
32
|
+
*/
|
|
33
|
+
swipe?: {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
onArchive: (conversation: ConversationSummary) => Promise<boolean>;
|
|
36
|
+
onMove: (conversation: ConversationSummary) => void;
|
|
37
|
+
};
|
|
27
38
|
/**
|
|
28
39
|
* Whether a conversation's own messages read newest first, matching the order sense the rows themselves
|
|
29
40
|
* are in ("Newest on top"). `listConversationMessages()` always answers oldest first - the order a
|
|
@@ -44,4 +55,4 @@ export interface ConversationListProps {
|
|
|
44
55
|
* nest inside a button), so expanding and opening are separately reachable by keyboard and each carries
|
|
45
56
|
* its own name.
|
|
46
57
|
*/
|
|
47
|
-
export default function ConversationList({ conversations, mailboxUid, selectedUid, onOpenMessage, messageOverrides, selectMode, selectedConversationIds, onToggleSelected, newestFirst, }: ConversationListProps): React.JSX.Element;
|
|
58
|
+
export default function ConversationList({ conversations, mailboxUid, selectedUid, onOpenMessage, messageOverrides, onMeetingResponded, selectMode, selectedConversationIds, onToggleSelected, swipe, newestFirst, }: ConversationListProps): React.JSX.Element;
|
|
@@ -11,6 +11,8 @@ import MailAddress from "./MailAddress.js";
|
|
|
11
11
|
import { EncryptedPreview, conversationLooksEncrypted } from "./reading/EncryptedPreview.js";
|
|
12
12
|
import { listConversationMessages } from "@rapidmx/react-shared/mail/conversationsApi.js";
|
|
13
13
|
import { ROW_FOCUS_CLASS, UnreadBar, UnreadLabel, dateClass, isUnread, rowClass, senderClass, subjectClass } from "./unreadStyle.js";
|
|
14
|
+
import SwipeRow from "./SwipeRow.js";
|
|
15
|
+
import InviteRowChip from "./invite/InviteRowChip.js";
|
|
14
16
|
/** Every participant as `Name <address>`, for the tooltip and the accessible text of the "+N" a crowded row folds them into. */
|
|
15
17
|
function participantList(conversation) {
|
|
16
18
|
return conversation.participants.map((participant) => formatMailAddress(participant)).join(", ");
|
|
@@ -28,11 +30,16 @@ function participantList(conversation) {
|
|
|
28
30
|
* nest inside a button), so expanding and opening are separately reachable by keyboard and each carries
|
|
29
31
|
* its own name.
|
|
30
32
|
*/
|
|
31
|
-
export default function ConversationList({ conversations, mailboxUid, selectedUid, onOpenMessage, messageOverrides, selectMode, selectedConversationIds, onToggleSelected, newestFirst, }) {
|
|
33
|
+
export default function ConversationList({ conversations, mailboxUid, selectedUid, onOpenMessage, messageOverrides, onMeetingResponded, selectMode, selectedConversationIds, onToggleSelected, swipe, newestFirst, }) {
|
|
32
34
|
const [expanded, setExpanded] = useState(new Set());
|
|
33
35
|
const [messagesById, setMessagesById] = useState({});
|
|
34
36
|
const [loadingIds, setLoadingIds] = useState(new Set());
|
|
35
37
|
const [errorsById, setErrorsById] = useState({});
|
|
38
|
+
// The answers given from a row's RSVP chip, by message uid: a row draws them at once, whichever row (the conversation's, or one of its messages) they were given from.
|
|
39
|
+
const [answers, setAnswers] = useState({});
|
|
40
|
+
function answered(updated) {
|
|
41
|
+
setAnswers((prev) => ({ ...prev, [updated.uid]: updated.meetingResponse }));
|
|
42
|
+
}
|
|
36
43
|
function toggle(conversation) {
|
|
37
44
|
const id = conversation.conversationId;
|
|
38
45
|
setExpanded((prev) => {
|
|
@@ -69,7 +76,7 @@ export default function ConversationList({ conversations, mailboxUid, selectedUi
|
|
|
69
76
|
if (conversations.length === 0) {
|
|
70
77
|
return _jsx("p", { className: "p-4 text-sm text-text-muted", children: "No conversations in this folder." });
|
|
71
78
|
}
|
|
72
|
-
return (_jsx("ul", { children: conversations.map((conversation) => {
|
|
79
|
+
return (_jsx("ul", { className: swipe?.enabled ? "overflow-x-clip" : undefined, children: conversations.map((conversation) => {
|
|
73
80
|
const id = conversation.conversationId;
|
|
74
81
|
const isExpanded = expanded.has(id);
|
|
75
82
|
const unread = conversation.unreadCount > 0;
|
|
@@ -79,10 +86,20 @@ export default function ConversationList({ conversations, mailboxUid, selectedUi
|
|
|
79
86
|
const children = loaded && newestFirst ? [...loaded].reverse() : loaded;
|
|
80
87
|
const panelId = `conversation-messages-${id}`;
|
|
81
88
|
const ticked = selectedConversationIds?.has(id) ?? false;
|
|
82
|
-
return (_jsxs("li", { children: [_jsxs("div",
|
|
89
|
+
return (_jsxs("li", { children: [_jsxs(SwipeRow, { as: "div", enabled: !!swipe?.enabled && !selectMode, onArchive: () => swipe.onArchive(conversation), onMove: () => swipe.onMove(conversation), "data-message-uid": conversation.latestMessageUid, "data-unread": unread ? "true" : undefined, className: rowClass({ unread, selected: conversation.latestMessageUid === selectedUid || ticked }, "flex items-stretch"), children: [_jsx(UnreadBar, { unread: unread }), selectMode && (_jsx("span", { className: "shrink-0 flex items-center pl-3", children: _jsx("input", { type: "checkbox", checked: ticked, onChange: () => onToggleSelected?.(conversation), "aria-label": `Select conversation: ${conversation.subject || "(no subject)"}`, className: "w-4 h-4 accent-primary" }) })), _jsx("button", { type: "button", onClick: () => toggle(conversation), "aria-expanded": isExpanded, "aria-controls": panelId, "aria-label": `${isExpanded ? "Collapse" : "Expand"} conversation: ${conversation.subject || "(no subject)"}`, className: ["shrink-0 px-2 text-text-muted hover:text-text", ROW_FOCUS_CLASS].join(" "), children: isExpanded ? (_jsx(HiChevronDown, { size: 16, "aria-hidden": "true" })) : (_jsx(HiChevronRight, { size: 16, "aria-hidden": "true" })) }), _jsxs("div", { className: "flex-1 min-w-0 flex flex-col", children: [_jsxs("button", { type: "button", "data-row-open": true, onClick: () => onOpenMessage(conversation, conversation.latestMessageUid), className: ["w-full text-left pr-4 py-3", ROW_FOCUS_CLASS].join(" "), children: [_jsx(UnreadLabel, { unread: unread }), _jsxs("div", { className: "flex items-center justify-between gap-2 text-sm", children: [_jsx(MailAddress, { recipient: conversation.participants[0] ?? conversation.latestFrom, className: ["flex-1", senderClass(unread)].join(" ") }), conversation.participants.length > 1 && (_jsxs("span", { className: "text-xs text-text-muted shrink-0 font-normal", title: participantList(conversation), children: ["+", conversation.participants.length - 1, _jsxs("span", { className: "sr-only", children: [" more: ", participantList(conversation)] })] })), _jsx("span", { className: ["text-xs shrink-0", dateClass(unread)].join(" "), children: new Date(conversation.latestDate).toLocaleDateString() })] }), _jsx("div", { className: ["text-sm truncate", subjectClass(unread)].join(" "), children: conversation.subject || "(no subject)" }), _jsx("div", { className: "text-xs text-text-muted truncate font-normal", children: conversationLooksEncrypted(conversation) ? _jsx(EncryptedPreview, {}) : conversation.latestPreview }), _jsxs("div", { className: "flex items-center gap-2 mt-1 text-xs text-text-muted font-normal", children: [conversation.messageCount > 1 && _jsxs("span", { children: [conversation.messageCount, " messages"] }), unread && conversation.messageCount > 1 && (_jsxs("span", { className: "py-0.5 px-2 rounded-pill bg-primary/15 text-primary-dark font-bold", children: [conversation.unreadCount, " unread"] })), conversation.hasAttachments && (_jsx(HiOutlinePaperClip, { size: 13, "aria-label": "Has attachments" })), conversation.flagged && (_jsx(HiOutlineFlag, { size: 13, "aria-label": "Flagged", className: "text-danger" }))] })] }), _jsx(InviteRowChip, { message: {
|
|
90
|
+
uid: conversation.latestMessageUid,
|
|
91
|
+
meetingMethod: conversation.latestMeetingMethod ?? undefined,
|
|
92
|
+
meetingResponse: answers[conversation.latestMessageUid] ??
|
|
93
|
+
messageOverrides?.[conversation.latestMessageUid]?.meetingResponse ??
|
|
94
|
+
conversation.latestMeetingResponse ??
|
|
95
|
+
undefined,
|
|
96
|
+
}, onResponded: answered, className: "mr-4" })] })] }), _jsxs("ul", { id: panelId, hidden: !isExpanded, children: [errorsById[id] && (_jsx("li", { role: "alert", className: "pl-8 pr-4 py-2 text-xs text-danger border-b border-border", children: errorsById[id] })), loadingIds.has(id) && (_jsx("li", { className: "pl-8 pr-4 py-2 text-xs text-text-muted border-b border-border", children: "Loading messages\u2026" })), children?.map((fetched) => {
|
|
83
97
|
const message = messageOverrides?.[fetched.uid] ?? fetched;
|
|
84
98
|
const messageUnread = isUnread(message);
|
|
85
|
-
return (_jsxs("li", { "data-message-uid": message.uid, "data-unread": messageUnread ? "true" : undefined, className: rowClass({ unread: messageUnread, selected: message.uid === selectedUid }), children: [_jsx(UnreadBar, { unread: messageUnread }), _jsxs("button", { type: "button", "data-row-open": true, onClick: () => onOpenMessage(conversation, message.uid), className: ["w-full text-left pl-8 pr-4 py-2", ROW_FOCUS_CLASS].join(" "), children: [_jsx(UnreadLabel, { unread: messageUnread }), _jsxs("div", { className: "flex items-center justify-between gap-2 text-sm", children: [_jsx(MailAddress, { recipient: message.from, className: senderClass(messageUnread) }), _jsx("span", { className: ["text-xs shrink-0", dateClass(messageUnread)].join(" "), children: new Date(message.receivedDate).toLocaleDateString() })] }), _jsxs("div", { className: "flex items-center gap-2 text-xs text-text-muted font-normal", children: [_jsx("span", { className: "truncate", children: message.bodyPreview || (message.encrypted ? _jsx(EncryptedPreview, {}) : null) }), message.hasAttachments && (_jsx(HiOutlinePaperClip, { size: 12, "aria-label": "Has attachments" })), message.flags.flagged && (_jsx(HiOutlineFlag, { size: 12, "aria-label": "Flagged", className: "text-danger" }))] })] })
|
|
99
|
+
return (_jsxs("li", { "data-message-uid": message.uid, "data-unread": messageUnread ? "true" : undefined, className: rowClass({ unread: messageUnread, selected: message.uid === selectedUid }), children: [_jsx(UnreadBar, { unread: messageUnread }), _jsxs("button", { type: "button", "data-row-open": true, onClick: () => onOpenMessage(conversation, message.uid), className: ["w-full text-left pl-8 pr-4 py-2", ROW_FOCUS_CLASS].join(" "), children: [_jsx(UnreadLabel, { unread: messageUnread }), _jsxs("div", { className: "flex items-center justify-between gap-2 text-sm", children: [_jsx(MailAddress, { recipient: message.from, className: senderClass(messageUnread) }), _jsx("span", { className: ["text-xs shrink-0", dateClass(messageUnread)].join(" "), children: new Date(message.receivedDate).toLocaleDateString() })] }), _jsxs("div", { className: "flex items-center gap-2 text-xs text-text-muted font-normal", children: [_jsx("span", { className: "truncate", children: message.bodyPreview || (message.encrypted ? _jsx(EncryptedPreview, {}) : null) }), message.hasAttachments && (_jsx(HiOutlinePaperClip, { size: 12, "aria-label": "Has attachments" })), message.flags.flagged && (_jsx(HiOutlineFlag, { size: 12, "aria-label": "Flagged", className: "text-danger" }))] })] }), _jsx(InviteRowChip, { message: { ...message, meetingResponse: answers[message.uid] ?? message.meetingResponse }, onResponded: (updated) => {
|
|
100
|
+
answered(updated);
|
|
101
|
+
onMeetingResponded?.(updated);
|
|
102
|
+
}, className: "ml-8 mr-4" })] }, message.uid));
|
|
86
103
|
})] })] }, id));
|
|
87
104
|
}) }));
|
|
88
105
|
}
|
|
@@ -11,8 +11,11 @@ export declare const THREAD_PAGE_SIZE = 100;
|
|
|
11
11
|
* into an unbounded run of requests. Past it the pane says so and the rest stay readable from the list.
|
|
12
12
|
*/
|
|
13
13
|
export declare const THREAD_MESSAGE_LIMIT = 500;
|
|
14
|
+
/** What the pane needs to know of a conversation up front: the thread itself is loaded by `conversationId`. The subject and
|
|
15
|
+
* count fill the header while it loads, so a caller that only has a message (the mobile route) gives its subject and a count of 1. */
|
|
16
|
+
export type ConversationThreadHead = Pick<ConversationSummary, "conversationId" | "subject" | "messageCount">;
|
|
14
17
|
export interface ConversationThreadPaneProps {
|
|
15
|
-
conversation:
|
|
18
|
+
conversation: ConversationThreadHead | null;
|
|
16
19
|
/** The mailbox the conversation was listed from - `listConversationMessages()` is mailbox-scoped. */
|
|
17
20
|
mailboxUid: string;
|
|
18
21
|
/**
|