@rapidmx/web-client 0.5.0 → 0.7.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 +88 -0
- package/apps/shared/components/admin/layout/AdminShell.tsx +25 -8
- package/apps/shared/components/admin/settings/BrandingForm.tsx +398 -385
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +119 -112
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +159 -152
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1288 -1235
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +9 -1
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +288 -290
- package/apps/shared/components/admin/setup/SetupWizard.tsx +443 -416
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +194 -192
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +199 -197
- package/apps/shared/components/layout/AppShell.tsx +288 -270
- package/apps/shared/components/mail/ConversationList.tsx +225 -33
- package/apps/shared/components/mail/ConversationThreadPane.tsx +434 -216
- package/apps/shared/components/mail/MailListToolbar.tsx +265 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +222 -0
- package/apps/shared/components/mail/MenuButton.tsx +384 -0
- package/apps/shared/components/mail/MessageDetailPane.tsx +280 -215
- package/apps/shared/components/mail/MoveToFolderDialog.tsx +263 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +29 -2
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1700 -1652
- package/apps/shared/components/mail/compose/RecipientInput.tsx +356 -0
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +38 -3
- package/apps/shared/components/mail/compose/quotedBody.ts +100 -0
- package/apps/shared/components/mail/compose/recipients.ts +104 -0
- package/apps/shared/components/mail/labelMenu.tsx +278 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +31 -4
- package/apps/shared/components/mail/listPreferences.ts +228 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +23 -10
- package/apps/shared/components/tasks/layout/TasksShell.tsx +201 -199
- package/apps/shared/plugins/pluginNav.ts +73 -0
- package/apps/shared/search/localIndexRpcClient.ts +3 -1
- package/apps/shared/styles/app.css +28 -5
- package/apps/www/index.tsx +1854 -1314
- package/apps/www/messages/[uid].tsx +5 -4
- package/dist/apps/admin/_404.d.ts +2 -0
- package/dist/apps/admin/_500.d.ts +2 -0
- package/dist/apps/admin/_layout.d.ts +8 -0
- package/dist/apps/admin/audit-log/index.d.ts +11 -0
- package/dist/apps/admin/branding/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/[uid].d.ts +7 -0
- package/dist/apps/admin/distribution-lists/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/new/index.d.ts +3 -0
- package/dist/apps/admin/domains/[uid].d.ts +7 -0
- package/dist/apps/admin/domains/index.d.ts +3 -0
- package/dist/apps/admin/domains/new/index.d.ts +3 -0
- package/dist/apps/admin/encryption-policy/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/[uid].d.ts +21 -0
- package/dist/apps/admin/escrow-scopes/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.d.ts +3 -0
- package/dist/apps/admin/index.d.ts +3 -0
- package/dist/apps/admin/ingest-queue/index.d.ts +4 -0
- package/dist/apps/admin/mailbox-policy/index.d.ts +3 -0
- package/dist/apps/admin/mailboxes/[uid].d.ts +7 -0
- package/dist/apps/admin/mailboxes/new/index.d.ts +3 -0
- package/dist/apps/admin/plugins/index.d.ts +3 -0
- package/dist/apps/admin/quarantine/index.d.ts +6 -0
- package/dist/apps/admin/retention-policy/index.d.ts +3 -0
- package/dist/apps/admin/setup/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/[uid].d.ts +7 -0
- package/dist/apps/admin/transport-rules/_transportRuleConfig.d.ts +21 -0
- package/dist/apps/admin/transport-rules/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/new/index.d.ts +3 -0
- package/dist/apps/escrow/_layout.d.ts +10 -0
- package/dist/apps/escrow/audit-log/index.d.ts +9 -0
- package/dist/apps/escrow/index.d.ts +3 -0
- package/dist/apps/escrow/matters/[uid].d.ts +7 -0
- package/dist/apps/escrow/matters/new/index.d.ts +3 -0
- package/dist/apps/shared/components/admin/distributionLists/MemberListCard.d.ts +17 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.js +12 -5
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/MailboxTable.d.ts +6 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.d.ts +19 -0
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +13 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +6 -5
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.d.ts +15 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/LoadedSettingsForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.d.ts +19 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.d.ts +13 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/PluginsManager.d.ts +11 -0
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +33 -14
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.d.ts +14 -0
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +1 -1
- package/dist/apps/shared/components/admin/setup/SetupWizard.d.ts +36 -0
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +14 -10
- package/dist/apps/shared/components/admin/signOut.d.ts +23 -0
- package/dist/apps/shared/components/admin/usePagedList.d.ts +39 -0
- package/dist/apps/shared/components/calendar/CalendarListSidebar.d.ts +26 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +46 -0
- package/dist/apps/shared/components/calendar/MonthView.d.ts +15 -0
- package/dist/apps/shared/components/calendar/RecurrenceEditor.d.ts +20 -0
- package/dist/apps/shared/components/calendar/ResourcePicker.d.ts +19 -0
- package/dist/apps/shared/components/calendar/SplitDayView.d.ts +28 -0
- package/dist/apps/shared/components/calendar/TimeGridView.d.ts +17 -0
- package/dist/apps/shared/components/calendar/allDay.d.ts +51 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +40 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +2 -2
- package/dist/apps/shared/components/contacts/ContactDetailPane.d.ts +23 -0
- package/dist/apps/shared/components/contacts/ContactForm.d.ts +20 -0
- package/dist/apps/shared/components/contacts/ContactsSidebar.d.ts +40 -0
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +25 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.d.ts +40 -0
- package/dist/apps/shared/components/contacts/contactKeys.d.ts +29 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +21 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +2 -2
- package/dist/apps/shared/components/escrow/layout/EscrowShell.d.ts +25 -0
- package/dist/apps/shared/components/forms/StringListField.d.ts +22 -0
- package/dist/apps/shared/components/layout/AppShell.d.ts +49 -0
- package/dist/apps/shared/components/layout/AppShell.js +15 -13
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +18 -0
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.d.ts +51 -0
- package/dist/apps/shared/components/layout/MailboxProvisioning.d.ts +13 -0
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.d.ts +66 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.d.ts +45 -0
- package/dist/apps/shared/components/layout/UserMenu.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationList.d.ts +47 -0
- package/dist/apps/shared/components/mail/ConversationList.js +84 -10
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +62 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +217 -60
- package/dist/apps/shared/components/mail/MailListToolbar.d.ts +55 -0
- package/dist/apps/shared/components/mail/MailListToolbar.js +149 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +59 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.js +48 -0
- package/dist/apps/shared/components/mail/MenuButton.d.ts +71 -0
- package/dist/apps/shared/components/mail/MenuButton.js +211 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +101 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.js +126 -129
- package/dist/apps/shared/components/mail/MoveToFolderDialog.d.ts +57 -0
- package/dist/apps/shared/components/mail/MoveToFolderDialog.js +138 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +73 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +3 -1
- package/dist/apps/shared/components/mail/compose/ComposeToolbar.d.ts +15 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +52 -20
- package/dist/apps/shared/components/mail/compose/EmojiPicker.d.ts +14 -0
- package/dist/apps/shared/components/mail/compose/GifPicker.d.ts +13 -0
- package/dist/apps/shared/components/mail/compose/RecipientInput.d.ts +36 -0
- package/dist/apps/shared/components/mail/compose/RecipientInput.js +203 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +43 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +21 -3
- package/dist/apps/shared/components/mail/compose/ScheduleSendPicker.d.ts +16 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.d.ts +27 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.js +85 -0
- package/dist/apps/shared/components/mail/compose/recipients.d.ts +24 -0
- package/dist/apps/shared/components/mail/compose/recipients.js +87 -0
- package/dist/apps/shared/components/mail/labelMenu.d.ts +97 -0
- package/dist/apps/shared/components/mail/labelMenu.js +134 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +65 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +17 -5
- package/dist/apps/shared/components/mail/listPreferences.d.ts +101 -0
- package/dist/apps/shared/components/mail/listPreferences.js +186 -0
- package/dist/apps/shared/components/mail/pinnedSigners.d.ts +33 -0
- package/dist/apps/shared/components/mail/verificationSeals.d.ts +22 -0
- package/dist/apps/shared/components/mail/writableMailboxes.d.ts +15 -0
- package/dist/apps/shared/components/rules/RuleBuilder.d.ts +70 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +41 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +19 -10
- package/dist/apps/shared/components/tasks/TasksSidebar.d.ts +41 -0
- package/dist/apps/shared/components/tasks/TasksToolbar.d.ts +14 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +24 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +2 -2
- package/dist/apps/shared/mail/findWellKnownFolderUid.d.ts +5 -0
- package/dist/apps/shared/mail/listAllPages.d.ts +17 -0
- package/dist/apps/shared/plugins/pluginNav.d.ts +39 -0
- package/dist/apps/shared/plugins/pluginNav.js +33 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.d.ts +13 -0
- package/dist/apps/shared/search/localIndexBlockCipher.d.ts +36 -0
- package/dist/apps/shared/search/localIndexBuilder.d.ts +85 -0
- package/dist/apps/shared/search/localIndexKey.d.ts +4 -0
- package/dist/apps/shared/search/localIndexRpcClient.d.ts +71 -0
- package/dist/apps/shared/search/localIndexRpcClient.js +3 -1
- package/dist/apps/shared/search/localIndexSchema.d.ts +111 -0
- package/dist/apps/shared/search/localIndexSizePreference.d.ts +27 -0
- package/dist/apps/shared/search/localIndexStorage.d.ts +28 -0
- package/dist/apps/shared/search/localIndexVFS.d.ts +101 -0
- package/dist/apps/shared/search/localIndexWorker.d.ts +145 -0
- package/dist/apps/shared/search/searchTier2.d.ts +30 -0
- package/dist/apps/shared/styles/app.css +28 -5
- package/dist/apps/www/_404.d.ts +2 -0
- package/dist/apps/www/_500.d.ts +2 -0
- package/dist/apps/www/_layout.d.ts +14 -0
- package/dist/apps/www/calendar/index.d.ts +3 -0
- package/dist/apps/www/contacts/[uid].d.ts +13 -0
- package/dist/apps/www/contacts/index.d.ts +3 -0
- package/dist/apps/www/index.d.ts +3 -0
- package/dist/apps/www/index.js +506 -112
- package/dist/apps/www/messages/[uid].d.ts +11 -0
- package/dist/apps/www/messages/[uid].js +2 -3
- package/dist/apps/www/settings/auto-reply/index.d.ts +4 -0
- package/dist/apps/www/settings/encryption/index.d.ts +7 -0
- package/dist/apps/www/settings/filters/[uid].d.ts +8 -0
- package/dist/apps/www/settings/filters/_mailFilterRuleConfig.d.ts +11 -0
- package/dist/apps/www/settings/filters/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.d.ts +4 -0
- package/dist/apps/www/settings/labels/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.d.ts +4 -0
- package/dist/apps/www/settings/read-receipts/index.d.ts +4 -0
- package/dist/apps/www/settings/sharing/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/[uid].d.ts +8 -0
- package/dist/apps/www/settings/signatures/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/new/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/signatureDefaults.d.ts +10 -0
- package/dist/apps/www/tasks/index.d.ts +3 -0
- package/package.json +3 -3
- package/apps/shared/components/booking/AvailabilityEditor.tsx +0 -118
- package/apps/www/settings/booking-types/[uid].tsx +0 -306
- package/apps/www/settings/booking-types/index.tsx +0 -98
- package/apps/www/settings/booking-types/new/index.tsx +0 -212
- package/apps/www/settings/focused-inbox/index.tsx +0 -150
- package/dist/apps/shared/components/booking/AvailabilityEditor.js +0 -45
- package/dist/apps/www/settings/booking-types/[uid].js +0 -134
- package/dist/apps/www/settings/booking-types/index.js +0 -29
- package/dist/apps/www/settings/booking-types/new/index.js +0 -86
- package/dist/apps/www/settings/focused-inbox/index.js +0 -71
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
-
import { deleteBookingType, getBookingType, updateBookingType, } from "@rapidmx/react-shared/booking/bookingApi.js";
|
|
9
|
-
import SettingsShell, { useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
10
|
-
import AvailabilityEditor from "../../../shared/components/booking/AvailabilityEditor.js";
|
|
11
|
-
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
12
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
13
|
-
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
14
|
-
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
15
|
-
const INPUT_CLASS = "w-full text-sm py-2.5 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
16
|
-
export default function BookingTypeDetailPage(props) {
|
|
17
|
-
return (_jsx(SettingsShell, { ...props, active: "booking-types", children: _jsx(BookingTypeDetailContent, { uid: props.params.uid }) }));
|
|
18
|
-
}
|
|
19
|
-
function BookingTypeDetailContent({ uid }) {
|
|
20
|
-
const { mailboxUid } = useSettingsShell();
|
|
21
|
-
const [bookingType, setBookingType] = useState(null);
|
|
22
|
-
const [name, setName] = useState("");
|
|
23
|
-
const [description, setDescription] = useState("");
|
|
24
|
-
const [hostDisplayName, setHostDisplayName] = useState("");
|
|
25
|
-
const [durationMinutes, setDurationMinutes] = useState(30);
|
|
26
|
-
const [timezone, setTimezone] = useState("");
|
|
27
|
-
const [availability, setAvailability] = useState([]);
|
|
28
|
-
const [minimumNoticeMinutes, setMinimumNoticeMinutes] = useState(60);
|
|
29
|
-
const [bookingWindowDays, setBookingWindowDays] = useState(30);
|
|
30
|
-
const [requiresApproval, setRequiresApproval] = useState(false);
|
|
31
|
-
const [enabled, setEnabled] = useState(true);
|
|
32
|
-
const [loading, setLoading] = useState(true);
|
|
33
|
-
// Split so a failed save keeps the form (and the user's edits) on screen - only a failed *load* has
|
|
34
|
-
// nothing to show but the error.
|
|
35
|
-
const [loadError, setLoadError] = useState(null);
|
|
36
|
-
const [saveError, setSaveError] = useState(null);
|
|
37
|
-
const [saving, setSaving] = useState(false);
|
|
38
|
-
const [saved, setSaved] = useState(false);
|
|
39
|
-
const [copied, setCopied] = useState(false);
|
|
40
|
-
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
41
|
-
const [deleting, setDeleting] = useState(false);
|
|
42
|
-
const [deleteError, setDeleteError] = useState(null);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
setLoading(true);
|
|
45
|
-
setLoadError(null);
|
|
46
|
-
getBookingType(uid)
|
|
47
|
-
.then((bt) => {
|
|
48
|
-
setBookingType(bt);
|
|
49
|
-
setName(bt.name);
|
|
50
|
-
setDescription(bt.description ?? "");
|
|
51
|
-
setHostDisplayName(bt.hostDisplayName);
|
|
52
|
-
setDurationMinutes(bt.durationMinutes);
|
|
53
|
-
setTimezone(bt.timezone);
|
|
54
|
-
setAvailability(bt.availability);
|
|
55
|
-
setMinimumNoticeMinutes(bt.minimumNoticeMinutes);
|
|
56
|
-
setBookingWindowDays(bt.bookingWindowDays);
|
|
57
|
-
setRequiresApproval(bt.requiresApproval);
|
|
58
|
-
setEnabled(bt.enabled);
|
|
59
|
-
})
|
|
60
|
-
.catch((err) => setLoadError(err instanceof ApiRequestError ? err.message : "Could not load this booking link."))
|
|
61
|
-
.finally(() => setLoading(false));
|
|
62
|
-
}, [uid]);
|
|
63
|
-
async function handleSubmit(e) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
setSaveError(null);
|
|
66
|
-
setSaved(false);
|
|
67
|
-
setSaving(true);
|
|
68
|
-
try {
|
|
69
|
-
const updated = await updateBookingType({
|
|
70
|
-
uid: bookingType.uid,
|
|
71
|
-
version: bookingType.version,
|
|
72
|
-
name,
|
|
73
|
-
// `null` (not omitted) clears a saved description - an omitted field is left unchanged by the
|
|
74
|
-
// server's partial update. `UpdateBookingTypeInput` doesn't declare `null` yet, hence the cast.
|
|
75
|
-
description: description.trim() || null,
|
|
76
|
-
hostDisplayName,
|
|
77
|
-
durationMinutes,
|
|
78
|
-
timezone,
|
|
79
|
-
availability,
|
|
80
|
-
minimumNoticeMinutes,
|
|
81
|
-
bookingWindowDays,
|
|
82
|
-
requiresApproval,
|
|
83
|
-
enabled,
|
|
84
|
-
});
|
|
85
|
-
setBookingType(updated);
|
|
86
|
-
setSaved(true);
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
setSaveError(err instanceof ApiRequestError ? err.message : "Could not save this booking link.");
|
|
90
|
-
}
|
|
91
|
-
finally {
|
|
92
|
-
setSaving(false);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function handleCopy(value) {
|
|
96
|
-
try {
|
|
97
|
-
await navigator.clipboard.writeText(value);
|
|
98
|
-
setCopied(true);
|
|
99
|
-
setTimeout(() => setCopied(false), 2000);
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
// Clipboard access can be denied by the browser — the value is still selectable/copyable by hand.
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async function handleDelete() {
|
|
106
|
-
setDeleting(true);
|
|
107
|
-
setDeleteError(null);
|
|
108
|
-
try {
|
|
109
|
-
await deleteBookingType(bookingType.uid, bookingType.version);
|
|
110
|
-
window.location.href = `/settings/booking-types?mailboxUid=${encodeURIComponent(mailboxUid)}`;
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
setDeleteError(err instanceof ApiRequestError ? err.message : "Could not delete this booking link.");
|
|
114
|
-
setDeleting(false);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (loading) {
|
|
118
|
-
return _jsx("p", { className: "p-6 text-sm text-text-muted", children: "Loading\u2026" });
|
|
119
|
-
}
|
|
120
|
-
if (loadError || !bookingType) {
|
|
121
|
-
// `loadError` is always set whenever `bookingType` is falsy here: the load effect above destructures
|
|
122
|
-
// every field off the resolved value directly (`bt.name`, `bt.hostDisplayName`, ...), so a
|
|
123
|
-
// successful-but-empty response throws into `.catch()` — which sets `loadError` — before this
|
|
124
|
-
// component ever renders past the `loading` guard above. `!bookingType` alone (with `loadError` still
|
|
125
|
-
// `null`) is therefore unreachable, unlike e.g. `messages/[uid].tsx`'s identical-looking check,
|
|
126
|
-
// which stores its fetched value whole rather than destructuring it.
|
|
127
|
-
return (_jsx("div", { className: "p-6", children: _jsx(Alert, { children: loadError }) }));
|
|
128
|
-
}
|
|
129
|
-
// `bookingType` only ever becomes non-null via the client-only fetch above, so by the time this line
|
|
130
|
-
// runs `window` is always defined — the `!bookingType` early return just above covers every real SSR
|
|
131
|
-
// pass, where `bookingType` is still `null`.
|
|
132
|
-
const publicUrl = `${window.location.origin}/book/${encodeURIComponent(bookingType.slug)}`;
|
|
133
|
-
return (_jsx("div", { className: "flex-1 min-w-0 overflow-y-auto p-6", children: _jsxs("div", { className: "max-w-2xl", children: [_jsxs("div", { className: "flex items-start justify-between gap-4 mb-1", children: [_jsxs("div", { children: [_jsx("a", { href: `/settings/booking-types?mailboxUid=${encodeURIComponent(mailboxUid)}`, className: "text-sm text-primary-dark hover:underline", children: "\u2190 All booking links" }), _jsx("h1", { className: "text-xl font-bold tracking-tight mt-1", children: bookingType.name })] }), _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto shrink-0 !border-danger !text-danger hover:!border-danger hover:!text-danger", onClick: () => setConfirmingDelete(true), children: "Delete" })] }), _jsxs("div", { className: "flex items-center gap-2 mb-5", children: [_jsx("code", { className: "flex-1 text-xs bg-surface-alt border border-border rounded-sm py-2 px-3 overflow-x-auto whitespace-nowrap", children: publicUrl }), _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto shrink-0", onClick: () => handleCopy(publicUrl), children: copied ? "Copied" : "Copy" })] }), saveError && _jsx(Alert, { children: saveError }), saved && !saveError && _jsx("div", { className: "mb-4 text-sm text-success font-medium", children: "Saved." }), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-1", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm mb-3", children: [_jsx("input", { type: "checkbox", checked: enabled, onChange: (e) => setEnabled(e.target.checked) }), "Enabled (publicly bookable)"] }), _jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value) }) }), _jsx(FormField, { label: "Description (optional)", htmlFor: "description", children: _jsx("textarea", { id: "description", className: INPUT_CLASS, rows: 2, value: description, onChange: (e) => setDescription(e.target.value) }) }), _jsx(FormField, { label: "Host name shown to visitors", htmlFor: "hostDisplayName", children: _jsx("input", { id: "hostDisplayName", type: "text", className: INPUT_CLASS, value: hostDisplayName, onChange: (e) => setHostDisplayName(e.target.value) }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(FormField, { label: "Duration (minutes)", htmlFor: "durationMinutes", children: _jsx("input", { id: "durationMinutes", type: "number", min: 1, className: INPUT_CLASS, value: durationMinutes, onChange: (e) => setDurationMinutes(Number(e.target.value)) }) }), _jsx(FormField, { label: "Timezone", htmlFor: "timezone", children: _jsx("input", { id: "timezone", type: "text", className: INPUT_CLASS, value: timezone, onChange: (e) => setTimezone(e.target.value) }) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(FormField, { label: "Minimum notice (minutes)", htmlFor: "minimumNoticeMinutes", children: _jsx("input", { id: "minimumNoticeMinutes", type: "number", min: 0, className: INPUT_CLASS, value: minimumNoticeMinutes, onChange: (e) => setMinimumNoticeMinutes(Number(e.target.value)) }) }), _jsx(FormField, { label: "Booking window (days ahead)", htmlFor: "bookingWindowDays", children: _jsx("input", { id: "bookingWindowDays", type: "number", min: 1, className: INPUT_CLASS, value: bookingWindowDays, onChange: (e) => setBookingWindowDays(Number(e.target.value)) }) })] }), _jsxs("label", { className: "flex items-center gap-2 text-sm my-3", children: [_jsx("input", { type: "checkbox", checked: requiresApproval, onChange: (e) => setRequiresApproval(e.target.checked) }), "Require my approval before confirming a booking"] }), _jsxs("div", { className: "mb-4", children: [_jsx("span", { className: "block text-sm font-semibold mb-1.5 text-text", children: "Weekly availability" }), _jsx(AvailabilityEditor, { value: availability, onChange: setAvailability })] }), _jsx("div", { children: _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Save" }) })] }), _jsxs(Modal, { open: confirmingDelete, onClose: () => setConfirmingDelete(false), title: "Delete booking link", children: [_jsxs("p", { className: "text-sm mb-5", children: ["Are you sure you want to delete ", _jsx("strong", { children: bookingType.name }), "? Its public link will stop working immediately. This cannot be undone."] }), deleteError && _jsx(Alert, { children: deleteError }), _jsxs("div", { className: "flex gap-3 justify-end mt-5", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", disabled: deleting, onClick: () => setConfirmingDelete(false), children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto !bg-none !bg-danger !border-danger hover:!bg-danger", loading: deleting, disabled: deleting, onClick: handleDelete, children: "Delete" })] })] })] }) }));
|
|
134
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
-
import { listBookingTypes } from "@rapidmx/react-shared/booking/bookingApi.js";
|
|
9
|
-
import SettingsShell, { useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
10
|
-
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
|
-
export default function SettingsBookingTypesPage(props) {
|
|
13
|
-
return (_jsx(SettingsShell, { ...props, active: "booking-types", children: _jsx(BookingTypesContent, {}) }));
|
|
14
|
-
}
|
|
15
|
-
function BookingTypesContent() {
|
|
16
|
-
const { mailboxUid } = useSettingsShell();
|
|
17
|
-
const [bookingTypes, setBookingTypes] = useState([]);
|
|
18
|
-
const [loading, setLoading] = useState(true);
|
|
19
|
-
const [error, setError] = useState(null);
|
|
20
|
-
// `SettingsShell` only ever renders its children once `mailboxUid` has resolved — same established
|
|
21
|
-
// non-null pattern as `apps/www/settings/filters/index.tsx`.
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
listBookingTypes(mailboxUid)
|
|
24
|
-
.then(setBookingTypes)
|
|
25
|
-
.catch((err) => setError(err instanceof ApiRequestError ? err.message : "Could not load your booking links."))
|
|
26
|
-
.finally(() => setLoading(false));
|
|
27
|
-
}, [mailboxUid]);
|
|
28
|
-
return (_jsx("div", { className: "flex-1 min-w-0 overflow-y-auto p-6", children: _jsxs("div", { className: "max-w-3xl", children: [_jsxs("div", { className: "flex items-center justify-between mb-5", children: [_jsx("h1", { className: "text-lg font-bold tracking-tight", children: "Booking Links" }), _jsx("a", { href: `/settings/booking-types/new?mailboxUid=${encodeURIComponent(mailboxUid)}`, children: _jsx(Button, { type: "button", className: "!w-auto", children: "+ New booking link" }) })] }), _jsx("p", { className: "text-sm text-text-muted mb-4", children: "Share a link and let anyone pick a real open slot on your calendar \u2014 no account needed on their end." }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : bookingTypes.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "No booking links yet." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Name", "Link", "Duration", "Enabled", ""].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: bookingTypes.map((bookingType) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: bookingType.name }), _jsxs("td", { className: "py-2.5 px-2.5 border-b border-border", children: ["/book/", bookingType.slug] }), _jsxs("td", { className: "py-2.5 px-2.5 border-b border-border", children: [bookingType.durationMinutes, " min"] }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: bookingType.enabled ? "Yes" : "No" }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-right", children: _jsx("a", { href: `/settings/booking-types/${encodeURIComponent(bookingType.uid)}?mailboxUid=${encodeURIComponent(mailboxUid)}`, className: "text-primary-dark hover:underline font-medium", children: "View" }) })] }, bookingType.uid))) })] }) }))] }) }));
|
|
29
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
-
import { listFolders } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
9
|
-
import { createBookingType } from "@rapidmx/react-shared/booking/bookingApi.js";
|
|
10
|
-
import SettingsShell, { useSettingsShell } from "../../../../shared/components/settings/layout/SettingsShell.js";
|
|
11
|
-
import AvailabilityEditor from "../../../../shared/components/booking/AvailabilityEditor.js";
|
|
12
|
-
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
|
-
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
15
|
-
const INPUT_CLASS = "w-full text-sm py-2.5 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
16
|
-
export default function NewBookingTypePage(props) {
|
|
17
|
-
return (_jsx(SettingsShell, { ...props, active: "booking-types", children: _jsx(NewBookingTypeForm, {}) }));
|
|
18
|
-
}
|
|
19
|
-
function NewBookingTypeForm() {
|
|
20
|
-
const { mailboxUid, mailboxes } = useSettingsShell();
|
|
21
|
-
// Same established non-null pattern as `apps/www/settings/filters/new/index.tsx`.
|
|
22
|
-
const mailbox = mailboxes.find((mb) => mb.uid === mailboxUid);
|
|
23
|
-
const [calendarFolderUid, setCalendarFolderUid] = useState(null);
|
|
24
|
-
const [folderError, setFolderError] = useState(null);
|
|
25
|
-
const [slug, setSlug] = useState("");
|
|
26
|
-
const [name, setName] = useState("");
|
|
27
|
-
const [description, setDescription] = useState("");
|
|
28
|
-
const [hostDisplayName, setHostDisplayName] = useState(mailbox.displayName);
|
|
29
|
-
const [durationMinutes, setDurationMinutes] = useState(30);
|
|
30
|
-
const [timezone, setTimezone] = useState(mailbox.timezone);
|
|
31
|
-
const [availability, setAvailability] = useState([]);
|
|
32
|
-
const [minimumNoticeMinutes, setMinimumNoticeMinutes] = useState(60);
|
|
33
|
-
const [bookingWindowDays, setBookingWindowDays] = useState(30);
|
|
34
|
-
const [requiresApproval, setRequiresApproval] = useState(false);
|
|
35
|
-
const [error, setError] = useState(null);
|
|
36
|
-
const [saving, setSaving] = useState(false);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
listFolders(mailboxUid)
|
|
39
|
-
.then((folders) => {
|
|
40
|
-
const calendar = folders.find((f) => f.type === "calendar");
|
|
41
|
-
if (!calendar) {
|
|
42
|
-
setFolderError("This mailbox has no Calendar folder yet.");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
setCalendarFolderUid(calendar.uid);
|
|
46
|
-
})
|
|
47
|
-
.catch((err) => setFolderError(err instanceof ApiRequestError ? err.message : "Could not load this mailbox's folders."));
|
|
48
|
-
}, [mailboxUid]);
|
|
49
|
-
async function handleSubmit(e) {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
setError(null);
|
|
52
|
-
if (!slug.trim() || !name.trim() || !hostDisplayName.trim()) {
|
|
53
|
-
setError("Slug, name, and host name are all required.");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (!calendarFolderUid) {
|
|
57
|
-
setError("This mailbox has no Calendar folder yet.");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
setSaving(true);
|
|
61
|
-
try {
|
|
62
|
-
const created = await createBookingType({
|
|
63
|
-
mailboxUid: mailboxUid,
|
|
64
|
-
calendarFolderUid,
|
|
65
|
-
slug: slug.trim(),
|
|
66
|
-
name: name.trim(),
|
|
67
|
-
description: description.trim() || undefined,
|
|
68
|
-
hostDisplayName: hostDisplayName.trim(),
|
|
69
|
-
durationMinutes,
|
|
70
|
-
timezone,
|
|
71
|
-
availability,
|
|
72
|
-
minimumNoticeMinutes,
|
|
73
|
-
bookingWindowDays,
|
|
74
|
-
requiresApproval,
|
|
75
|
-
});
|
|
76
|
-
window.location.href = `/settings/booking-types/${encodeURIComponent(created.uid)}?mailboxUid=${encodeURIComponent(mailboxUid)}`;
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
setError(err instanceof ApiRequestError ? err.message : "Could not create this booking link.");
|
|
80
|
-
}
|
|
81
|
-
finally {
|
|
82
|
-
setSaving(false);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return (_jsx("div", { className: "flex-1 min-w-0 overflow-y-auto p-6", children: _jsxs("div", { className: "max-w-2xl", children: [_jsx("h1", { className: "text-lg font-bold tracking-tight mb-1", children: "New booking link" }), _jsx("p", { className: "text-sm text-text-muted mb-5", children: "Anyone with the link can pick an open slot from your live availability below \u2014 no account needed on their end." }), error && _jsx(Alert, { children: error }), folderError && _jsx(Alert, { children: folderError }), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-1", children: [_jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value), placeholder: "30 Minute Intro Call" }) }), _jsx(FormField, { label: "Slug (used in the public link)", htmlFor: "slug", children: _jsx("input", { id: "slug", type: "text", className: INPUT_CLASS, value: slug, onChange: (e) => setSlug(e.target.value), placeholder: "intro-call" }) }), _jsx(FormField, { label: "Description (optional)", htmlFor: "description", children: _jsx("textarea", { id: "description", className: INPUT_CLASS, rows: 2, value: description, onChange: (e) => setDescription(e.target.value) }) }), _jsx(FormField, { label: "Host name shown to visitors", htmlFor: "hostDisplayName", children: _jsx("input", { id: "hostDisplayName", type: "text", className: INPUT_CLASS, value: hostDisplayName, onChange: (e) => setHostDisplayName(e.target.value) }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(FormField, { label: "Duration (minutes)", htmlFor: "durationMinutes", children: _jsx("input", { id: "durationMinutes", type: "number", min: 1, className: INPUT_CLASS, value: durationMinutes, onChange: (e) => setDurationMinutes(Number(e.target.value)) }) }), _jsx(FormField, { label: "Timezone", htmlFor: "timezone", children: _jsx("input", { id: "timezone", type: "text", className: INPUT_CLASS, value: timezone, onChange: (e) => setTimezone(e.target.value), placeholder: "America/New_York" }) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(FormField, { label: "Minimum notice (minutes)", htmlFor: "minimumNoticeMinutes", children: _jsx("input", { id: "minimumNoticeMinutes", type: "number", min: 0, className: INPUT_CLASS, value: minimumNoticeMinutes, onChange: (e) => setMinimumNoticeMinutes(Number(e.target.value)) }) }), _jsx(FormField, { label: "Booking window (days ahead)", htmlFor: "bookingWindowDays", children: _jsx("input", { id: "bookingWindowDays", type: "number", min: 1, className: INPUT_CLASS, value: bookingWindowDays, onChange: (e) => setBookingWindowDays(Number(e.target.value)) }) })] }), _jsxs("label", { className: "flex items-center gap-2 text-sm my-3", children: [_jsx("input", { type: "checkbox", checked: requiresApproval, onChange: (e) => setRequiresApproval(e.target.checked) }), "Require my approval before confirming a booking"] }), _jsxs("div", { className: "mb-4", children: [_jsx("span", { className: "block text-sm font-semibold mb-1.5 text-text", children: "Weekly availability" }), _jsx(AvailabilityEditor, { value: availability, onChange: setAvailability })] }), _jsx("div", { children: _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Create" }) })] })] }) }));
|
|
86
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
-
import { createFocusedInboxOverride, deleteFocusedInboxOverride, listFocusedInboxOverrides, } from "@rapidmx/react-shared/mail/focusedInboxOverridesApi.js";
|
|
9
|
-
import SettingsShell, { useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
10
|
-
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
|
-
export default function SettingsFocusedInboxPage(props) {
|
|
13
|
-
return (_jsx(SettingsShell, { ...props, active: "focused-inbox", children: _jsx(FocusedInboxContent, {}) }));
|
|
14
|
-
}
|
|
15
|
-
function FocusedInboxContent() {
|
|
16
|
-
const { mailboxUid } = useSettingsShell();
|
|
17
|
-
const [overrides, setOverrides] = useState([]);
|
|
18
|
-
const [loading, setLoading] = useState(true);
|
|
19
|
-
const [error, setError] = useState(null);
|
|
20
|
-
const [saving, setSaving] = useState(false);
|
|
21
|
-
const [newSender, setNewSender] = useState("");
|
|
22
|
-
const [newClassifyAs, setNewClassifyAs] = useState("other");
|
|
23
|
-
function reload() {
|
|
24
|
-
setLoading(true);
|
|
25
|
-
setError(null);
|
|
26
|
-
// `SettingsShell` only ever renders its children once `mailboxUid` has resolved — same
|
|
27
|
-
// established non-null pattern as `apps/www/settings/filters/index.tsx`.
|
|
28
|
-
listFocusedInboxOverrides(mailboxUid)
|
|
29
|
-
.then(setOverrides)
|
|
30
|
-
.catch((err) => setError(err instanceof ApiRequestError ? err.message : "Could not load your Focused Inbox rules."))
|
|
31
|
-
.finally(() => setLoading(false));
|
|
32
|
-
}
|
|
33
|
-
useEffect(reload, [mailboxUid]);
|
|
34
|
-
async function handleAdd(e) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
// Lowercased to match restapi's own `normalizeAddress()` - what gets sent is exactly what gets
|
|
37
|
-
// stored and matched against, rather than relying on the server to silently rewrite it.
|
|
38
|
-
const senderAddress = newSender.trim().toLowerCase();
|
|
39
|
-
if (!senderAddress) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
setSaving(true);
|
|
43
|
-
setError(null);
|
|
44
|
-
try {
|
|
45
|
-
await createFocusedInboxOverride({ mailboxUid: mailboxUid, senderAddress, classifyAs: newClassifyAs });
|
|
46
|
-
setNewSender("");
|
|
47
|
-
reload();
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
setError(err instanceof ApiRequestError ? err.message : "Could not add this rule.");
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
setSaving(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function handleRemove(override) {
|
|
57
|
-
setSaving(true);
|
|
58
|
-
setError(null);
|
|
59
|
-
try {
|
|
60
|
-
await deleteFocusedInboxOverride(override.uid, override.version);
|
|
61
|
-
reload();
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
setError(err instanceof ApiRequestError ? err.message : "Could not remove this rule.");
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
setSaving(false);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return (_jsx("div", { className: "flex-1 min-w-0 overflow-y-auto p-6", children: _jsxs("div", { className: "max-w-xl", children: [_jsx("h1", { className: "text-lg font-bold tracking-tight mb-1", children: "Focused Inbox" }), _jsx("p", { className: "text-sm text-text-muted mb-4", children: "Mail from a sender listed here always goes to the matching half of your Inbox, overriding the automatic Focused/Other classification. Add one directly, or use \u201CAlways for this sender\u201D when moving a message." }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : (_jsxs("ul", { className: "flex flex-col gap-2 mb-4", children: [overrides.length === 0 && _jsx("li", { className: "text-sm text-text-muted", children: "No rules yet." }), overrides.map((override) => (_jsxs("li", { className: "flex items-center justify-between gap-3 py-2 px-3 border border-border rounded-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium", children: override.senderAddress }), _jsxs("div", { className: "text-xs text-text-muted", children: ["Always ", override.classifyAs === "other" ? "Other" : "Focused"] })] }), _jsx("button", { type: "button", onClick: () => handleRemove(override), disabled: saving, className: "text-sm text-danger hover:underline disabled:opacity-55", children: "Remove" })] }, override.uid)))] })), _jsxs("form", { onSubmit: handleAdd, className: "flex gap-2", children: [_jsx("input", { type: "text", "aria-label": "Sender address", value: newSender, onChange: (e) => setNewSender(e.target.value), placeholder: "sender@example.com", className: "flex-1 text-sm py-2 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary" }), _jsxs("select", { "aria-label": "Classify as", value: newClassifyAs, onChange: (e) => setNewClassifyAs(e.target.value), className: "text-sm py-2 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary", children: [_jsx("option", { value: "other", children: "Other" }), _jsx("option", { value: "focused", children: "Focused" })] }), _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Add" })] })] }) }));
|
|
71
|
-
}
|