@rapidmx/web-client 0.16.0 → 0.17.2

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.
Files changed (184) hide show
  1. package/README.md +36 -28
  2. package/apps/admin/distribution-lists/new/index.tsx +3 -1
  3. package/apps/admin/domains/[uid].tsx +3 -1
  4. package/apps/admin/domains/new/index.tsx +3 -1
  5. package/apps/admin/escrow-scopes/[uid].tsx +3 -1
  6. package/apps/admin/escrow-scopes/new/index.tsx +3 -1
  7. package/apps/admin/index.tsx +3 -1
  8. package/apps/admin/mailboxes/[uid].tsx +3 -1
  9. package/apps/admin/mailboxes/new/index.tsx +3 -1
  10. package/apps/admin/transport-rules/new/index.tsx +3 -1
  11. package/apps/escrow/matters/new/index.tsx +3 -1
  12. package/apps/shared/components/admin/layout/AdminShell.tsx +4 -1
  13. package/apps/shared/components/admin/setup/SetupWizard.tsx +3 -1
  14. package/apps/shared/components/calendar/layout/CalendarShell.tsx +2 -2
  15. package/apps/shared/components/contacts/layout/ContactsShell.tsx +2 -2
  16. package/apps/shared/components/layout/AppShell.tsx +24 -43
  17. package/apps/shared/components/mail/ConversationThreadPane.tsx +1 -0
  18. package/apps/shared/components/mail/EmptyFolderBar.tsx +41 -0
  19. package/apps/shared/components/mail/MailSelectionBar.tsx +19 -15
  20. package/apps/shared/components/mail/MenuButton.tsx +31 -11
  21. package/apps/shared/components/mail/MessageDetailPane.tsx +202 -4
  22. package/apps/shared/components/mail/PermanentDeleteDialog.tsx +47 -0
  23. package/apps/shared/components/mail/layout/MailShell.tsx +36 -34
  24. package/apps/shared/components/mail/reading/MessageMoreMenu.tsx +258 -0
  25. package/apps/shared/components/mail/reading/MessageSourceDialog.tsx +79 -0
  26. package/apps/shared/components/mail/reading/messageExport.ts +59 -0
  27. package/apps/shared/components/mail/reading/printMessage.ts +99 -0
  28. package/apps/shared/components/mail/reading/useMessageActions.ts +443 -0
  29. package/apps/shared/components/settings/layout/SettingsShell.tsx +3 -2
  30. package/apps/shared/components/tasks/layout/TasksShell.tsx +2 -2
  31. package/apps/shared/keyboard/GlobalShortcuts.tsx +1 -1
  32. package/apps/shared/mail/folderOfType.ts +49 -0
  33. package/apps/shared/mail/permanentDelete.ts +160 -0
  34. package/apps/shared/mail/reportNotices.ts +66 -0
  35. package/apps/shared/mail/senderBlocking.ts +141 -0
  36. package/apps/shared/mail/useMailboxUpdateAccess.ts +60 -0
  37. package/apps/shared/mail/usePermanentDelete.tsx +160 -0
  38. package/apps/shared/navigation/frameContext.tsx +1 -1
  39. package/apps/shared/navigation/index.ts +70 -0
  40. package/apps/shared/navigation/pageTitle.ts +19 -0
  41. package/apps/www/_shell.tsx +82 -0
  42. package/apps/www/calendar/index.tsx +5 -2
  43. package/apps/www/contacts/[uid].tsx +6 -3
  44. package/apps/www/contacts/index.tsx +8 -3
  45. package/apps/www/index.tsx +146 -31
  46. package/apps/www/messages/[uid].tsx +8 -4
  47. package/apps/www/settings/appearance/index.tsx +5 -2
  48. package/apps/www/settings/auto-reply/index.tsx +5 -2
  49. package/apps/www/settings/blocked-senders/index.tsx +303 -0
  50. package/apps/www/settings/encryption/index.tsx +5 -2
  51. package/apps/www/settings/filters/[uid].tsx +5 -2
  52. package/apps/www/settings/filters/index.tsx +5 -2
  53. package/apps/www/settings/filters/new/index.tsx +30 -5
  54. package/apps/www/settings/labels/index.tsx +5 -2
  55. package/apps/www/settings/privacy/index.tsx +5 -2
  56. package/apps/www/settings/profile/index.tsx +5 -2
  57. package/apps/www/settings/read-receipts/index.tsx +5 -2
  58. package/apps/www/settings/sharing/index.tsx +5 -2
  59. package/apps/www/settings/signatures/[uid].tsx +5 -2
  60. package/apps/www/settings/signatures/index.tsx +5 -2
  61. package/apps/www/settings/signatures/new/index.tsx +6 -3
  62. package/apps/www/tasks/index.tsx +7 -2
  63. package/dist/apps/admin/distribution-lists/new/index.js +3 -1
  64. package/dist/apps/admin/domains/[uid].js +3 -1
  65. package/dist/apps/admin/domains/new/index.js +3 -1
  66. package/dist/apps/admin/escrow-scopes/[uid].js +3 -1
  67. package/dist/apps/admin/escrow-scopes/new/index.js +3 -1
  68. package/dist/apps/admin/index.js +3 -1
  69. package/dist/apps/admin/mailboxes/[uid].js +3 -1
  70. package/dist/apps/admin/mailboxes/new/index.js +3 -1
  71. package/dist/apps/admin/transport-rules/new/index.js +3 -1
  72. package/dist/apps/escrow/matters/new/index.js +3 -1
  73. package/dist/apps/shared/components/admin/layout/AdminShell.js +4 -1
  74. package/dist/apps/shared/components/admin/setup/SetupWizard.js +3 -1
  75. package/dist/apps/shared/components/calendar/layout/CalendarShell.js +2 -2
  76. package/dist/apps/shared/components/contacts/layout/ContactsShell.js +2 -2
  77. package/dist/apps/shared/components/layout/AppShell.d.ts +8 -11
  78. package/dist/apps/shared/components/layout/AppShell.js +24 -33
  79. package/dist/apps/shared/components/mail/ConversationThreadPane.js +1 -1
  80. package/dist/apps/shared/components/mail/EmptyFolderBar.d.ts +18 -0
  81. package/dist/apps/shared/components/mail/EmptyFolderBar.js +10 -0
  82. package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +9 -4
  83. package/dist/apps/shared/components/mail/MailSelectionBar.js +10 -12
  84. package/dist/apps/shared/components/mail/MenuButton.d.ts +9 -2
  85. package/dist/apps/shared/components/mail/MenuButton.js +15 -11
  86. package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +5 -0
  87. package/dist/apps/shared/components/mail/MessageDetailPane.js +147 -7
  88. package/dist/apps/shared/components/mail/PermanentDeleteDialog.d.ts +19 -0
  89. package/dist/apps/shared/components/mail/PermanentDeleteDialog.js +11 -0
  90. package/dist/apps/shared/components/mail/layout/MailShell.d.ts +13 -9
  91. package/dist/apps/shared/components/mail/layout/MailShell.js +26 -33
  92. package/dist/apps/shared/components/mail/reading/MessageMoreMenu.d.ts +56 -0
  93. package/dist/apps/shared/components/mail/reading/MessageMoreMenu.js +153 -0
  94. package/dist/apps/shared/components/mail/reading/MessageSourceDialog.d.ts +27 -0
  95. package/dist/apps/shared/components/mail/reading/MessageSourceDialog.js +27 -0
  96. package/dist/apps/shared/components/mail/reading/messageExport.d.ts +19 -0
  97. package/dist/apps/shared/components/mail/reading/messageExport.js +51 -0
  98. package/dist/apps/shared/components/mail/reading/printMessage.d.ts +30 -0
  99. package/dist/apps/shared/components/mail/reading/printMessage.js +70 -0
  100. package/dist/apps/shared/components/mail/reading/useMessageActions.d.ts +57 -0
  101. package/dist/apps/shared/components/mail/reading/useMessageActions.js +366 -0
  102. package/dist/apps/shared/components/settings/layout/SettingsShell.js +3 -2
  103. package/dist/apps/shared/components/tasks/layout/TasksShell.js +2 -2
  104. package/dist/apps/shared/keyboard/GlobalShortcuts.js +1 -1
  105. package/dist/apps/shared/mail/folderOfType.d.ts +13 -0
  106. package/dist/apps/shared/mail/folderOfType.js +40 -0
  107. package/dist/apps/shared/mail/permanentDelete.d.ts +62 -0
  108. package/dist/apps/shared/mail/permanentDelete.js +127 -0
  109. package/dist/apps/shared/mail/reportNotices.d.ts +21 -0
  110. package/dist/apps/shared/mail/reportNotices.js +47 -0
  111. package/dist/apps/shared/mail/senderBlocking.d.ts +26 -0
  112. package/dist/apps/shared/mail/senderBlocking.js +92 -0
  113. package/dist/apps/shared/mail/useMailboxUpdateAccess.d.ts +11 -0
  114. package/dist/apps/shared/mail/useMailboxUpdateAccess.js +52 -0
  115. package/dist/apps/shared/mail/usePermanentDelete.d.ts +35 -0
  116. package/dist/apps/shared/mail/usePermanentDelete.js +96 -0
  117. package/dist/apps/shared/navigation/frameContext.d.ts +1 -1
  118. package/dist/apps/shared/navigation/index.d.ts +27 -0
  119. package/dist/apps/shared/navigation/index.js +58 -0
  120. package/dist/apps/shared/navigation/pageTitle.d.ts +11 -0
  121. package/dist/apps/shared/navigation/pageTitle.js +12 -0
  122. package/dist/apps/www/_shell.d.ts +26 -0
  123. package/dist/apps/www/_shell.js +31 -0
  124. package/dist/apps/www/calendar/index.d.ts +7 -2
  125. package/dist/apps/www/calendar/index.js +4 -2
  126. package/dist/apps/www/contacts/[uid].d.ts +14 -3
  127. package/dist/apps/www/contacts/[uid].js +5 -3
  128. package/dist/apps/www/contacts/index.d.ts +7 -2
  129. package/dist/apps/www/contacts/index.js +6 -4
  130. package/dist/apps/www/index.d.ts +7 -2
  131. package/dist/apps/www/index.js +117 -19
  132. package/dist/apps/www/messages/[uid].d.ts +14 -3
  133. package/dist/apps/www/messages/[uid].js +7 -5
  134. package/dist/apps/www/settings/appearance/index.d.ts +8 -2
  135. package/dist/apps/www/settings/appearance/index.js +4 -2
  136. package/dist/apps/www/settings/auto-reply/index.d.ts +7 -2
  137. package/dist/apps/www/settings/auto-reply/index.js +4 -2
  138. package/dist/apps/www/settings/blocked-senders/index.d.ts +9 -0
  139. package/dist/apps/www/settings/blocked-senders/index.js +134 -0
  140. package/dist/apps/www/settings/encryption/index.d.ts +7 -2
  141. package/dist/apps/www/settings/encryption/index.js +4 -2
  142. package/dist/apps/www/settings/filters/[uid].d.ts +7 -2
  143. package/dist/apps/www/settings/filters/[uid].js +4 -2
  144. package/dist/apps/www/settings/filters/index.d.ts +7 -2
  145. package/dist/apps/www/settings/filters/index.js +4 -2
  146. package/dist/apps/www/settings/filters/new/index.d.ts +7 -2
  147. package/dist/apps/www/settings/filters/new/index.js +28 -5
  148. package/dist/apps/www/settings/labels/index.d.ts +7 -2
  149. package/dist/apps/www/settings/labels/index.js +4 -2
  150. package/dist/apps/www/settings/privacy/index.d.ts +7 -2
  151. package/dist/apps/www/settings/privacy/index.js +4 -2
  152. package/dist/apps/www/settings/profile/index.d.ts +7 -2
  153. package/dist/apps/www/settings/profile/index.js +4 -2
  154. package/dist/apps/www/settings/read-receipts/index.d.ts +7 -2
  155. package/dist/apps/www/settings/read-receipts/index.js +4 -2
  156. package/dist/apps/www/settings/sharing/index.d.ts +7 -2
  157. package/dist/apps/www/settings/sharing/index.js +4 -2
  158. package/dist/apps/www/settings/signatures/[uid].d.ts +7 -2
  159. package/dist/apps/www/settings/signatures/[uid].js +4 -2
  160. package/dist/apps/www/settings/signatures/index.d.ts +7 -2
  161. package/dist/apps/www/settings/signatures/index.js +4 -2
  162. package/dist/apps/www/settings/signatures/new/index.d.ts +7 -2
  163. package/dist/apps/www/settings/signatures/new/index.js +5 -3
  164. package/dist/apps/www/tasks/index.d.ts +7 -2
  165. package/dist/apps/www/tasks/index.js +5 -3
  166. package/package.json +4 -2
  167. package/apps/shared/navigation/AppRouter.tsx +0 -300
  168. package/apps/shared/navigation/idle.ts +0 -45
  169. package/apps/shared/navigation/routerContext.tsx +0 -83
  170. package/apps/shared/navigation/routes.ts +0 -72
  171. package/apps/www/_routedPage.tsx +0 -24
  172. package/apps/www/_routes.ts +0 -37
  173. package/dist/apps/shared/navigation/AppRouter.d.ts +0 -52
  174. package/dist/apps/shared/navigation/AppRouter.js +0 -242
  175. package/dist/apps/shared/navigation/idle.d.ts +0 -14
  176. package/dist/apps/shared/navigation/idle.js +0 -43
  177. package/dist/apps/shared/navigation/routerContext.d.ts +0 -37
  178. package/dist/apps/shared/navigation/routerContext.js +0 -56
  179. package/dist/apps/shared/navigation/routes.d.ts +0 -32
  180. package/dist/apps/shared/navigation/routes.js +0 -37
  181. package/dist/apps/www/_routedPage.d.ts +0 -12
  182. package/dist/apps/www/_routedPage.js +0 -19
  183. package/dist/apps/www/_routes.d.ts +0 -11
  184. package/dist/apps/www/_routes.js +0 -31
@@ -0,0 +1,303 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
+ import React, { FormEvent, useId, useRef, useState } from "react";
7
+ import { blockedSendersOf, isSharedWithMe, safeSendersOf } from "@rapidmx/react-shared/mail/mailApi.js";
8
+ import {
9
+ MAX_SENDER_LIST_ENTRIES,
10
+ SenderListKind,
11
+ SenderListsChange,
12
+ addBlockedSender,
13
+ addSafeSender,
14
+ checkSenderEntry,
15
+ removeBlockedSender,
16
+ removeSafeSender,
17
+ } from "@rapidmx/react-shared/mail/senderListsApi.js";
18
+ import SettingsShell, { SettingsShellProps, useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
19
+ import Button from "@rapidmx/react-shared/components/buttons/Button.js";
20
+ import { useMailboxUpdateAccess } from "../../../shared/mail/useMailboxUpdateAccess.js";
21
+ import { notifyApiError } from "../../../shared/notifications/apiErrors.js";
22
+
23
+ export type SettingsBlockedSendersPageProps = Omit<SettingsShellProps, "active">;
24
+
25
+ function SettingsBlockedSendersPage(props: SettingsBlockedSendersPageProps) {
26
+ return (
27
+ <SettingsShell {...props} active="blocked-senders">
28
+ <BlockedSendersContent />
29
+ </SettingsShell>
30
+ );
31
+ }
32
+
33
+ /** What each list is called and does, in the words the page uses for it. */
34
+ const COPY: Record<SenderListKind, { title: string; add: string; addLabel: string; verb: string; other: string; explain: string; empty: string }> = {
35
+ blocked: {
36
+ title: "Blocked senders",
37
+ add: "Block",
38
+ addLabel: "Add a blocked sender",
39
+ verb: "Blocked",
40
+ other: "safe senders",
41
+ explain: "Mail from these addresses and domains goes to Junk Email, without the spam filter or your filters looking at it.",
42
+ empty: "No blocked senders.",
43
+ },
44
+ safe: {
45
+ title: "Safe senders",
46
+ add: "Trust",
47
+ addLabel: "Add a safe sender",
48
+ verb: "Trusted",
49
+ other: "blocked senders",
50
+ explain:
51
+ "Mail from these addresses and domains is not sent to Junk Email because of the spam filter's verdict, as long as it passes authentication: " +
52
+ "a valid signature from the sender's own domain. Mail that fails it, carries a virus or is quarantined by policy is still kept out.",
53
+ empty: "No safe senders.",
54
+ },
55
+ };
56
+
57
+ const CAP = MAX_SENDER_LIST_ENTRIES.toLocaleString("en-US");
58
+
59
+ interface ListSectionProps {
60
+ kind: SenderListKind;
61
+ entries: string[];
62
+ /** The other list, to say when an entry moves here from it. */
63
+ otherEntries: string[];
64
+ /** The reader's own addresses: they are not blocked. */
65
+ ownAddresses: string[];
66
+ editable: boolean;
67
+ onAdd: (entry: string) => Promise<SenderListsChange | undefined>;
68
+ onRemove: (entry: string) => Promise<SenderListsChange | undefined>;
69
+ }
70
+
71
+ /** One list: its count, the form that adds an address or domain to it, and its entries with a Remove button each. */
72
+ function ListSection({ kind, entries, otherEntries, ownAddresses, editable, onAdd, onRemove }: ListSectionProps) {
73
+ const copy = COPY[kind];
74
+ const id = useId();
75
+ const headingRef = useRef<HTMLHeadingElement>(null);
76
+ const [value, setValue] = useState("");
77
+ const [error, setError] = useState<string | null>(null);
78
+ const [status, setStatus] = useState<string | null>(null);
79
+ const [busy, setBusy] = useState(false);
80
+ const full = entries.length >= MAX_SENDER_LIST_ENTRIES;
81
+ const sorted = [...entries].sort();
82
+
83
+ async function handleAdd(e: FormEvent) {
84
+ e.preventDefault();
85
+ setStatus(null);
86
+ const checked = checkSenderEntry(value);
87
+ if (!checked.ok) {
88
+ setError(checked.message);
89
+ return;
90
+ }
91
+ if (kind === "blocked" && ownAddresses.includes(checked.entry)) {
92
+ setError("That is one of your own addresses, so it cannot be blocked.");
93
+ return;
94
+ }
95
+ setError(null);
96
+ setBusy(true);
97
+ try {
98
+ const moved = otherEntries.includes(checked.entry);
99
+ const result = await onAdd(checked.entry);
100
+ if (result) {
101
+ setValue("");
102
+ setStatus(
103
+ !result.changed
104
+ ? `${checked.entry} is already on this list.`
105
+ : `${copy.verb} ${checked.entry}.${moved ? ` It was on your ${copy.other} and was moved here.` : ""}`,
106
+ );
107
+ }
108
+ } finally {
109
+ setBusy(false);
110
+ }
111
+ }
112
+
113
+ async function handleRemove(entry: string) {
114
+ setStatus(null);
115
+ setBusy(true);
116
+ try {
117
+ if (await onRemove(entry)) {
118
+ setStatus(`Removed ${entry}.`);
119
+ // The button that was pressed is gone with its entry: focus goes to the list's heading rather than back to the page's start.
120
+ headingRef.current?.focus();
121
+ }
122
+ } finally {
123
+ setBusy(false);
124
+ }
125
+ }
126
+
127
+ return (
128
+ <section aria-labelledby={`${id}-title`} className="min-w-0 rounded-md border border-border bg-surface p-4">
129
+ <h2 id={`${id}-title`} ref={headingRef} tabIndex={-1} className="text-base font-bold tracking-tight outline-none">
130
+ {copy.title}
131
+ </h2>
132
+ <p className="text-xs text-text-muted mt-0.5 mb-2">
133
+ {entries.length.toLocaleString("en-US")} of {CAP}
134
+ </p>
135
+ <p className="text-sm text-text-muted mb-3">{copy.explain}</p>
136
+
137
+ {editable && (
138
+ <form onSubmit={handleAdd} noValidate className="mb-3">
139
+ <label htmlFor={`${id}-entry`} className="block text-sm font-semibold mb-1.5 text-text">
140
+ {copy.addLabel}
141
+ </label>
142
+ <div className="flex flex-col sm:flex-row gap-2">
143
+ <input
144
+ id={`${id}-entry`}
145
+ type="text"
146
+ inputMode="email"
147
+ autoComplete="off"
148
+ autoCapitalize="none"
149
+ spellCheck={false}
150
+ value={value}
151
+ disabled={full || busy}
152
+ placeholder="name@example.com or example.com"
153
+ aria-invalid={error ? true : undefined}
154
+ aria-describedby={`${id}-hint${error ? ` ${id}-error` : ""}`}
155
+ onChange={(e) => {
156
+ setValue(e.target.value);
157
+ setError(null);
158
+ }}
159
+ className="flex-1 min-w-0 text-sm px-3 py-1.5 rounded-md border border-border bg-surface disabled:opacity-55"
160
+ />
161
+ <Button type="submit" className="!w-auto shrink-0" disabled={full || busy} loading={busy}>
162
+ {copy.add}
163
+ </Button>
164
+ </div>
165
+ <p id={`${id}-hint`} className="text-xs text-text-muted mt-1">
166
+ A domain such as example.com covers every address at it, but not its subdomains. An address already on your {copy.other} moves here.
167
+ </p>
168
+ {error && (
169
+ <p id={`${id}-error`} role="alert" className="text-sm text-danger mt-1">
170
+ {error}
171
+ </p>
172
+ )}
173
+ {full && (
174
+ <p className="text-sm text-danger mt-1">
175
+ This list is full: it holds {CAP} senders. Remove one to add another.
176
+ </p>
177
+ )}
178
+ </form>
179
+ )}
180
+
181
+ <p role="status" className="text-sm text-success font-medium mb-2 empty:hidden">
182
+ {status}
183
+ </p>
184
+
185
+ {sorted.length === 0 ? (
186
+ <p className="text-sm text-text-muted">{copy.empty}</p>
187
+ ) : (
188
+ <ul aria-label={copy.title} className="divide-y divide-border border-y border-border">
189
+ {sorted.map((entry) => (
190
+ <li key={entry} className="flex items-center justify-between gap-3 py-2">
191
+ <span className="min-w-0 break-all text-sm">
192
+ {entry}
193
+ {entry.startsWith("@") && <span className="block text-xs text-text-muted">Everyone at {entry.slice(1)}</span>}
194
+ </span>
195
+ {editable && (
196
+ <button
197
+ type="button"
198
+ disabled={busy}
199
+ aria-label={`Remove ${entry} from ${copy.title.toLowerCase()}`}
200
+ onClick={() => void handleRemove(entry)}
201
+ className="shrink-0 text-sm font-medium text-primary-dark hover:underline disabled:opacity-55"
202
+ >
203
+ Remove
204
+ </button>
205
+ )}
206
+ </li>
207
+ ))}
208
+ </ul>
209
+ )}
210
+ </section>
211
+ );
212
+ }
213
+
214
+ function BlockedSendersContent() {
215
+ const { mailboxUid } = useSettingsShell();
216
+ // A mailbox chosen in the shell's switcher is a different set of lists: the content starts over for it.
217
+ return <ListsContent key={mailboxUid} />;
218
+ }
219
+
220
+ function ListsContent() {
221
+ const { mailboxUid, mailboxes } = useSettingsShell();
222
+ // `SettingsShell` only ever renders its children once `mailboxes` has loaded and `mailboxUid` has resolved to one of them - same established
223
+ // non-null pattern as `apps/www/settings/read-receipts/index.tsx`.
224
+ const mailbox = mailboxes.find((mb) => mb.uid === mailboxUid)!;
225
+ const writable = useMailboxUpdateAccess(mailbox);
226
+ // The lists are the owner's (and a manager's) to change; the server does not say which of the two a delegate is, so one who may update is offered the
227
+ // forms and told what a refusal means.
228
+ const delegated = isSharedWithMe(mailbox);
229
+ // A server before the lists sends neither.
230
+ const supported = mailbox.blockedSenders !== undefined || mailbox.safeSenders !== undefined;
231
+ const [blocked, setBlocked] = useState(blockedSendersOf(mailbox));
232
+ const [safe, setSafe] = useState(safeSendersOf(mailbox));
233
+ const ownAddresses = mailboxes.flatMap((mb) => [mb.primarySmtpAddress, ...(mb.aliasAddresses ?? [])]).filter((a) => !!a).map((a) => a.toLowerCase());
234
+
235
+ async function change(action: () => Promise<SenderListsChange>, context: string): Promise<SenderListsChange | undefined> {
236
+ try {
237
+ const result = await action();
238
+ // The answer carries both lists as they now are: adding to one takes the entry off the other.
239
+ setBlocked(result.blockedSenders);
240
+ setSafe(result.safeSenders);
241
+ return result;
242
+ } catch (err) {
243
+ notifyApiError(err, context);
244
+ return undefined;
245
+ }
246
+ }
247
+
248
+ return (
249
+ <div className="flex-1 min-w-0 overflow-y-auto p-4 sm:p-6">
250
+ <div className="max-w-4xl">
251
+ <h1 className="text-lg font-bold tracking-tight mb-1">Blocked and safe senders</h1>
252
+ <p className="text-sm text-text-muted mb-4">
253
+ These lists belong to <span className="font-medium text-text">{mailbox.displayName}</span> ({mailbox.primarySmtpAddress}). Each entry is an email address or a domain. An
254
+ entry is on one list at a time: adding it to one takes it off the other.
255
+ </p>
256
+
257
+ {!supported ? (
258
+ <p role="status" className="text-sm text-text-muted">
259
+ This server does not support blocked and safe senders yet.
260
+ </p>
261
+ ) : (
262
+ <>
263
+ {!writable && (
264
+ <p role="status" className="text-sm rounded-md border border-border bg-surface-alt px-3 py-2 mb-4">
265
+ You have view-only access to this mailbox, so you can see these lists but not change them.
266
+ </p>
267
+ )}
268
+ {writable && delegated && (
269
+ <p className="text-sm text-text-muted mb-4">
270
+ Only this mailbox&rsquo;s owner, or someone with full access to it, can change these lists. If you cannot, the server says so when you try.
271
+ </p>
272
+ )}
273
+ <div className="grid gap-4 md:grid-cols-2">
274
+ <ListSection
275
+ kind="blocked"
276
+ entries={blocked}
277
+ otherEntries={safe}
278
+ ownAddresses={ownAddresses}
279
+ editable={writable}
280
+ onAdd={(entry) => change(() => addBlockedSender(mailbox.uid, entry), "Couldn't block this sender")}
281
+ onRemove={(entry) => change(() => removeBlockedSender(mailbox.uid, entry), "Couldn't unblock this sender")}
282
+ />
283
+ <ListSection
284
+ kind="safe"
285
+ entries={safe}
286
+ otherEntries={blocked}
287
+ ownAddresses={ownAddresses}
288
+ editable={writable}
289
+ onAdd={(entry) => change(() => addSafeSender(mailbox.uid, entry), "Couldn't add this safe sender")}
290
+ onRemove={(entry) => change(() => removeSafeSender(mailbox.uid, entry), "Couldn't remove this safe sender")}
291
+ />
292
+ </div>
293
+ </>
294
+ )}
295
+ </div>
296
+ </div>
297
+ );
298
+ }
299
+
300
+ export default SettingsBlockedSendersPage;
301
+
302
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
303
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import {
@@ -1284,4 +1284,7 @@ function EncryptionContent({ canManageKeys }: { canManageKeys: boolean }) {
1284
1284
  );
1285
1285
  }
1286
1286
 
1287
- export default routedPage("/settings/encryption", SettingsEncryptionPage);
1287
+ export default SettingsEncryptionPage;
1288
+
1289
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
1290
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import { Folder, listFolders } from "@rapidmx/react-shared/mail/mailApi.js";
@@ -173,4 +173,7 @@ function MailFilterDetailContent({ uid }: { uid: string }) {
173
173
  );
174
174
  }
175
175
 
176
- export default routedPage("/settings/filters/:uid", MailFilterDetailPage);
176
+ export default MailFilterDetailPage;
177
+
178
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
179
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import { MailFilterRule, listMailFilterRules } from "@rapidmx/react-shared/mail/mailFilterRulesApi.js";
@@ -99,4 +99,7 @@ function FiltersContent() {
99
99
  );
100
100
  }
101
101
 
102
- export default routedPage("/settings/filters", SettingsFiltersPage);
102
+ export default SettingsFiltersPage;
103
+
104
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
105
+ export const title = pageTitle("Settings");
@@ -2,8 +2,8 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../../_routedPage.js";
6
- import { useNavigate } from "../../../../shared/navigation/AppRouter.js";
5
+ import { pageTitle } from "../../../../shared/navigation/pageTitle.js";
6
+ import { useNavigate } from "../../../../shared/navigation/index.js";
7
7
  import React, { FormEvent, useEffect, useState } from "react";
8
8
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
9
9
  import { Folder, listFolders } from "@rapidmx/react-shared/mail/mailApi.js";
@@ -33,17 +33,39 @@ function NewMailFilterPage(props: NewMailFilterPageProps) {
33
33
  );
34
34
  }
35
35
 
36
+ /**
37
+ * What "Create rule" on a message (the reading pane's More actions menu) asks this page to start with: `?from=` and `?subject=` become the
38
+ * filter's "From contains" and "Subject contains" conditions, and the name says whose mail it is. The reader keeps, changes or removes them.
39
+ */
40
+ function prefillFromSearch(search: string): { name: string; conditions: MailFilterConditions } {
41
+ const params = new URLSearchParams(search);
42
+ const from = params.get("from")?.trim();
43
+ const subject = params.get("subject")?.trim();
44
+ const conditions: MailFilterConditions = {};
45
+ if (from) {
46
+ conditions.fromContains = [from];
47
+ }
48
+ if (subject) {
49
+ conditions.subjectContains = [subject];
50
+ }
51
+ return { name: from ? `Messages from ${from}` : "", conditions };
52
+ }
53
+
36
54
  function NewMailFilterForm() {
37
55
  const navigate = useNavigate();
38
56
  const { mailboxUid } = useSettingsShell();
57
+ // Read once, when the form opens, and what the reader then edits is theirs. From the browser's own location rather than the router's (which a shallow
58
+ // navigation could change under the form): this form is only mounted once the shell has fetched the mailbox, in the browser, so there is no
59
+ // server render for the two to disagree with.
60
+ const [prefill] = useState(() => prefillFromSearch(window.location.search));
39
61
  const [folders, setFolders] = useState<Folder[] | null>(null);
40
62
  const [folderError, setFolderError] = useState<string | null>(null);
41
- const [name, setName] = useState("");
63
+ const [name, setName] = useState(prefill.name);
42
64
  const [rule, setRule] = useState<RuleBuilderValue<MailFilterConditions, MailFilterAction>>({
43
65
  enabled: true,
44
66
  sequence: 0,
45
67
  stopProcessingRules: false,
46
- conditions: {},
68
+ conditions: prefill.conditions,
47
69
  actions: [],
48
70
  });
49
71
  const [error, setError] = useState<string | null>(null);
@@ -137,4 +159,7 @@ function NewMailFilterForm() {
137
159
  );
138
160
  }
139
161
 
140
- export default routedPage("/settings/filters/new", NewMailFilterPage);
162
+ export default NewMailFilterPage;
163
+
164
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
165
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import { Label, createLabel, deleteLabel, listLabels, updateLabel } from "@rapidmx/react-shared/mail/labelsApi.js";
@@ -201,4 +201,7 @@ function LabelsContent() {
201
201
  );
202
202
  }
203
203
 
204
- export default routedPage("/settings/labels", SettingsLabelsPage);
204
+ export default SettingsLabelsPage;
205
+
206
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
207
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { ChangeEvent, FormEvent, useEffect, useRef, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import {
@@ -489,4 +489,7 @@ function ErasureSection({ mailboxLabel }: { mailboxLabel: string }) {
489
489
  );
490
490
  }
491
491
 
492
- export default routedPage("/settings/privacy", SettingsPrivacyPage);
492
+ export default SettingsPrivacyPage;
493
+
494
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
495
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useMemo, useState } from "react";
7
7
  import { FreeBusyVisibility, freeBusyVisibilityOf, isSharedWithMe, updateMailbox } from "@rapidmx/react-shared/mail/mailApi.js";
8
8
  import { DEFAULT_TIME_ZONE, deviceTimeZone, timeZoneOptions } from "@rapidmx/react-shared/util/timeZone.js";
@@ -245,4 +245,7 @@ function ProfileContent() {
245
245
  );
246
246
  }
247
247
 
248
- export default routedPage("/settings/profile", SettingsProfilePage);
248
+ export default SettingsProfilePage;
249
+
250
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
251
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useState } from "react";
7
7
  import { updateMailbox } from "@rapidmx/react-shared/mail/mailApi.js";
8
8
  import SettingsShell, { SettingsShellProps, useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
@@ -144,4 +144,7 @@ function ReadReceiptsContent() {
144
144
  );
145
145
  }
146
146
 
147
- export default routedPage("/settings/read-receipts", SettingsReadReceiptsPage);
147
+ export default SettingsReadReceiptsPage;
148
+
149
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
150
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import {
@@ -253,4 +253,7 @@ function SharingContent() {
253
253
  );
254
254
  }
255
255
 
256
- export default routedPage("/settings/sharing", SettingsSharingPage);
256
+ export default SettingsSharingPage;
257
+
258
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
259
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import { MailSignature, getMailSignature, listMailSignatures, updateMailSignature } from "@rapidmx/react-shared/mail/mailSignaturesApi.js";
@@ -169,4 +169,7 @@ function SignatureDetailContent({ uid }: { uid: string }) {
169
169
  );
170
170
  }
171
171
 
172
- export default routedPage("/settings/signatures/:uid", SignatureDetailPage);
172
+ export default SignatureDetailPage;
173
+
174
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
175
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../_routedPage.js";
5
+ import { pageTitle } from "../../../shared/navigation/pageTitle.js";
6
6
  import React, { useEffect, useState } from "react";
7
7
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
8
  import { MailSignature, listMailSignatures } from "@rapidmx/react-shared/mail/mailSignaturesApi.js";
@@ -85,4 +85,7 @@ function SignaturesContent() {
85
85
  );
86
86
  }
87
87
 
88
- export default routedPage("/settings/signatures", SettingsSignaturesPage);
88
+ export default SettingsSignaturesPage;
89
+
90
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
91
+ export const title = pageTitle("Settings");
@@ -2,8 +2,8 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../../../_routedPage.js";
6
- import { useNavigate } from "../../../../shared/navigation/AppRouter.js";
5
+ import { pageTitle } from "../../../../shared/navigation/pageTitle.js";
6
+ import { useNavigate } from "../../../../shared/navigation/index.js";
7
7
  import React, { FormEvent, useState } from "react";
8
8
  import { createMailSignature, listMailSignatures } from "@rapidmx/react-shared/mail/mailSignaturesApi.js";
9
9
  import { clearPreviousDefaults } from "../signatureDefaults.js";
@@ -132,4 +132,7 @@ function NewSignatureForm() {
132
132
  );
133
133
  }
134
134
 
135
- export default routedPage("/settings/signatures/new", NewSignaturePage);
135
+ export default NewSignaturePage;
136
+
137
+ /** The tab's title: `Brand: Settings` (see `pageTitle()`). */
138
+ export const title = pageTitle("Settings");
@@ -2,7 +2,7 @@
2
2
  // Copyright (C) 2026 Jean-Philippe Steinmetz
3
3
  // SPDX-License-Identifier: MPL-2.0
4
4
  ///////////////////////////////////////////////////////////////////////////////
5
- import { routedPage } from "../_routedPage.js";
5
+ import { pageTitle } from "../../shared/navigation/pageTitle.js";
6
6
  import React, { FormEvent, useEffect, useMemo, useRef, useState } from "react";
7
7
  import { endOfWeek, isAfter, isBefore, isToday, parseISO, startOfDay } from "date-fns";
8
8
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
@@ -404,6 +404,8 @@ function TasksContent() {
404
404
  {mailboxes.find((mb) => mb.uid === addedElsewhere.mailboxUid)?.displayName ?? "another mailbox"}.{" "}
405
405
  <a
406
406
  href={`/tasks?mailboxUid=${encodeURIComponent(addedElsewhere.mailboxUid)}`}
407
+ data-router-shallow=""
408
+ data-router-prefetch="false"
407
409
  className="font-medium text-primary-dark hover:underline"
408
410
  >
409
411
  View that mailbox&rsquo;s tasks
@@ -646,4 +648,7 @@ function TaskTable({ tasks, checkedUids, onToggleChecked, onToggle, onDelete }:
646
648
  );
647
649
  }
648
650
 
649
- export default routedPage("/tasks", TasksPage);
651
+ export default TasksPage;
652
+
653
+ /** The tab's title: `Brand: Tasks` (see `pageTitle()`). */
654
+ export const title = pageTitle("Tasks");
@@ -4,6 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  // SPDX-License-Identifier: MPL-2.0
5
5
  ///////////////////////////////////////////////////////////////////////////////
6
6
  import { useState } from "react";
7
+ import { useRouter } from "@rapidrest/react/client";
7
8
  import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
8
9
  import { createDistributionList } from "@rapidmx/react-shared/admin/distributionListsApi.js";
9
10
  import AdminShell from "../../../shared/components/admin/layout/AdminShell.js";
@@ -15,6 +16,7 @@ export default function NewDistributionListPage(props) {
15
16
  return (_jsx(AdminShell, { ...props, active: "distributionLists", children: _jsx(NewDistributionListForm, {}) }));
16
17
  }
17
18
  function NewDistributionListForm() {
19
+ const { navigate } = useRouter();
18
20
  const [primarySmtpAddress, setPrimarySmtpAddress] = useState("");
19
21
  const [name, setName] = useState("");
20
22
  const [description, setDescription] = useState("");
@@ -38,7 +40,7 @@ function NewDistributionListForm() {
38
40
  name: name.trim(),
39
41
  description: description.trim() || undefined,
40
42
  });
41
- window.location.href = `/admin/distribution-lists/${encodeURIComponent(list.uid)}`;
43
+ void navigate(`/admin/distribution-lists/${encodeURIComponent(list.uid)}`);
42
44
  }
43
45
  catch (err) {
44
46
  setError(err instanceof ApiRequestError ? err.message : "Could not create the distribution list.");