@rapidmx/web-client 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/shared/components/admin/diagnostics/InformationPanel.tsx +2 -2
- package/apps/shared/components/admin/diagnostics/SettingsTable.tsx +13 -2
- package/apps/shared/components/admin/diagnostics/diagnosticsApi.ts +2 -2
- package/apps/shared/components/admin/mailboxes/MailboxTable.tsx +24 -4
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +3 -3
- package/apps/shared/components/admin/settings/PluginsManager.tsx +156 -29
- package/apps/shared/components/calendar/EventDetails.tsx +10 -0
- package/apps/shared/components/calendar/EventFormParts.tsx +10 -0
- package/apps/shared/components/calendar/MonthView.tsx +10 -4
- package/apps/shared/components/contacts/ContactCard.tsx +4 -2
- package/apps/shared/components/contacts/ContactsSidebar.tsx +8 -2
- package/apps/shared/components/contacts/ContactsToolbar.tsx +6 -0
- package/apps/shared/components/mail/ConversationThreadPane.tsx +34 -2
- package/apps/shared/components/mail/compose/ComposeContext.tsx +19 -1
- package/apps/shared/components/mail/compose/draftResume.ts +54 -0
- package/apps/www/calendar/index.tsx +4 -4
- package/apps/www/contacts/index.tsx +75 -3
- package/apps/www/tasks/index.tsx +1 -1
- package/dist/apps/shared/components/admin/diagnostics/InformationPanel.js +1 -1
- package/dist/apps/shared/components/admin/diagnostics/SettingsTable.js +3 -2
- package/dist/apps/shared/components/admin/diagnostics/diagnosticsApi.d.ts +2 -2
- package/dist/apps/shared/components/admin/mailboxes/MailboxTable.js +6 -1
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +3 -3
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +79 -8
- package/dist/apps/shared/components/calendar/EventDetails.js +2 -1
- package/dist/apps/shared/components/calendar/EventFormParts.js +2 -1
- package/dist/apps/shared/components/calendar/MonthView.d.ts +1 -1
- package/dist/apps/shared/components/calendar/MonthView.js +4 -4
- package/dist/apps/shared/components/contacts/ContactCard.js +4 -1
- package/dist/apps/shared/components/contacts/ContactsSidebar.d.ts +6 -2
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +3 -3
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +3 -1
- package/dist/apps/shared/components/contacts/ContactsToolbar.js +4 -1
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +35 -1
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +2 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +17 -1
- package/dist/apps/shared/components/mail/compose/draftResume.d.ts +10 -0
- package/dist/apps/shared/components/mail/compose/draftResume.js +48 -0
- package/dist/apps/www/calendar/index.js +4 -4
- package/dist/apps/www/contacts/index.js +63 -5
- package/dist/apps/www/tasks/index.js +1 -1
- package/dist/lib/admin/pluginsApi.d.ts +18 -0
- package/dist/lib/admin/pluginsApi.js +15 -1
- package/dist/lib/calendar/recurrence.js +1 -1
- package/dist/lib/components/overlays/overlayStack.d.ts +6 -0
- package/dist/lib/components/overlays/overlayStack.js +10 -0
- package/dist/lib/components/pickers/MiniDatePicker.d.ts +1 -1
- package/dist/lib/components/pickers/MiniDatePicker.js +4 -4
- package/dist/lib/contacts/contactsApi.d.ts +12 -0
- package/dist/lib/contacts/contactsApi.js +8 -0
- package/lib/admin/pluginsApi.ts +24 -1
- package/lib/calendar/recurrence.ts +1 -1
- package/lib/components/overlays/overlayStack.ts +11 -0
- package/lib/components/pickers/MiniDatePicker.tsx +4 -4
- package/lib/contacts/contactsApi.ts +16 -0
- package/package.json +1 -1
|
@@ -15,7 +15,8 @@ import { ENCRYPTED_SUBJECT_PLACEHOLDER, EncryptedPreview, displaySubject } from
|
|
|
15
15
|
import { useDecryptedMessages } from "../../mail/decryptedMessages.js";
|
|
16
16
|
import { CollapsedCard, SkeletonCards, SubjectCard } from "./reading/MessageCard.js";
|
|
17
17
|
import PendingMessageCard from "./reading/PendingMessageCard.js";
|
|
18
|
-
import { InlineComposeSlot, useInlineCompose } from "./compose/ComposeContext.js";
|
|
18
|
+
import { InlineComposeSlot, useCompose, useInlineCompose } from "./compose/ComposeContext.js";
|
|
19
|
+
import { resumeFromDraft } from "./compose/draftResume.js";
|
|
19
20
|
import { useMailShell } from "./layout/MailShell.js";
|
|
20
21
|
import { setReadState } from "../../mail/messageReadState.js";
|
|
21
22
|
import { adoptedOutgoing, belongsToThread, settleOutgoing, useOutgoingReplies } from "../../mail/outbox/outgoingReplies.js";
|
|
@@ -206,6 +207,11 @@ export default function ConversationThreadPane({
|
|
|
206
207
|
// The Reply / Reply all / Forward compose windows of this thread's messages, drawn as cards at the top of the list; the thread's messages are
|
|
207
208
|
// what makes the compose provider open a reply here rather than floating at the bottom right.
|
|
208
209
|
const inlineSessions = useInlineCompose(messages.map((message) => message.uid));
|
|
210
|
+
const { openCompose } = useCompose();
|
|
211
|
+
/** The draft this pane has already opened an editor for, so it is opened once per visit - closing the editor leaves the draft as a message to read. */
|
|
212
|
+
const openedDraftRef = useRef<string | null>(null);
|
|
213
|
+
const selectedUidRef = useRef(selectedUid);
|
|
214
|
+
selectedUidRef.current = selectedUid;
|
|
209
215
|
|
|
210
216
|
// Bumped on every conversation switch - an in-flight load/attachments/mark-read response carrying an
|
|
211
217
|
// older generation belongs to a superseded conversation and is dropped rather than applied.
|
|
@@ -291,6 +297,26 @@ export default function ConversationThreadPane({
|
|
|
291
297
|
setPendingFocusUid([...expanded][expanded.size - 1]);
|
|
292
298
|
}, [conversationId, selectedUid, messages]);
|
|
293
299
|
|
|
300
|
+
// A draft the reader opens is edited where it is read: its compose window opens as the card at the top of the thread, with the draft as it was
|
|
301
|
+
// saved. It is opened once per visit to the draft (an encrypted draft, which only the server holds the ciphertext of, stays a message to read).
|
|
302
|
+
useEffect(() => {
|
|
303
|
+
if (openedDraftRef.current !== null && openedDraftRef.current !== selectedUid) {
|
|
304
|
+
openedDraftRef.current = null;
|
|
305
|
+
}
|
|
306
|
+
if (loading || loadedIdRef.current !== conversationId || !selectedUid || openedDraftRef.current === selectedUid) return;
|
|
307
|
+
const draft = messages.find((message) => message.uid === selectedUid);
|
|
308
|
+
if (!draft || folders.find((folder) => folder.uid === draft.folderUid)?.type !== "drafts") return;
|
|
309
|
+
openedDraftRef.current = draft.uid;
|
|
310
|
+
void resumeFromDraft(draft, client)
|
|
311
|
+
.then((resume) => {
|
|
312
|
+
// The reader may have moved on while it loaded.
|
|
313
|
+
if (resume && selectedUidRef.current === draft.uid) {
|
|
314
|
+
openCompose({ mailboxUid: draft.mailboxUid, resume, inlineFor: draft.uid });
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
.catch(() => undefined);
|
|
318
|
+
}, [conversationId, selectedUid, messages, loading, folders]);
|
|
319
|
+
|
|
294
320
|
useLayoutEffect(() => {
|
|
295
321
|
if (!pendingFocusUid) return;
|
|
296
322
|
// The row is always rendered by now: this runs after the DOM update that added the message it
|
|
@@ -301,7 +327,9 @@ export default function ConversationThreadPane({
|
|
|
301
327
|
// took the app header and the folder rail off the screen - so the adjustment goes on whichever
|
|
302
328
|
// ancestor actually scrolls, exactly as the toggle below already does it. When that is the page
|
|
303
329
|
// itself, nothing inside the pane scrolls and the row is already in view, so it is left alone.
|
|
304
|
-
const row = rowRefs.current[pendingFocusUid]
|
|
330
|
+
const row = rowRefs.current[pendingFocusUid];
|
|
331
|
+
// None for a draft opened as the editor card (see the effect above): the card takes the view when it is placed.
|
|
332
|
+
if (!row) return;
|
|
305
333
|
const scroller = scrollingAncestor(row);
|
|
306
334
|
if (scroller !== document.documentElement) {
|
|
307
335
|
const rect = row.getBoundingClientRect();
|
|
@@ -571,6 +599,10 @@ export default function ConversationThreadPane({
|
|
|
571
599
|
))}
|
|
572
600
|
{messages.map((message) => {
|
|
573
601
|
const uid = message.uid;
|
|
602
|
+
// A draft being edited here is the editor card above, not a message to read as well.
|
|
603
|
+
if (inlineSessions.some((session) => session.draftUid === uid)) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
574
606
|
const expanded = expandedUids.has(uid);
|
|
575
607
|
const bodyId = `thread-message-${uid}`;
|
|
576
608
|
const messageUnread = isUnread(message);
|
|
@@ -198,6 +198,8 @@ export interface InlineComposeSession {
|
|
|
198
198
|
id: string;
|
|
199
199
|
/** The uid of the message the window answers. */
|
|
200
200
|
inlineFor: string;
|
|
201
|
+
/** The uid of the draft the window continues, when it was opened to edit one: the draft is then the card, not a message beside it. */
|
|
202
|
+
draftUid?: string;
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
interface InlineComposeValue {
|
|
@@ -258,6 +260,9 @@ export function useCompose(): ComposeContextValue {
|
|
|
258
260
|
*/
|
|
259
261
|
export default function ComposeProvider({ children, userUid, trusted }: PropsWithChildren<{ userUid?: string; trusted?: boolean }>) {
|
|
260
262
|
const [sessions, setSessions] = useState<ComposeSession[]>([]);
|
|
263
|
+
// The sessions as of the last render, for `openCompose()` to read at the click.
|
|
264
|
+
const sessionsRef = useRef(sessions);
|
|
265
|
+
sessionsRef.current = sessions;
|
|
261
266
|
const client = useApiClient();
|
|
262
267
|
const isMobile = useIsMobile();
|
|
263
268
|
const { Component: ComposeWindow, failed, retry: retryLoad } = useComposeWindowComponent(sessions.length > 0);
|
|
@@ -283,7 +288,7 @@ export default function ComposeProvider({ children, userUid, trusted }: PropsWit
|
|
|
283
288
|
const isInline = (session: ComposeSession) => !!session.inlineFor && !parked.has(session.id) && hosted.has(session.inlineFor);
|
|
284
289
|
const inlineKey = sessions.filter(isInline).map((session) => `${session.id}:${session.inlineFor}`).join("|");
|
|
285
290
|
const inlineSessions = useMemo<InlineComposeSession[]>(
|
|
286
|
-
() => sessions.filter(isInline).map((session) => ({ id: session.id, inlineFor: session.inlineFor
|
|
291
|
+
() => sessions.filter(isInline).map((session) => ({ id: session.id, inlineFor: session.inlineFor!, draftUid: session.resume?.draft.uid })),
|
|
287
292
|
[inlineKey],
|
|
288
293
|
);
|
|
289
294
|
const inlineValue = useMemo<InlineComposeValue>(
|
|
@@ -354,6 +359,19 @@ export default function ComposeProvider({ children, userUid, trusted }: PropsWit
|
|
|
354
359
|
resume,
|
|
355
360
|
inlineFor,
|
|
356
361
|
}: OpenComposeInput) {
|
|
362
|
+
// A draft already being edited has its window: it is brought back to the pane that was holding it rather than opened a second time.
|
|
363
|
+
const editing = resume && sessionsRef.current.find((session) => session.resume?.draft.uid === resume.draft.uid);
|
|
364
|
+
if (editing) {
|
|
365
|
+
setParked((prev) => {
|
|
366
|
+
if (!prev.has(editing.id)) {
|
|
367
|
+
return prev;
|
|
368
|
+
}
|
|
369
|
+
const next = new Set(prev);
|
|
370
|
+
next.delete(editing.id);
|
|
371
|
+
return next;
|
|
372
|
+
});
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
357
375
|
const id = crypto.randomUUID();
|
|
358
376
|
markComposePhase(id, "click");
|
|
359
377
|
// The window's own element, attached to the page from the start (it is moved to its slot or the stack as soon as that is drawn).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { type Message, type Recipient, type RecipientType, listAttachments } from "../../../../../lib/mail/mailApi.js";
|
|
6
|
+
import { formatMailAddress } from "../../../../../lib/mail/mailAddress.js";
|
|
7
|
+
import type { ApiClient } from "../../../../../lib/util/api.js";
|
|
8
|
+
import type { ResumeCompose } from "../../../mail/outbox/composeBridge.js";
|
|
9
|
+
import { loadOriginalMessage } from "./quotedBody.js";
|
|
10
|
+
|
|
11
|
+
/** The comma-separated address text a recipient field holds, for the recipients of one type. */
|
|
12
|
+
function recipientText(recipients: Recipient[], type: RecipientType): string {
|
|
13
|
+
return recipients
|
|
14
|
+
.filter((recipient) => recipient.type === type)
|
|
15
|
+
.map((recipient) => formatMailAddress(recipient))
|
|
16
|
+
.join(", ");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Plain text as the HTML paragraphs the editor holds. */
|
|
20
|
+
function textToHtml(text: string): string {
|
|
21
|
+
const escape = (value: string): string => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
22
|
+
return text
|
|
23
|
+
.split(/\n{2,}/)
|
|
24
|
+
.map((paragraph) => `<p>${escape(paragraph).replace(/\n/g, "<br>")}</p>`)
|
|
25
|
+
.join("");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* What the compose window needs to continue `draft` - a message in the Drafts folder the reader opened rather than one a window of this tab
|
|
30
|
+
* saved - read back from the server: its recipients and subject from the record, its body from the server's copy (with its embedded pictures)
|
|
31
|
+
* and its attachments. `undefined` for a draft that cannot be edited here: an encrypted one holds only its ciphertext, which is never opened.
|
|
32
|
+
* Never rejects for a body that could not be loaded - the draft then opens with the preview, as a reply's quote does.
|
|
33
|
+
*/
|
|
34
|
+
export async function resumeFromDraft(draft: Message, client?: ApiClient): Promise<ResumeCompose | undefined> {
|
|
35
|
+
if (draft.encrypted) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const [original, attachments] = await Promise.all([loadOriginalMessage(draft, null), listAttachments(draft.folderUid, draft.uid, client)]);
|
|
39
|
+
const html =
|
|
40
|
+
original.body.html !== undefined ? original.body.html : original.body.text !== undefined ? textToHtml(original.body.text) : textToHtml(draft.bodyPreview ?? "");
|
|
41
|
+
return {
|
|
42
|
+
draft,
|
|
43
|
+
mailboxUid: draft.mailboxUid,
|
|
44
|
+
to: recipientText(draft.recipients, "to"),
|
|
45
|
+
cc: recipientText(draft.recipients, "cc"),
|
|
46
|
+
bcc: recipientText(draft.recipients, "bcc"),
|
|
47
|
+
subject: draft.subject,
|
|
48
|
+
html,
|
|
49
|
+
attachments,
|
|
50
|
+
requestReceipt: !!draft.requestReceipt,
|
|
51
|
+
signEnabled: false,
|
|
52
|
+
encryptRequested: false,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -217,13 +217,13 @@ function CalendarContent({ userUid, bookingHref }: { userUid?: string; bookingHr
|
|
|
217
217
|
return { rangeStart: new Date(-MAX_DATE_MS), rangeEnd: new Date(MAX_DATE_MS), days: [] as Date[] };
|
|
218
218
|
}
|
|
219
219
|
if (view === "month") {
|
|
220
|
-
const start = startOfWeek(startOfMonth(viewDate), { weekStartsOn:
|
|
221
|
-
const end = endOfWeek(endOfMonth(viewDate), { weekStartsOn:
|
|
220
|
+
const start = startOfWeek(startOfMonth(viewDate), { weekStartsOn: 0 });
|
|
221
|
+
const end = endOfWeek(endOfMonth(viewDate), { weekStartsOn: 0 });
|
|
222
222
|
return { rangeStart: start, rangeEnd: end, days: [] as Date[] };
|
|
223
223
|
}
|
|
224
224
|
if (view === "week") {
|
|
225
|
-
const start = startOfWeek(viewDate, { weekStartsOn:
|
|
226
|
-
const end = endOfWeek(viewDate, { weekStartsOn:
|
|
225
|
+
const start = startOfWeek(viewDate, { weekStartsOn: 0 });
|
|
226
|
+
const end = endOfWeek(viewDate, { weekStartsOn: 0 });
|
|
227
227
|
return { rangeStart: start, rangeEnd: end, days: eachDayOfInterval({ start, end }) };
|
|
228
228
|
}
|
|
229
229
|
if (view === "workWeek") {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
createContact,
|
|
12
12
|
deleteContact,
|
|
13
13
|
listContacts,
|
|
14
|
+
ensureSuggestedContacts,
|
|
14
15
|
listContactsInFolders,
|
|
15
16
|
listDeletedContacts,
|
|
16
17
|
setContactFavorite,
|
|
@@ -91,6 +92,9 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
91
92
|
const client = useApiClient();
|
|
92
93
|
const [contacts, setContacts] = useState<Contact[]>([]);
|
|
93
94
|
const [deletedContacts, setDeletedContacts] = useState<Contact[]>([]);
|
|
95
|
+
// The mailbox's Suggested Contacts folder - the people it has corresponded with - once the server has made it; `null` while unknown (an older server has none).
|
|
96
|
+
const [suggestedFolderUid, setSuggestedFolderUid] = useState<string | null>(null);
|
|
97
|
+
const [suggestedContacts, setSuggestedContacts] = useState<Contact[]>([]);
|
|
94
98
|
const [deletedLoading, setDeletedLoading] = useState(false);
|
|
95
99
|
const [deletedError, setDeletedError] = useState<string | null>(null);
|
|
96
100
|
const [loading, setLoading] = useState(true);
|
|
@@ -121,6 +125,9 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
121
125
|
}
|
|
122
126
|
setLoading(true);
|
|
123
127
|
setError(null);
|
|
128
|
+
if (suggestedFolderUid) {
|
|
129
|
+
void loadSuggested(suggestedFolderUid);
|
|
130
|
+
}
|
|
124
131
|
return listAllPages((page) => listContacts(folderUid, { limit: LIST_PAGE_SIZE, page }, client))
|
|
125
132
|
.then((result) => {
|
|
126
133
|
setContacts(result.items);
|
|
@@ -134,6 +141,31 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
134
141
|
void reload();
|
|
135
142
|
}, [folderUid]);
|
|
136
143
|
|
|
144
|
+
/** Reads the Suggested Contacts folder's contacts. A failure leaves the list as it was. */
|
|
145
|
+
function loadSuggested(suggestedUid: string): Promise<void> {
|
|
146
|
+
return listAllPages((page) => listContacts(suggestedUid, { limit: LIST_PAGE_SIZE, page }, client))
|
|
147
|
+
.then((result) => setSuggestedContacts(result.items))
|
|
148
|
+
.catch(() => undefined);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Asks the server to turn the people this mailbox has corresponded with into suggested contacts (it does so once for each person, so this is cheap when
|
|
152
|
+
// nothing is new), then lists them. An older server, or one that refuses, simply has no such view.
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
let cancelled = false;
|
|
155
|
+
// `ContactsShell` only renders this with a resolved mailbox (see the Deleted view's comment above).
|
|
156
|
+
void ensureSuggestedContacts(mailboxUid!, client)
|
|
157
|
+
.then(async (result) => {
|
|
158
|
+
if (!cancelled) {
|
|
159
|
+
setSuggestedFolderUid(result.folderUid);
|
|
160
|
+
await loadSuggested(result.folderUid);
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
.catch(() => undefined);
|
|
164
|
+
return () => {
|
|
165
|
+
cancelled = true;
|
|
166
|
+
};
|
|
167
|
+
}, [mailboxUid]);
|
|
168
|
+
|
|
137
169
|
// restapi only honors `?deleted=true` for a caller with both delete and update rights on the contacts *folder*
|
|
138
170
|
// (its ACL, which inherits the mailbox's but can carry its own records) - anyone else silently gets the *live*
|
|
139
171
|
// contacts back, which the Deleted view would then present as deleted. There is no client API for the caller's
|
|
@@ -196,6 +228,8 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
196
228
|
return contacts;
|
|
197
229
|
case "favorites":
|
|
198
230
|
return contacts.filter((c) => c.favorite);
|
|
231
|
+
case "suggested":
|
|
232
|
+
return suggestedContacts;
|
|
199
233
|
case "list":
|
|
200
234
|
return contacts.filter((c) => c.contactListUid === view.uid);
|
|
201
235
|
case "category":
|
|
@@ -203,7 +237,7 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
203
237
|
case "deleted":
|
|
204
238
|
return deletedContacts;
|
|
205
239
|
}
|
|
206
|
-
}, [contacts, deletedContacts, view]);
|
|
240
|
+
}, [contacts, deletedContacts, suggestedContacts, view]);
|
|
207
241
|
|
|
208
242
|
const filtered = useMemo(() => {
|
|
209
243
|
const q = query.trim().toLowerCase();
|
|
@@ -226,7 +260,7 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
226
260
|
return arr;
|
|
227
261
|
}, [filtered, sortColumn, sortDesc]);
|
|
228
262
|
|
|
229
|
-
const selected = contacts.find((c) => c.uid === selectedUid) ?? null;
|
|
263
|
+
const selected = contacts.find((c) => c.uid === selectedUid) ?? suggestedContacts.find((c) => c.uid === selectedUid) ?? null;
|
|
230
264
|
const isDeletedView = view.type === "deleted";
|
|
231
265
|
const checkedContacts = sorted.filter((c) => checkedUids.has(c.uid));
|
|
232
266
|
const allChecked = sorted.length > 0 && sorted.every((c) => checkedUids.has(c.uid));
|
|
@@ -392,6 +426,36 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
392
426
|
await reload();
|
|
393
427
|
});
|
|
394
428
|
|
|
429
|
+
// A suggested contact becomes one of the mailbox's own: a copy in its contacts folder, and the suggestion removed (the person is not suggested again).
|
|
430
|
+
const handleAddToContacts = singleFlight(async () => {
|
|
431
|
+
for (const contact of checkedContacts) {
|
|
432
|
+
try {
|
|
433
|
+
await createContact(
|
|
434
|
+
{
|
|
435
|
+
mailboxUid: contact.mailboxUid,
|
|
436
|
+
folderUid: folderUid!,
|
|
437
|
+
displayName: contact.displayName,
|
|
438
|
+
givenName: contact.givenName,
|
|
439
|
+
surname: contact.surname,
|
|
440
|
+
emails: contact.emails,
|
|
441
|
+
phones: contact.phones,
|
|
442
|
+
addresses: contact.addresses,
|
|
443
|
+
company: contact.company,
|
|
444
|
+
jobTitle: contact.jobTitle,
|
|
445
|
+
notes: contact.notes,
|
|
446
|
+
categories: contact.categories,
|
|
447
|
+
},
|
|
448
|
+
client,
|
|
449
|
+
);
|
|
450
|
+
await deleteContact(contact.uid, contact.version, client);
|
|
451
|
+
} catch (err) {
|
|
452
|
+
notifyApiError(err, "Couldn't add some of the contacts");
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
setCheckedUids(new Set());
|
|
456
|
+
await reload();
|
|
457
|
+
});
|
|
458
|
+
|
|
395
459
|
function handleExportVCard() {
|
|
396
460
|
downloadTextFile(
|
|
397
461
|
checkedContacts.length === 1 ? `${checkedContacts[0].displayName}.vcf` : "contacts.vcf",
|
|
@@ -447,7 +511,14 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
447
511
|
// open-ended, so a column's `overflow` would otherwise never apply); on a phone the whole page scrolls, as it always did. Below `lg` the
|
|
448
512
|
// contacts menu is a drawer (a button above the columns), so the list and the detail pane keep a usable width.
|
|
449
513
|
<div className="flex-1 min-w-0 min-h-0 flex flex-col lg:flex-row md:flex-none md:h-[calc(100dvh_-_var(--rr-header-h,4rem))] md:overflow-hidden">
|
|
450
|
-
<ContactsSidebar
|
|
514
|
+
<ContactsSidebar
|
|
515
|
+
mailboxUid={mailboxUid}
|
|
516
|
+
contacts={contacts}
|
|
517
|
+
active={view}
|
|
518
|
+
onSelect={handleSelectView}
|
|
519
|
+
showDeleted={canViewDeleted}
|
|
520
|
+
suggestedCount={suggestedFolderUid ? suggestedContacts.length : undefined}
|
|
521
|
+
/>
|
|
451
522
|
<div className="flex-1 min-w-0 min-h-0 flex">
|
|
452
523
|
{/* Hidden on mobile while the "new contact" form (the one form-pane state mobile keeps
|
|
453
524
|
in-place — see the pane's own comment below) is showing, so the two never compete for the
|
|
@@ -469,6 +540,7 @@ function ContactsContent({ userUid }: { userUid?: string }) {
|
|
|
469
540
|
onToggleFavorite={handleToggleFavorite}
|
|
470
541
|
onAddCategory={handleAddCategory}
|
|
471
542
|
onExportVCard={handleExportVCard}
|
|
543
|
+
onAddToContacts={view.type === "suggested" ? handleAddToContacts : undefined}
|
|
472
544
|
onImportFile={handleImportFile}
|
|
473
545
|
shortcuts
|
|
474
546
|
hideNew={isMobile}
|
package/apps/www/tasks/index.tsx
CHANGED
|
@@ -61,7 +61,7 @@ function bucketFor(task: Task, now: Date): Bucket {
|
|
|
61
61
|
if (isToday(due)) {
|
|
62
62
|
return "Today";
|
|
63
63
|
}
|
|
64
|
-
if (!isAfter(due, endOfWeek(now, { weekStartsOn:
|
|
64
|
+
if (!isAfter(due, endOfWeek(now, { weekStartsOn: 0 }))) {
|
|
65
65
|
return "This Week";
|
|
66
66
|
}
|
|
67
67
|
return "Later";
|
|
@@ -12,5 +12,5 @@ import SettingsTable from "./SettingsTable.js";
|
|
|
12
12
|
*/
|
|
13
13
|
export default function InformationPanel({ versions, plugins, information }) {
|
|
14
14
|
const { data, error, loading } = versions;
|
|
15
|
-
return (_jsxs("div", { className: "space-y-6", children: [error && _jsx(Alert, { children: error }), !data && loading && _jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" }), data && (_jsxs(_Fragment, { children: [_jsx(ServerVersionCard, { server: data.server }), _jsx(ComponentsTable, { components: data.components ?? [], kubernetes: data.kubernetes ?? { available: false } }), _jsx(InstalledPlugins, { data: plugins.data, error: plugins.error, loading: plugins.loading }), information.error && _jsx(Alert, { children: information.error }), !information.data && information.loading && _jsx("p", { className: "text-sm text-text-muted", children: "Loading the environment\u2026" }), information.data && (_jsxs(_Fragment, { children: [_jsx(SettingsTable, { id: "diagnostics-environment", title: "Environment variables", description: "The server process's environment.
|
|
15
|
+
return (_jsxs("div", { className: "space-y-6", children: [error && _jsx(Alert, { children: error }), !data && loading && _jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" }), data && (_jsxs(_Fragment, { children: [_jsx(ServerVersionCard, { server: data.server }), _jsx(ComponentsTable, { components: data.components ?? [], kubernetes: data.kubernetes ?? { available: false } }), _jsx(InstalledPlugins, { data: plugins.data, error: plugins.error, loading: plugins.loading }), information.error && _jsx(Alert, { children: information.error }), !information.data && information.loading && _jsx("p", { className: "text-sm text-text-muted", children: "Loading the environment\u2026" }), information.data && (_jsxs(_Fragment, { children: [_jsx(SettingsTable, { id: "diagnostics-environment", title: "Environment variables", description: "The server process's environment. Every variable shows its value except those on the server's list of hidden settings, whose value is withheld by the server and never sent.", settings: information.data.environment ?? [] }), _jsx(SettingsTable, { id: "diagnostics-configuration", title: "Configuration", description: "The effective settings the server runs with: the environment, saved plugin settings and defaults combined. Settings on the server's list of hidden settings, such as passwords, tokens and keys, are withheld by the server and never sent, and so are the credentials in URLs.", settings: information.data.configuration ?? [] })] })), _jsx(PackagesTable, { packages: data.packages ?? [] })] }))] }));
|
|
16
16
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
///////////////////////////////////////////////////////////////////////////////
|
|
3
3
|
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
4
|
// SPDX-License-Identifier: MPL-2.0
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import Button from "../../../../../lib/components/buttons/Button.js";
|
|
8
|
+
import CopyIconButton from "../../../../../lib/components/buttons/CopyIconButton.js";
|
|
8
9
|
/** How many settings are listed at first, and how many more each "Show more" adds: an environment can be a hundred long. */
|
|
9
10
|
export const SETTINGS_PAGE_SIZE = 100;
|
|
10
11
|
/** What stands where the server withheld a value. Drawn here from `redacted`: the server never sends the value (or any text for it). */
|
|
@@ -27,5 +28,5 @@ export default function SettingsTable({ title, description, id, settings }) {
|
|
|
27
28
|
setQuery(event.target.value);
|
|
28
29
|
setLimit(SETTINGS_PAGE_SIZE);
|
|
29
30
|
} }) }), _jsx("p", { role: "status", className: "mb-2 text-xs text-text-muted", children: (matching.length === settings.length ? `${settings.length} settings` : `${matching.length} of ${settings.length} settings match`) +
|
|
30
|
-
(hiddenCount > 0 ? `, ${hiddenCount} with a hidden value` : "") }), matching.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: settings.length === 0 ? "Nothing is set." : "No settings match." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Name", "Value"].map((heading) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: heading }, heading))) }) }), _jsx("tbody", { children: shown.map((item) => (_jsxs("tr", { children: [
|
|
31
|
+
(hiddenCount > 0 ? `, ${hiddenCount} with a hidden value` : "") }), matching.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: settings.length === 0 ? "Nothing is set." : "No settings match." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Name", "Value"].map((heading) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: heading }, heading))) }) }), _jsx("tbody", { children: shown.map((item) => (_jsxs("tr", { children: [_jsxs("td", { className: "py-2 px-2.5 border-b border-border font-mono break-all", children: [item.name, _jsx(CopyIconButton, { value: item.name, label: `Copy the name of ${item.name}` })] }), _jsx("td", { className: "py-2 px-2.5 border-b border-border font-mono break-all", children: item.redacted ? (_jsx("span", { className: "text-text-muted", children: HIDDEN_VALUE })) : (_jsxs(_Fragment, { children: [item.value, _jsx(CopyIconButton, { value: item.value ?? "", label: `Copy the value of ${item.name}` })] })) })] }, item.name))) })] }) })), shown.length < matching.length && (_jsxs("div", { className: "mt-3 flex items-center gap-3", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", onClick: () => setLimit(limit + SETTINGS_PAGE_SIZE), children: "Show more" }), _jsxs("span", { className: "text-xs text-text-muted", children: ["Showing ", shown.length, " of ", matching.length] })] }))] }));
|
|
31
32
|
}
|
|
@@ -63,8 +63,8 @@ export interface DiagnosticsVersions {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* One environment variable or configuration setting. A `redacted` one has no `value`: the server withholds every
|
|
67
|
-
*
|
|
66
|
+
* One environment variable or configuration setting. A `redacted` one has no `value`: the server withholds the value of every setting on its
|
|
67
|
+
* hidden list and never sends it, so there is nothing for the client to hide.
|
|
68
68
|
*/
|
|
69
69
|
export interface DiagnosticsSetting {
|
|
70
70
|
name: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import CopyIconButton from "../../../../../lib/components/buttons/CopyIconButton.js";
|
|
2
3
|
function formatBytes(bytes) {
|
|
3
4
|
if (bytes >= 1000000000)
|
|
4
5
|
return `${(bytes / 1000000000).toFixed(1)} GB`;
|
|
@@ -8,9 +9,13 @@ function formatBytes(bytes) {
|
|
|
8
9
|
return `${(bytes / 1000).toFixed(1)} KB`;
|
|
9
10
|
return `${bytes} B`;
|
|
10
11
|
}
|
|
12
|
+
/** A cell's value with the icon button that copies it. */
|
|
13
|
+
function Copyable({ value, label }) {
|
|
14
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-1", children: [value, _jsx(CopyIconButton, { value: value, label: label })] }));
|
|
15
|
+
}
|
|
11
16
|
export default function MailboxTable({ mailboxes }) {
|
|
12
17
|
if (mailboxes.length === 0) {
|
|
13
18
|
return _jsx("p", { className: "text-sm text-text-muted", children: "No mailboxes found." });
|
|
14
19
|
}
|
|
15
|
-
return (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Address" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Display name" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Owner" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Quota used" }), _jsx("th", { className: "border-b border-border" })] }) }), _jsx("tbody", { children: mailboxes.map((mailbox) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: mailbox.primarySmtpAddress }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: mailbox.displayName }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: mailbox.ownerUserUid
|
|
20
|
+
return (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Address" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Display name" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Owner" }), _jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: "Quota used" }), _jsx("th", { className: "border-b border-border" })] }) }), _jsx("tbody", { children: mailboxes.map((mailbox) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: _jsx(Copyable, { value: mailbox.primarySmtpAddress, label: `Copy the address of ${mailbox.primarySmtpAddress}` }) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: _jsx(Copyable, { value: mailbox.displayName, label: `Copy the display name of ${mailbox.primarySmtpAddress}` }) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: mailbox.ownerUserUid ? (_jsx(Copyable, { value: mailbox.ownerUserUid, label: `Copy the owner of ${mailbox.primarySmtpAddress}` })) : (_jsx("span", { className: "inline-block text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill bg-surface-alt text-text-muted", children: "Shared" })) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle", children: _jsx(Copyable, { value: `${formatBytes(mailbox.usedBytes)} / ${formatBytes(mailbox.quotaBytes)}`, label: `Copy the quota used of ${mailbox.primarySmtpAddress}` }) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border align-middle text-right", children: _jsx("a", { href: `/admin/mailboxes/${encodeURIComponent(mailbox.uid)}`, className: "text-primary-dark font-medium hover:underline", children: "View" }) })] }, mailbox.uid))) })] }) }));
|
|
16
21
|
}
|
|
@@ -7,7 +7,7 @@ import { useEffect, useState } from "react";
|
|
|
7
7
|
import { getDnsSetup, getDomain, verifyDomain } from "../../../../../lib/admin/domainsApi.js";
|
|
8
8
|
import Alert from "../ActionAlert.js";
|
|
9
9
|
import Button from "../../../../../lib/components/buttons/Button.js";
|
|
10
|
-
import
|
|
10
|
+
import CopyIconButton from "../../../../../lib/components/buttons/CopyIconButton.js";
|
|
11
11
|
import { actionErrorMessage } from "../elevation.js";
|
|
12
12
|
const RECORD_TYPE_LABELS = {
|
|
13
13
|
ownership: "Ownership (TXT)",
|
|
@@ -44,9 +44,9 @@ function splitSrvValue(value) {
|
|
|
44
44
|
const match = /^(\d+)\s+(\d+)\s+(\d+)\s+(\S+)$/.exec(value.trim());
|
|
45
45
|
return match ? { priority: match[1], weight: match[2], port: match[3], target: match[4] } : null;
|
|
46
46
|
}
|
|
47
|
-
/** A value to type into a DNS provider's form, shown in full (long DKIM keys wrap) with a
|
|
47
|
+
/** A value to type into a DNS provider's form, shown in full (long DKIM keys wrap) with a copy icon button beside it. */
|
|
48
48
|
function CopyableValue({ value, copyLabel }) {
|
|
49
|
-
return (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("code", { className: "flex-1 min-w-0 text-xs break-all", children: value }), _jsx(
|
|
49
|
+
return (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("code", { className: "flex-1 min-w-0 text-xs break-all", children: value }), _jsx(CopyIconButton, { value: value, label: copyLabel, className: "shrink-0" })] }));
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* A domain's status, its ownership TXT record with "Verify now", and the DNS setup checklist - shared by the domain
|