@rapidmx/web-client 0.28.0 → 0.29.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 +3 -0
- package/apps/shared/components/admin/diagnostics/DiagnosticsManager.tsx +22 -10
- package/apps/shared/components/admin/diagnostics/InformationPanel.tsx +60 -0
- package/apps/shared/components/admin/diagnostics/SettingsTable.tsx +108 -0
- package/apps/shared/components/admin/diagnostics/diagnosticsApi.ts +25 -1
- package/apps/shared/components/calendar/CalendarSearchBox.tsx +83 -0
- package/apps/shared/components/calendar/EventMatchNav.tsx +72 -0
- package/apps/shared/components/calendar/EventModal.tsx +33 -12
- package/apps/shared/components/calendar/ListView.tsx +207 -0
- package/apps/shared/components/calendar/MonthView.tsx +14 -2
- package/apps/shared/components/calendar/SlideIn.tsx +47 -0
- package/apps/shared/components/calendar/SplitDayView.tsx +5 -0
- package/apps/shared/components/calendar/TimeGridView.tsx +23 -12
- package/apps/shared/components/calendar/activeOccurrence.ts +28 -0
- package/apps/shared/components/calendar/allDay.ts +16 -1
- package/apps/shared/components/calendar/calendarView.ts +41 -0
- package/apps/shared/components/layout/AppShell.tsx +13 -6
- package/apps/shared/components/mail/ConversationList.tsx +29 -3
- package/apps/shared/components/mail/ConversationThreadPane.tsx +15 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +117 -55
- package/apps/shared/components/mail/MessageDetailPane.tsx +3 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +193 -35
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +62 -11
- package/apps/shared/components/mail/compose/ComposeWindowPlaceholder.tsx +21 -10
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +2 -1
- package/apps/shared/components/mail/compose/quotedBody.ts +45 -2
- package/apps/shared/components/mail/labelMenu.tsx +4 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +9 -2
- package/apps/shared/components/mail/reading/MessageBody.tsx +1 -1
- package/apps/shared/components/mail/reading/bodyContent.ts +15 -13
- package/apps/shared/components/mail/reading/bodyHtml.ts +12 -7
- package/apps/shared/gestures/useEnterSlide.ts +1 -1
- package/apps/shared/keyboard/keymap.ts +2 -0
- package/apps/shared/mail/rangeSelection.ts +45 -0
- package/apps/shared/mail/rowExit.ts +39 -0
- package/apps/www/calendar/index.tsx +251 -53
- package/apps/www/index.tsx +522 -343
- package/dist/apps/shared/components/admin/diagnostics/DiagnosticsManager.d.ts +3 -3
- package/dist/apps/shared/components/admin/diagnostics/DiagnosticsManager.js +15 -9
- package/dist/apps/shared/components/admin/diagnostics/InformationPanel.d.ts +15 -0
- package/dist/apps/shared/components/admin/diagnostics/InformationPanel.js +16 -0
- package/dist/apps/shared/components/admin/diagnostics/SettingsTable.d.ts +20 -0
- package/dist/apps/shared/components/admin/diagnostics/SettingsTable.js +31 -0
- package/dist/apps/shared/components/admin/diagnostics/diagnosticsApi.d.ts +20 -1
- package/dist/apps/shared/components/admin/diagnostics/diagnosticsApi.js +7 -0
- package/dist/apps/shared/components/calendar/CalendarSearchBox.d.ts +22 -0
- package/dist/apps/shared/components/calendar/CalendarSearchBox.js +24 -0
- package/dist/apps/shared/components/calendar/EventMatchNav.d.ts +17 -0
- package/dist/apps/shared/components/calendar/EventMatchNav.js +37 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +17 -1
- package/dist/apps/shared/components/calendar/EventModal.js +13 -11
- package/dist/apps/shared/components/calendar/ListView.d.ts +30 -0
- package/dist/apps/shared/components/calendar/ListView.js +111 -0
- package/dist/apps/shared/components/calendar/MonthView.js +12 -3
- package/dist/apps/shared/components/calendar/SlideIn.d.ts +16 -0
- package/dist/apps/shared/components/calendar/SlideIn.js +32 -0
- package/dist/apps/shared/components/calendar/SplitDayView.js +5 -1
- package/dist/apps/shared/components/calendar/TimeGridView.js +11 -3
- package/dist/apps/shared/components/calendar/activeOccurrence.d.ts +15 -0
- package/dist/apps/shared/components/calendar/activeOccurrence.js +21 -0
- package/dist/apps/shared/components/calendar/allDay.d.ts +4 -0
- package/dist/apps/shared/components/calendar/allDay.js +14 -1
- package/dist/apps/shared/components/calendar/calendarView.d.ts +16 -0
- package/dist/apps/shared/components/calendar/calendarView.js +36 -0
- package/dist/apps/shared/components/layout/AppShell.js +8 -4
- package/dist/apps/shared/components/mail/ConversationList.d.ts +9 -1
- package/dist/apps/shared/components/mail/ConversationList.js +10 -2
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +9 -1
- package/dist/apps/shared/components/mail/MailSelectionBar.js +11 -4
- package/dist/apps/shared/components/mail/MessageDetailPane.js +3 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +31 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +123 -11
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +6 -1
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +37 -11
- package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.d.ts +5 -1
- package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.js +10 -6
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +2 -1
- package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +3 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.js +43 -1
- package/dist/apps/shared/components/mail/labelMenu.d.ts +3 -1
- package/dist/apps/shared/components/mail/labelMenu.js +2 -2
- package/dist/apps/shared/components/mail/layout/MailShell.js +7 -1
- package/dist/apps/shared/components/mail/reading/MessageBody.js +1 -1
- package/dist/apps/shared/components/mail/reading/bodyContent.d.ts +5 -1
- package/dist/apps/shared/components/mail/reading/bodyContent.js +11 -11
- package/dist/apps/shared/components/mail/reading/bodyHtml.d.ts +3 -2
- package/dist/apps/shared/components/mail/reading/bodyHtml.js +8 -4
- package/dist/apps/shared/gestures/useEnterSlide.d.ts +2 -0
- package/dist/apps/shared/gestures/useEnterSlide.js +1 -1
- package/dist/apps/shared/keyboard/keymap.d.ts +12 -0
- package/dist/apps/shared/keyboard/keymap.js +2 -0
- package/dist/apps/shared/mail/rangeSelection.d.ts +20 -0
- package/dist/apps/shared/mail/rangeSelection.js +34 -0
- package/dist/apps/shared/mail/rowExit.d.ts +12 -0
- package/dist/apps/shared/mail/rowExit.js +33 -0
- package/dist/apps/www/calendar/index.js +177 -18
- package/dist/apps/www/index.js +220 -65
- package/dist/lib/calendar/eventSearch.d.ts +42 -0
- package/dist/lib/calendar/eventSearch.js +152 -0
- package/dist/lib/components/navigation/BottomTabBar.d.ts +15 -3
- package/dist/lib/components/navigation/BottomTabBar.js +52 -15
- package/dist/lib/components/navigation/NavBadge.d.ts +13 -0
- package/dist/lib/components/navigation/NavBadge.js +18 -0
- package/dist/lib/mail/compose/quotedImages.d.ts +21 -0
- package/dist/lib/mail/compose/quotedImages.js +41 -0
- package/dist/lib/mail/inlineImages.d.ts +38 -0
- package/dist/lib/mail/inlineImages.js +90 -0
- package/dist/lib/mail/mailApi.d.ts +8 -1
- package/dist/lib/mail/mailApi.js +57 -5
- package/lib/calendar/eventSearch.ts +172 -0
- package/lib/components/navigation/BottomTabBar.tsx +107 -22
- package/lib/components/navigation/NavBadge.tsx +33 -0
- package/lib/mail/compose/quotedImages.ts +49 -0
- package/lib/mail/inlineImages.ts +104 -0
- package/lib/mail/mailApi.ts +64 -5
- package/package.json +1 -1
- package/apps/shared/components/admin/diagnostics/VersionsPanel.tsx +0 -36
- package/dist/apps/shared/components/admin/diagnostics/VersionsPanel.d.ts +0 -10
- package/dist/apps/shared/components/admin/diagnostics/VersionsPanel.js +0 -11
package/dist/apps/www/index.js
CHANGED
|
@@ -26,6 +26,8 @@ import MailShell, { useMailShell, } from "../shared/components/mail/layout/MailS
|
|
|
26
26
|
import MailAddress from "../shared/components/mail/MailAddress.js";
|
|
27
27
|
import OutboxRowStatus from "../shared/components/mail/OutboxRowStatus.js";
|
|
28
28
|
import { mergeFirstPage } from "../shared/mail/mergeFirstPage.js";
|
|
29
|
+
import { isToggleClick, rangeBetween, resolveAnchor } from "../shared/mail/rangeSelection.js";
|
|
30
|
+
import { ROW_EXIT_MS, canAnimateRowExit, collapseRow } from "../shared/mail/rowExit.js";
|
|
29
31
|
import { isOwnMailbox, orderMailboxes, primaryMailboxUid } from "../shared/mail/primaryMailbox.js";
|
|
30
32
|
import { listSnapshotKey, readListSnapshot, saveListScroll, writeListSnapshot } from "../shared/mail/listSnapshots.js";
|
|
31
33
|
import { setReadStateMany } from "../shared/mail/messageReadState.js";
|
|
@@ -586,6 +588,18 @@ function InboxContent({ userUid }) {
|
|
|
586
588
|
// Where the message the keyboard just removed from the list (deleted, archived, moved) was: the next Down/Up continues from that spot, so
|
|
587
589
|
// clearing an inbox from the keyboard walks down it instead of jumping back to the top. Cleared by any selection.
|
|
588
590
|
const removedAnchorRef = useRef(null);
|
|
591
|
+
// The row a Shift+click range starts from: the row last clicked or opened (a `message.uid`, or a `conversationRowKey()` in the conversation list).
|
|
592
|
+
// A Shift+click selects from here to the clicked row but leaves it where it is, so the next Shift+click re-spans from the same row, as in Explorer and
|
|
593
|
+
// Outlook; a plain click or a Ctrl+click moves it to the row clicked. Forgotten when the listing is replaced. See `resolveAnchor()`.
|
|
594
|
+
const selectionAnchorRef = useRef(null);
|
|
595
|
+
// Rows on their way out of the list (moved, deleted, archived): `message.uid`s, or `conversationRowKey()`s in the conversation list. They stay in the
|
|
596
|
+
// data while they collapse (`collapseRow()`, `ROW_EXIT_MS`), so the rows below slide up into the gap, and are dropped by `animateRowsOut()` after.
|
|
597
|
+
const [exitingKeys, setExitingKeys] = useState(new Set());
|
|
598
|
+
const exitTimersRef = useRef(new Set());
|
|
599
|
+
useEffect(() => {
|
|
600
|
+
const timers = exitTimersRef.current;
|
|
601
|
+
return () => timers.forEach(clearTimeout);
|
|
602
|
+
}, []);
|
|
589
603
|
// State (via a callback ref), not a plain ref: the sentinel mounts and unmounts as the list loads,
|
|
590
604
|
// filters, and empties, and the observer effect below must re-attach to whichever node is current.
|
|
591
605
|
const [sentinel, setSentinel] = useState(null);
|
|
@@ -840,6 +854,7 @@ function InboxContent({ userUid }) {
|
|
|
840
854
|
setSelectedUids(new Set());
|
|
841
855
|
setSelectedConversationIds(new Set());
|
|
842
856
|
setConversationMessagesById({});
|
|
857
|
+
selectionAnchorRef.current = null;
|
|
843
858
|
listedOffsetRef.current = 0;
|
|
844
859
|
compositeCursorRef.current = undefined;
|
|
845
860
|
setHasMore(false);
|
|
@@ -1225,20 +1240,16 @@ function InboxContent({ userUid }) {
|
|
|
1225
1240
|
// a listing still loading and a "load more" in flight, and for events about folders the list isn't showing - a
|
|
1226
1241
|
// conversation list, which can span folders, refreshes for any. Any failure is silent: the next tick tries again.
|
|
1227
1242
|
const liveRunRef = useRef(0);
|
|
1228
|
-
|
|
1229
|
-
|
|
1243
|
+
/**
|
|
1244
|
+
* Quietly refetches the first page of whatever is listed and folds it in (see above) - the same refresh a push event makes, which a bulk action or
|
|
1245
|
+
* a move also makes once its rows have left, so the list is brought up to date (counts, previews) without the skeleton or losing the reader's place.
|
|
1246
|
+
* `listRun` is the listing the caller means: a refresh that finds another listing on screen by the time it lands is thrown away.
|
|
1247
|
+
*/
|
|
1248
|
+
function refreshListQuietly(listRun = searchRunIdRef.current) {
|
|
1249
|
+
if (isSearching || loading || loadMoreInFlightRef.current || (!folderUid && !aggregateFolderType)) {
|
|
1230
1250
|
return;
|
|
1231
1251
|
}
|
|
1232
|
-
if (!asConversations && live.folderUids) {
|
|
1233
|
-
const shown = new Set(aggregateFolderType
|
|
1234
|
-
? mailboxFolders.flatMap((entry) => entry.folders.filter((f) => f.type === aggregateFolderType).map((f) => f.uid))
|
|
1235
|
-
: [folderUid]);
|
|
1236
|
-
if (![...live.folderUids].some((uid) => shown.has(uid))) {
|
|
1237
|
-
return;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
1252
|
// Superseded by a newer refresh, or by any reload of the list itself (which bumps the search run id).
|
|
1241
|
-
const listRun = searchRunIdRef.current;
|
|
1242
1253
|
const myRun = ++liveRunRef.current;
|
|
1243
1254
|
const isCurrent = () => searchRunIdRef.current === listRun && liveRunRef.current === myRun;
|
|
1244
1255
|
void (async () => {
|
|
@@ -1285,6 +1296,20 @@ function InboxContent({ userUid }) {
|
|
|
1285
1296
|
// Quiet by design - see above.
|
|
1286
1297
|
}
|
|
1287
1298
|
})();
|
|
1299
|
+
}
|
|
1300
|
+
useEffect(() => {
|
|
1301
|
+
if (live.tick === 0) {
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
if (!asConversations && live.folderUids) {
|
|
1305
|
+
const shown = new Set(aggregateFolderType
|
|
1306
|
+
? mailboxFolders.flatMap((entry) => entry.folders.filter((f) => f.type === aggregateFolderType).map((f) => f.uid))
|
|
1307
|
+
: [folderUid]);
|
|
1308
|
+
if (![...live.folderUids].some((uid) => shown.has(uid))) {
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
refreshListQuietly();
|
|
1288
1313
|
}, [live.tick]);
|
|
1289
1314
|
function handleSearchAllMail() {
|
|
1290
1315
|
setSearchAllMailKey(searchAllMailScope);
|
|
@@ -1535,14 +1560,61 @@ function InboxContent({ userUid }) {
|
|
|
1535
1560
|
: conversation));
|
|
1536
1561
|
}
|
|
1537
1562
|
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Takes rows out of the list without a jolt: they collapse over `ROW_EXIT_MS` (the rows below slide up into the gap - see `collapseRow()`), then
|
|
1565
|
+
* `commit()` drops them from the data. `keys` are the rows' `exitingKeys`. With nothing to animate - none of them is listed, the browser can't
|
|
1566
|
+
* animate, or the reader prefers reduced motion - `commit()` runs at once.
|
|
1567
|
+
*/
|
|
1568
|
+
function animateRowsOut(keys, commit) {
|
|
1569
|
+
if (keys.length === 0 || !canAnimateRowExit()) {
|
|
1570
|
+
commit();
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
setExitingKeys((prev) => new Set([...prev, ...keys]));
|
|
1574
|
+
const timer = setTimeout(() => {
|
|
1575
|
+
exitTimersRef.current.delete(timer);
|
|
1576
|
+
commit();
|
|
1577
|
+
setExitingKeys((prev) => {
|
|
1578
|
+
const next = new Set(prev);
|
|
1579
|
+
keys.forEach((key) => next.delete(key));
|
|
1580
|
+
return next;
|
|
1581
|
+
});
|
|
1582
|
+
}, ROW_EXIT_MS);
|
|
1583
|
+
exitTimersRef.current.add(timer);
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Takes the conversations whose every message is in `uids` out of the conversation list (animated), then quietly refreshes the list: a conversation
|
|
1587
|
+
* that keeps messages elsewhere stays, with its count and preview brought up to date by the refresh rather than by reloading the whole list.
|
|
1588
|
+
* `listRun` is the listing the caller acted on; if another is on screen by now there is nothing left to do.
|
|
1589
|
+
*/
|
|
1590
|
+
function removeListedConversations(uids, listRun = searchRunIdRef.current) {
|
|
1591
|
+
if (searchRunIdRef.current !== listRun) {
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
const leaving = new Set(conversationsRef.current.filter((c) => c.messageUids.every((uid) => uids.has(uid))).map(conversationKey));
|
|
1595
|
+
animateRowsOut([...leaving], () => {
|
|
1596
|
+
if (searchRunIdRef.current !== listRun) {
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
setConversations((prev) => prev.filter((c) => !leaving.has(conversationKey(c))));
|
|
1600
|
+
// The refresh below merges into the ref, which only catches up with the state on the next render.
|
|
1601
|
+
conversationsRef.current = conversationsRef.current.filter((c) => !leaving.has(conversationKey(c)));
|
|
1602
|
+
listedOffsetRef.current = Math.max(0, listedOffsetRef.current - leaving.size);
|
|
1603
|
+
refreshListQuietly(listRun);
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1538
1606
|
function removeListedMessages(uids) {
|
|
1539
1607
|
const selectedIndex = messagesRef.current.findIndex((m) => m.uid === selectedUid);
|
|
1540
1608
|
if (selectedUid && uids.has(selectedUid) && selectedIndex !== -1) {
|
|
1541
1609
|
removedAnchorRef.current = selectedIndex;
|
|
1542
1610
|
}
|
|
1543
|
-
setMessages((prev) => prev.filter((m) => !uids.has(m.uid)));
|
|
1544
|
-
listedOffsetRef.current = Math.max(0, listedOffsetRef.current - uids.size);
|
|
1545
1611
|
setSelectedUid((prev) => (prev && uids.has(prev) ? null : prev));
|
|
1612
|
+
if (asConversations) {
|
|
1613
|
+
removeListedConversations(uids);
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
listedOffsetRef.current = Math.max(0, listedOffsetRef.current - uids.size);
|
|
1617
|
+
animateRowsOut(messagesRef.current.filter((m) => uids.has(m.uid)).map((m) => m.uid), () => setMessages((prev) => prev.filter((m) => !uids.has(m.uid))));
|
|
1546
1618
|
}
|
|
1547
1619
|
function removeListedMessage(uid) {
|
|
1548
1620
|
removeListedMessages(new Set([uid]));
|
|
@@ -1663,6 +1735,46 @@ function InboxContent({ userUid }) {
|
|
|
1663
1735
|
setSelectedConversationIds(new Set(conversations.map(conversationKey)));
|
|
1664
1736
|
void resolveConversations(conversations);
|
|
1665
1737
|
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Shift+click: the keys from the anchor to `target` in `keys` (the list in the order it is displayed), entering select mode. The anchor is the
|
|
1740
|
+
* row last clicked or opened (`selectionAnchorRef`), else the row open in the reading pane (`openKey`), else the clicked row itself - and it is
|
|
1741
|
+
* pinned where it was, not moved to `target`, so a second Shift+click elsewhere re-spans from the same row.
|
|
1742
|
+
*/
|
|
1743
|
+
function selectRange(keys, target, openKey) {
|
|
1744
|
+
const anchor = resolveAnchor(keys, selectionAnchorRef.current, openKey);
|
|
1745
|
+
selectionAnchorRef.current = anchor ?? target;
|
|
1746
|
+
setSelectMode(true);
|
|
1747
|
+
return rangeBetween(keys, anchor, target);
|
|
1748
|
+
}
|
|
1749
|
+
/** Shift+click on a message row. Plain Shift makes the range the whole selection; Ctrl+Shift (`extend`) adds it to what is ticked already. */
|
|
1750
|
+
function selectMessageRange(message, extend) {
|
|
1751
|
+
const range = selectRange(displayedMessages.map((m) => m.uid), message.uid, selectedUid);
|
|
1752
|
+
setSelectedUids((prev) => new Set(extend ? [...prev, ...range] : range));
|
|
1753
|
+
}
|
|
1754
|
+
/** Shift+click on a conversation row: as `selectMessageRange()`, over the rows in the order they are displayed, each resolved to its messages like a ticked one. */
|
|
1755
|
+
function selectConversationRange(conversation, extend) {
|
|
1756
|
+
const keys = listedConversations.map(conversationKey);
|
|
1757
|
+
const openIndex = selectedRowIndex();
|
|
1758
|
+
const range = selectRange(keys, conversationKey(conversation), openIndex === -1 ? null : keys[openIndex]);
|
|
1759
|
+
setSelectedConversationIds((prev) => new Set(extend ? [...prev, ...range] : range));
|
|
1760
|
+
const inRange = new Set(range);
|
|
1761
|
+
void resolveConversations(listedConversations.filter((c) => inRange.has(conversationKey(c))));
|
|
1762
|
+
}
|
|
1763
|
+
/** A plain click on a conversation's checkbox: ticks (or unticks) it and makes it the anchor of the next Shift+click. */
|
|
1764
|
+
function tickConversation(conversation) {
|
|
1765
|
+
selectionAnchorRef.current = conversationKey(conversation);
|
|
1766
|
+
toggleConversationSelected(conversation);
|
|
1767
|
+
}
|
|
1768
|
+
/** A Shift, Ctrl or Cmd click on a conversation row or its checkbox (the list hands those over rather than opening or ticking the row). */
|
|
1769
|
+
function handleConversationModifierClick(conversation, modifiers) {
|
|
1770
|
+
if (modifiers.shiftKey) {
|
|
1771
|
+
selectConversationRange(conversation, isToggleClick(modifiers));
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
// Ctrl (Cmd): just this row, and select mode if the reader was not in it.
|
|
1775
|
+
setSelectMode(true);
|
|
1776
|
+
tickConversation(conversation);
|
|
1777
|
+
}
|
|
1666
1778
|
/**
|
|
1667
1779
|
* Runs one bulk action over the current selection, then either patches the affected rows in place or
|
|
1668
1780
|
* drops them (a move takes them out of the folder being listed).
|
|
@@ -1676,6 +1788,8 @@ function InboxContent({ userUid }) {
|
|
|
1676
1788
|
* names its own. Resolves whether it succeeded.
|
|
1677
1789
|
*/
|
|
1678
1790
|
async function runBulkAction(action, removesRows, chosen = selectedMessages) {
|
|
1791
|
+
// The listing this acts on: the action takes a while, and the reader may have opened another folder by the time it is done.
|
|
1792
|
+
const listRun = searchRunIdRef.current;
|
|
1679
1793
|
setBulkBusy(true);
|
|
1680
1794
|
try {
|
|
1681
1795
|
const updated = await action(chosen);
|
|
@@ -1692,11 +1806,17 @@ function InboxContent({ userUid }) {
|
|
|
1692
1806
|
}
|
|
1693
1807
|
if (asConversations) {
|
|
1694
1808
|
// A conversation row is a summary of its messages - its count, unread count, participants
|
|
1695
|
-
// and preview all move when a bulk action changes or empties part of it - so the
|
|
1696
|
-
//
|
|
1809
|
+
// and preview all move when a bulk action changes or empties part of it - so the rows that
|
|
1810
|
+
// went collapse away and the list is then refetched quietly (no skeleton, nothing forgotten)
|
|
1811
|
+
// rather than patched row by row.
|
|
1697
1812
|
setSelectedConversationIds(new Set());
|
|
1698
1813
|
setConversationMessagesById({});
|
|
1699
|
-
|
|
1814
|
+
if (removesRows) {
|
|
1815
|
+
removeListedConversations(new Set(chosen.map((m) => m.uid)), listRun);
|
|
1816
|
+
}
|
|
1817
|
+
else {
|
|
1818
|
+
refreshListQuietly(listRun);
|
|
1819
|
+
}
|
|
1700
1820
|
}
|
|
1701
1821
|
else if (removesRows) {
|
|
1702
1822
|
removeListedMessages(new Set(chosen.map((m) => m.uid)));
|
|
@@ -1799,6 +1919,7 @@ function InboxContent({ userUid }) {
|
|
|
1799
1919
|
* (those stay listed, and the reload shows what is really there). Resolves whether anything was deleted.
|
|
1800
1920
|
*/
|
|
1801
1921
|
async function purgeChosen(chosen) {
|
|
1922
|
+
const listRun = searchRunIdRef.current;
|
|
1802
1923
|
const outcome = await permanent.requestPermanentDelete(chosen);
|
|
1803
1924
|
if (!outcome) {
|
|
1804
1925
|
return false;
|
|
@@ -1806,7 +1927,7 @@ function InboxContent({ userUid }) {
|
|
|
1806
1927
|
if (asConversations) {
|
|
1807
1928
|
setSelectedConversationIds(new Set());
|
|
1808
1929
|
setConversationMessagesById({});
|
|
1809
|
-
|
|
1930
|
+
removeListedConversations(new Set(outcome.deleted.map((m) => m.uid)), listRun);
|
|
1810
1931
|
}
|
|
1811
1932
|
else {
|
|
1812
1933
|
removeListedMessages(new Set(outcome.deleted.map((m) => m.uid)));
|
|
@@ -1878,7 +1999,10 @@ function InboxContent({ userUid }) {
|
|
|
1878
1999
|
const loadMoreStatus = loadingMore ? ("Loading more\u2026") : loadMoreError ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { role: "alert", className: "text-danger", children: loadMoreError }), _jsx("button", { type: "button", onClick: () => void loadMoreRef.current(), className: "text-primary-dark hover:underline font-medium", children: "Retry" })] })) : loadMoreStalled ? (_jsx("button", { type: "button", onClick: () => void loadMoreRef.current(), className: "text-primary-dark hover:underline font-medium", children: "Load more" })) : null;
|
|
1879
2000
|
/** One message's row of the flat list - and, in search results grouped by conversation, of a group. */
|
|
1880
2001
|
function renderMessageRow(message) {
|
|
1881
|
-
|
|
2002
|
+
const exiting = exitingKeys.has(message.uid);
|
|
2003
|
+
return (_jsxs(SwipeRow, { as: "li", enabled: swipeEnabled, onArchive: () => swipeArchive([message]), onMove: () => setMoveDialog({ messages: [message] }), "data-message-uid": message.uid, "data-unread": isUnread(message) ? "true" : undefined, "data-exiting": exiting ? "true" : undefined, "aria-hidden": exiting ? "true" : undefined, inert: exiting, className: rowClass({ unread: isUnread(message), selected: message.uid === selectedUid || selectedUids.has(message.uid) }, exiting ? "flex items-stretch pointer-events-none" : "flex items-stretch"), children: [_jsx(UnreadBar, { unread: isUnread(message) }), selectMode && (_jsx("span", { className: "shrink-0 flex items-center pl-3", children: _jsx("input", { type: "checkbox", checked: selectedUids.has(message.uid),
|
|
2004
|
+
// The change of a checkbox is caused by a click (or the Space key, which makes one): its modifiers are that event's.
|
|
2005
|
+
onChange: (event) => handleSelect(message, event.nativeEvent), "aria-label": `Select ${rowSubject(message)}`, className: "w-4 h-4 accent-primary" }) })), _jsxs("div", { className: "flex-1 min-w-0 flex flex-col", children: [_jsxs("button", { type: "button", "data-row-open": true, onClick: (event) => handleSelect(message, event), className: ["w-full text-left px-4 py-3", ROW_FOCUS_CLASS].join(" "), children: [_jsx(UnreadLabel, { unread: isUnread(message) }), _jsxs("div", { className: "flex items-center justify-between gap-2 text-sm", children: [_jsx(MailAddress, { recipient: message.from, className: senderClass(isUnread(message)) }), _jsx("span", { className: ["text-xs shrink-0", dateClass(isUnread(message))].join(" "), children: new Date(message.receivedDate).toLocaleDateString() })] }), crossMailbox && (_jsx("div", { className: "text-xs text-text-muted truncate font-normal", children: mailboxes.find((mb) => mb.uid === message.mailboxUid)?.displayName })), isSearching && pendingUids.has(message.uid) ? (_jsxs("div", { className: "flex flex-col gap-1.5 py-0.5", children: [_jsx(Skeleton, { height: "h-3.5", className: "w-2/3 rounded-sm" }), _jsx(Skeleton, { height: "h-3", className: "w-full rounded-sm" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: ["text-sm truncate", subjectClass(isUnread(message))].join(" "), children: rowSubject(message) }), _jsxs("div", { className: "flex items-center gap-2 text-xs text-text-muted font-normal", children: [_jsx("span", { className: "truncate", children: snippets[message.uid] ||
|
|
1882
2006
|
decryptedRows[message.uid]?.preview ||
|
|
1883
2007
|
message.bodyPreview ||
|
|
1884
2008
|
(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" }))] }), isOutbox && _jsx(OutboxRowStatus, { message: message })] }))] }), _jsx(InviteRowChip, { message: message, onResponded: (updated) => patchListedMessage(updated) })] })] }, message.uid));
|
|
@@ -1886,9 +2010,26 @@ function InboxContent({ userUid }) {
|
|
|
1886
2010
|
/** Search results arranged by conversation: the messages that matched, grouped under the conversation each belongs to, in the order of the
|
|
1887
2011
|
* first match of each - the order the results are ranked in. `null` when the list is not showing grouped results. */
|
|
1888
2012
|
const resultGroups = groupedResults ? groupByConversation(messages) : null;
|
|
2013
|
+
/** The messages in the order the list shows them - grouped results are listed group by group - which is the order a Shift+click range runs in. */
|
|
2014
|
+
const displayedMessages = resultGroups ? resultGroups.flatMap((group) => group.messages) : messages;
|
|
1889
2015
|
/** The search box: in the list on a desktop (flat lists only), in the shell's header beside the folders button on a phone. */
|
|
1890
2016
|
const searchField = (_jsx("input", { ref: searchInputRef, type: "search", value: searchInput, onChange: (e) => setSearchInput(e.target.value), placeholder: "Search all mail\u2026", "aria-label": "Search all mail", className: ["w-full text-sm px-3 rounded-md border border-border bg-surface", isMobile ? "py-2" : "py-1.5"].join(" ") }));
|
|
1891
|
-
|
|
2017
|
+
/**
|
|
2018
|
+
* A click on a message row (or its checkbox), or the keyboard moving the selection to it (no `modifiers`). Shift+click selects the range from the
|
|
2019
|
+
* anchor; Ctrl/Cmd+click toggles just this row, entering select mode if needed (Ctrl+Shift adds the range to the selection instead of replacing it);
|
|
2020
|
+
* a plain click ticks the row in select mode and opens it otherwise.
|
|
2021
|
+
*/
|
|
2022
|
+
function handleSelect(message, modifiers) {
|
|
2023
|
+
if (modifiers?.shiftKey) {
|
|
2024
|
+
selectMessageRange(message, isToggleClick(modifiers));
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
selectionAnchorRef.current = message.uid;
|
|
2028
|
+
if (isToggleClick(modifiers)) {
|
|
2029
|
+
setSelectMode(true);
|
|
2030
|
+
toggleSelected(message.uid);
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
1892
2033
|
if (selectMode) {
|
|
1893
2034
|
toggleSelected(message.uid);
|
|
1894
2035
|
return;
|
|
@@ -1924,6 +2065,7 @@ function InboxContent({ userUid }) {
|
|
|
1924
2065
|
/** Opens a conversation in the reading pane, positioned at one of its messages: the one a child row
|
|
1925
2066
|
* stands for, or the latest for a parent row. The thread pane loads the thread itself. */
|
|
1926
2067
|
function handleOpenConversation(conversation, uid) {
|
|
2068
|
+
selectionAnchorRef.current = conversationKey(conversation);
|
|
1927
2069
|
if (selectMode) {
|
|
1928
2070
|
// Same rule as `handleSelect()` for a message row: while selecting, a row's own button ticks
|
|
1929
2071
|
// the row rather than opening it.
|
|
@@ -1950,7 +2092,14 @@ function InboxContent({ userUid }) {
|
|
|
1950
2092
|
/** What the keyboard acts on exists: the ticked rows in select mode, else the message (or conversation) open in the reading pane. */
|
|
1951
2093
|
const keyboardTargetExists = selectMode ? selectedMessages.length > 0 : threadPane ? openThread !== null : selected !== null;
|
|
1952
2094
|
const rowCount = inConversations ? listedConversations.length : messages.length;
|
|
1953
|
-
|
|
2095
|
+
// Not while rows are collapsing out of the list: their indexes are about to shift.
|
|
2096
|
+
const canMoveSelection = !selectMode && !isMobile && !loading && rowCount > 0 && exitingKeys.size === 0;
|
|
2097
|
+
// Starts the collapse of the rows that have just been marked as leaving (see `animateRowsOut()`).
|
|
2098
|
+
useLayoutEffect(() => {
|
|
2099
|
+
if (exitingKeys.size > 0) {
|
|
2100
|
+
scrollContainerRef.current.querySelectorAll("[data-exiting]").forEach((row) => collapseRow(row));
|
|
2101
|
+
}
|
|
2102
|
+
}, [exitingKeys]);
|
|
1954
2103
|
/** The type of a message's folder - looked for in every mailbox's, as a search over several has messages from each. */
|
|
1955
2104
|
function folderTypeOf(folderUidOfMessage) {
|
|
1956
2105
|
return mailboxFolders.flatMap((mf) => mf.folders).find((f) => f.uid === folderUidOfMessage)?.type;
|
|
@@ -2164,51 +2313,57 @@ function InboxContent({ userUid }) {
|
|
|
2164
2313
|
// indistinguishable to anything (a test, a user re-reading the screen) that catches this one.
|
|
2165
2314
|
return _jsx("p", { className: "p-8 text-sm text-text-muted", children: "Loading your mailbox\u2026" });
|
|
2166
2315
|
}
|
|
2167
|
-
return (_jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("div", {
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2316
|
+
return (_jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("div", { "data-testid": "mail-list-column", className: "w-full md:w-96 shrink-0 md:border-r border-border flex flex-col min-h-0", children: [_jsxs("div", { "data-testid": "mail-list-header", className: "shrink-0", children: [selectMode ? (_jsx(MailSelectionBar, { selected: selectedMessages, listed: messages, totals: asConversations
|
|
2317
|
+
? { selected: selectedConversationIds.size, listed: conversations.length, noun: "conversation" }
|
|
2318
|
+
: undefined, onSelectAll: () => asConversations
|
|
2319
|
+
? selectAllConversations()
|
|
2320
|
+
: setSelectedUids(new Set(messages.map((m) => m.uid))), onClearSelection: () => asConversations ? setSelectedConversationIds(new Set()) : setSelectedUids(new Set()), onCancel: leaveSelectMode, folders: foldersOf(selectionMailboxUid), currentFolderUid: folderUid, labels: mailboxLabels, mailboxUid: selectionMailboxUid, moveDisabledReason: moveDisabledReason, labelsDisabledReason: labelsDisabledReason, onLabelCreated: (label) => setMailboxLabels((prev) => [...prev, label]), onFolderCreated: onFolderCreated, onApplyLabels: applyLabelsToSelection, onSetRead: (read) => void runBulkAction(
|
|
2321
|
+
// Optimistic: the rows and the folder badges change now, and change back if the server refuses.
|
|
2322
|
+
(chosen) => setReadStateMany(chosen, read, { patch: patchListedMessage, track: trackMessageChange }), false), onSetFlagged: (flagged) => void runBulkAction((chosen) => setMessagesFlagged(chosen, flagged, client), false), shortcuts: keyboardActions, onArchive: () => void runBulkAction(bulkArchive, true), onMoveTo: async (targetFolderUid) => {
|
|
2323
|
+
await runBulkAction((chosen) => moveMessages(chosen, targetFolderUid, client), true);
|
|
2324
|
+
}, onReportJunk: () => void moveSelectionToType("junk", "Junk Email"), onDelete: () => void (deletesPermanently
|
|
2325
|
+
? purgeChosen(selectedMessages)
|
|
2326
|
+
: // A mix (search results from several folders) moves only what is not in Deleted Items yet.
|
|
2327
|
+
moveSelectionToType("deleted_items", "Deleted Items", selectedMessages.filter((m) => !inDeletedItems(m)))), deletesPermanently: deletesPermanently, busy: bulkBusy || resolvingSelection > 0 || permanent.busy })) : (_jsx(MailListToolbar, { sortBy: preferences.sortBy, sortOrder: preferences.sortOrder, filter: preferences.filter, labelUids: preferences.labelUids, labels: mailboxLabels, mailboxUid: activeMailboxUid, onLabelCreated: (label) => setMailboxLabels((prev) => [...prev, label]), onLabelUidsChange: (nextLabelUids) => updatePreferences({ labelUids: nextLabelUids }), showAsConversations: preferences.showAsConversations, onSortChange: (sortBy, sortOrder) => updatePreferences({ sortBy, sortOrder }), onFilterChange: (filter) => updatePreferences({ filter }), onShowAsConversationsChange: (showAsConversations) => updatePreferences({ showAsConversations }), selectMode: selectMode, onSelectModeChange: setSelectMode, offerClassificationFilters: offerClassificationFilters, filterDisabled: isSearching, filterDisabledReason: "Filters don't apply to search results", sortKeysDisabled: isSearching || !!aggregateFolderType,
|
|
2328
|
+
// A conversation row is a thread summary, so only some of the keys have anything to
|
|
2329
|
+
// order by - the rest stay pickable and are applied to the rows already fetched.
|
|
2330
|
+
unavailableSortKeys: asConversations ? CONVERSATION_SORT_UNAVAILABLE : undefined, sortKeysNote: isSearching
|
|
2331
|
+
? "Search results are ranked by relevance rather than sorted."
|
|
2332
|
+
: aggregateFolderType
|
|
2333
|
+
? "This view merges the newest mail from every mailbox and is always listed by date."
|
|
2334
|
+
: asConversations
|
|
2335
|
+
? CONVERSATION_SORT_NOTE
|
|
2336
|
+
: undefined, selectDisabled: loading || listedRowCount === 0, selectDisabledReason: loading ? "Wait for this folder to finish loading" : "There is nothing here to select" })), !isMobile && _jsx("div", { className: "p-2 border-b border-border", children: searchField }), isMobile && mobileSearchSlot && createPortal(searchField, mobileSearchSlot), emptiableFolder && !selectMode && (_jsx(EmptyFolderBar, { folderName: emptiableFolder.name, count: emptiableCount, disabled: !!emptyDisabledReason || permanent.busy || bulkBusy, disabledReason: emptyDisabledReason, onEmpty: () => void emptyListedFolder(emptiableFolder, emptiableCount) })), permanent.dialog, offerClassificationFilters && (_jsx("div", { className: "flex border-b border-border text-xs", children: MAIL_LIST_CLASSIFICATION_FILTERS.map(({ value, label }) => (_jsx("button", { type: "button", "aria-pressed": preferences.filter === value, onClick: () => updatePreferences({ filter: value }), className: [
|
|
2337
|
+
"flex-1 py-1.5 font-semibold",
|
|
2338
|
+
preferences.filter === value
|
|
2339
|
+
? "text-primary-dark border-b-2 border-primary-dark"
|
|
2340
|
+
: "text-text-muted",
|
|
2341
|
+
].join(" "), children: label }, value))) }))] }), _jsxs("div", { ref: scrollContainerRef, "data-testid": "mail-list-scroll",
|
|
2342
|
+
// Remembered as it moves (not when the list is left: by then React has already detached the element), so
|
|
2343
|
+
// the folder - or Mail, after another app - comes back where it was.
|
|
2344
|
+
onScroll: (event) => saveListScroll(listKey, event.currentTarget.scrollTop),
|
|
2345
|
+
// A Shift+click selects a range: without this the browser would also select the text between the two rows.
|
|
2346
|
+
onMouseDown: (event) => {
|
|
2347
|
+
if (event.shiftKey) {
|
|
2348
|
+
event.preventDefault();
|
|
2349
|
+
}
|
|
2350
|
+
}, className: "flex-1 min-h-0 overflow-y-auto", children: [isSearching && (_jsxs("div", { className: "px-4 py-1.5 text-xs text-text-muted border-b border-border flex items-center justify-between gap-2", children: [_jsxs("span", { className: "flex flex-col", children: [_jsx("span", { children: tier1Done && tier2Done && tier3Done
|
|
2351
|
+
? `${messages.length} result${messages.length === 1 ? "" : "s"}`
|
|
2352
|
+
: `${messages.length} of ??` }), crossMailbox && _jsx("span", { "data-testid": "search-scope", children: "All mailboxes" })] }), _jsxs("span", { className: "flex flex-col items-end gap-0.5", children: [tier2Done && !searchAllMail && (_jsx("button", { type: "button", onClick: handleSearchAllMail, title: crossMailbox
|
|
2353
|
+
? "Also search encrypted mail from before each mailbox's local index begins"
|
|
2354
|
+
: undefined, className: "text-primary-dark hover:underline font-medium shrink-0", children: crossMailbox ? "Search older encrypted mail" : "Search all mail" })), widenable && (_jsx("button", { type: "button", onClick: () => setSearchAllMailboxes(!searchAllMailboxes), className: "text-primary-dark hover:underline font-medium shrink-0", children: searchAllMailboxes ? "Search this mailbox only" : "Search all mailboxes" }))] })] })), crossMailbox && isSearching && searchableMailboxes.length > searchedMailboxes.length && (_jsxs("div", { role: "status", className: "px-4 py-1.5 text-xs text-text-muted border-b border-border", children: ["Searched ", searchedMailboxes.length, " of ", searchableMailboxes.length, " mailboxes - the most that are searched at once."] })), crossMailbox && isSearching && searchFailures.length > 0 && (_jsxs("div", { role: "status", className: "px-4 py-1.5 text-xs text-text-muted border-b border-border bg-surface-alt", children: ["Some results may be missing: ", describeFailures(searchFailures)] })), isSearching && !crossMailbox && coverage?.indexedFrom && (_jsxs("div", { className: "px-4 py-1.5 text-xs text-text-muted border-b border-border", children: ["Local search covers messages back to ", new Date(coverage.indexedFrom).toLocaleDateString(), coverage.building ? " (still building)" : "", searchAllMail
|
|
2355
|
+
? " - searching everything, not just recent mail."
|
|
2356
|
+
: " - older encrypted mail is still searched, just slower."] })), isSearching && crossMailbox && tier2Done && serverOnlyMailboxes.length > 0 && (_jsxs("div", { className: "px-4 py-1.5 text-xs text-text-muted border-b border-border", children: ["There is no local index on this device for ", serverOnlyMailboxes.map((mb) => mb.displayName).join(", "), ": its encrypted mail is searched through the server instead, which is slower and looks at a limited number of messages."] })), isSearching && crossMailbox && lockedSearchMailboxes.length > 0 && (_jsxs("div", { className: "px-4 py-2 border-b border-border bg-surface-alt flex flex-col gap-1", children: [unlockableSearchMailboxes.length > 0 && (_jsxs("button", { type: "button", onClick: handleUnlockSearch, className: "inline-flex items-center gap-1 text-xs font-medium text-primary-dark hover:underline", children: [_jsx(HiOutlineLockClosed, { size: 12, "aria-hidden": "true" }), "Unlock to include encrypted messages from ", unlockableSearchMailboxes.map((mb) => mb.displayName).join(", ")] })), sharedLockedSearchMailboxes.length > 0 && (_jsxs("p", { className: "text-xs text-text-muted", children: ["Encrypted messages in ", sharedLockedSearchMailboxes.map((mb) => mb.displayName).join(", "), " are not included: only the mailbox\u2019s owner can unlock them."] }))] })), isSearching && !crossMailbox && !getUnlockedKeys(mailboxUid) && (_jsx("div", { className: "px-4 py-2 border-b border-border bg-surface-alt", children: _jsxs("button", { type: "button", onClick: handleUnlockSearch, className: "inline-flex items-center gap-1 text-xs font-medium text-primary-dark hover:underline", children: [_jsx(HiOutlineLockClosed, { size: 12, "aria-hidden": "true" }), "Unlock to include encrypted messages in these results"] }) })), !isSearching && !asConversations && undecryptedEncryptedUids.length > 0 && !getUnlockedKeys(activeMailboxUid) && (_jsx("div", { className: "px-4 py-2 border-b border-border bg-surface-alt", children: _jsxs("button", { type: "button", onClick: handleUnlockList, className: "inline-flex items-center gap-1 text-xs font-medium text-primary-dark hover:underline", children: [_jsx(HiOutlineLockClosed, { size: 12, "aria-hidden": "true" }), "Unlock to show ", undecryptedEncryptedUids.length === 1 ? "an encrypted message's" : "encrypted messages'", " subject"] }) })), error && (_jsx("div", { className: "p-4", children: _jsx(Alert, { children: error }) })), loading ? (_jsxs("div", { role: "status", "aria-busy": "true", className: "p-4", children: [_jsx("span", { className: "sr-only", children: "Loading\u2026" }), _jsx(SkeletonList, { count: 8 })] })) : asConversations ? (_jsxs(_Fragment, { children: [_jsx(ConversationList, { conversations: listedConversations, newestFirst: preferences.sortBy === "date" && preferences.sortOrder === "desc", mailboxUid: activeMailboxUid, selectedUid: selectedUid, messageOverrides: conversationPatches, onMeetingResponded: patchListedMessage, onOpenMessage: handleOpenConversation, selectMode: selectMode, selectedConversationIds: selectedConversationIds, onToggleSelected: tickConversation, onSelectWithModifier: handleConversationModifierClick, exitingKeys: exitingKeys, swipe: {
|
|
2357
|
+
enabled: swipeEnabled,
|
|
2358
|
+
onArchive: swipeArchive,
|
|
2359
|
+
onMove: (conversation) => setMoveDialog({ conversation }),
|
|
2360
|
+
} }), hasMore && !rowCapReached && (_jsx("div", { ref: setSentinel, "data-testid": "load-more-sentinel", className: "p-4 text-center text-xs text-text-muted", children: loadMoreStatus })), rowCapReached && (_jsxs("p", { className: "p-4 text-center text-xs text-text-muted", children: ["Showing the most recent ", rowCap, " conversations \u2014 refine your search or filters to see more."] }))] })) : messages.length === 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "p-4 text-sm text-text-muted", children: isSearching
|
|
2361
|
+
? `No messages match "${searchQuery}".`
|
|
2362
|
+
: effectiveFilter === "all"
|
|
2363
|
+
? "No messages in this folder."
|
|
2364
|
+
: "No messages here." }), hasMore && (_jsx("div", { ref: setSentinel, "data-testid": "load-more-sentinel", className: "p-4 text-center text-xs text-text-muted", children: loadMoreStatus }))] })) : (_jsxs(_Fragment, { children: [_jsx("ul", { className: swipeEnabled ? "overflow-x-clip" : undefined, children: resultGroups
|
|
2365
|
+
? resultGroups.map((group) => (_jsxs("li", { "data-search-group": group.id, children: [_jsxs("div", { className: "px-4 py-1.5 bg-surface-alt border-b border-border text-xs text-text-muted flex items-center justify-between gap-2", children: [_jsx("span", { className: "truncate font-semibold", children: rowSubject(group.messages[0]) }), _jsxs("span", { className: "shrink-0", children: [group.messages.length, " matching message", group.messages.length === 1 ? "" : "s"] })] }), _jsx("ul", { children: group.messages.map(renderMessageRow) })] }, `${group.mailboxUid}\u0000${group.id}`)))
|
|
2366
|
+
: messages.map(renderMessageRow) }), hasMore && !rowCapReached && (_jsx("div", { ref: setSentinel, "data-testid": "load-more-sentinel", className: "p-4 text-center text-xs text-text-muted", children: loadMoreStatus })), rowCapReached && (_jsxs("p", { className: "p-4 text-center text-xs text-text-muted", children: ["Showing the most recent ", rowCap, " messages \u2014 refine your search or filters to see more."] })), aggregateFolderType && !isSearching && (_jsx("p", { className: "p-4 text-center text-xs text-text-muted", children: "Showing the most recent mail from each mailbox. Open a specific mailbox\u2019s folder to see older mail." }))] }))] })] }), _jsx("div", { className: "hidden md:flex flex-1 min-w-0 min-h-0", children: threadPane ? (_jsx(LazyConversationThreadPane, { conversation: openThread?.conversation ?? null, selectedUid: openThread?.uid ?? null, mailboxUid: labelsMailboxUid, folders: foldersOf(labelsMailboxUid), labels: labels, shortcuts: !selectMode, onMessagePatched: patchListedMessage, onMessageRemoved: (updated) => removeListedMessage(updated.uid), onLabelCreated: (label) => (otherMailbox ? setOtherMailboxLabels : setMailboxLabels)((prev) => [...prev, label]), onFolderCreated: onFolderCreated })) : (_jsx(LazyMessageDetailPane, { shortcuts: !selectMode, message: selected, attachments: attachments, isSentItems: isSentItems, onRecalled: patchListedMessage, isOutbox: isOutbox, onReceiptHandled: patchListedMessage, draftsFolderUid: draftsFolderUid, folders: folders, onMoved: (updated) => {
|
|
2212
2367
|
// Same reasoning as onArchived below - a move takes the message out of the folder
|
|
2213
2368
|
// being listed, so it leaves the list rather than being patched in place.
|
|
2214
2369
|
removeListedMessage(updated.uid);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The calendar's search: which events match what was typed, and the chronological list of their occurrences to step through. The calendar page
|
|
3
|
+
* already holds every event of the checked calendars (`listCalendarEvents()` fetches whole folders - there is no server-side text or range query
|
|
4
|
+
* to lean on), so this is entirely client-side and covers all time, not just the visible range. A series contributes the occurrences inside a window
|
|
5
|
+
* of `SEARCH_WINDOW_YEARS` either side of today, at most `SEARCH_MAX_OCCURRENCES_PER_SERIES` of them (the ones nearest today).
|
|
6
|
+
*/
|
|
7
|
+
import { CalendarEvent } from "./calendarApi.js";
|
|
8
|
+
import { CalendarOccurrence } from "./recurrence.js";
|
|
9
|
+
/** How far either side of today a recurring event's occurrences are searched. */
|
|
10
|
+
export declare const SEARCH_WINDOW_YEARS = 5;
|
|
11
|
+
/** The most occurrences one recurring event contributes (the ones nearest today), so a daily series cannot flood the results. */
|
|
12
|
+
export declare const SEARCH_MAX_OCCURRENCES_PER_SERIES = 500;
|
|
13
|
+
/** The words of `query`, folded; an event must match every one of them. Empty for a blank query. */
|
|
14
|
+
export declare function searchTerms(query: string): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Whether `event` has every one of `terms` (from `searchTerms()`) somewhere in its readable text. A busy block (`redacted`: a private event on a
|
|
17
|
+
* shared calendar) never matches - its title is a placeholder, not what the event says.
|
|
18
|
+
*/
|
|
19
|
+
export declare function eventMatchesTerms(event: CalendarEvent, terms: string[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The occurrences of the events of `events` that match `query`, in chronological order. A single event is one occurrence wherever it falls; a
|
|
22
|
+
* recurring one contributes those within `SEARCH_WINDOW_YEARS` of `now`, the `SEARCH_MAX_OCCURRENCES_PER_SERIES` nearest to it at most.
|
|
23
|
+
*/
|
|
24
|
+
export declare function searchOccurrences(events: CalendarEvent[], query: string, now?: Date): CalendarOccurrence[];
|
|
25
|
+
/** Every occurrence of every event, in chronological order, bounded the same way a search is - the calendar's List view shows these. */
|
|
26
|
+
export declare function allOccurrences(events: CalendarEvent[], now?: Date): CalendarOccurrence[];
|
|
27
|
+
/** The `occurrences` that overlap `[rangeStart, rangeEnd]` - what `expandOccurrences()` keeps, so a view shows exactly these. */
|
|
28
|
+
export declare function occurrencesInRange(occurrences: CalendarOccurrence[], rangeStart: Date, rangeEnd: Date): CalendarOccurrence[];
|
|
29
|
+
/**
|
|
30
|
+
* Which of the chronological `matches` to show first for a search: the first one inside the view (`[rangeStart, rangeEnd]`) when there is one,
|
|
31
|
+
* else the first that ends after `from` (the day being viewed), else the last (the nearest before). `-1` when there are no matches.
|
|
32
|
+
*/
|
|
33
|
+
export declare function initialMatchIndex(matches: CalendarOccurrence[], rangeStart: Date, rangeEnd: Date, from: Date): number;
|
|
34
|
+
/**
|
|
35
|
+
* The index of the occurrence one step from the current one in `sequence` (chronological), or `-1` for none. The current occurrence is found by
|
|
36
|
+
* `currentKey`; when it is not in the sequence (it was deleted or changed under an open card) the step is from where it started
|
|
37
|
+
* (`currentStart`): the first after it or the last before it, and from the first or last when that is not known either. Past either end it
|
|
38
|
+
* wraps round when `wrap`, else there is nothing there (`-1`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function stepSequenceIndex(sequence: CalendarOccurrence[], currentKey: string | null, currentStart: Date | undefined, direction: 1 | -1, wrap: boolean): number;
|
|
41
|
+
/** The index one step from `index` (`-1`: none is current) in `direction` through `count` matches, wrapping round at either end. `-1` with none. */
|
|
42
|
+
export declare function stepMatchIndex(index: number, count: number, direction: 1 | -1): number;
|