@open-workspace/email 0.3.0 → 0.4.1
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 +22 -22
- package/alchemy/index.ts +273 -0
- package/drizzle/mailbox/0000_puzzling_dracula.sql +149 -0
- package/drizzle/mailbox/0001_mute_jack_flag.sql +12 -0
- package/drizzle/mailbox/meta/0000_snapshot.json +1002 -0
- package/drizzle/mailbox/meta/0001_snapshot.json +1002 -0
- package/drizzle/mailbox/meta/_journal.json +20 -0
- package/drizzle/mailbox/migrations.js +12 -0
- package/index.ts +3 -1
- package/migrations/{0000_email.sql → 0000_dry_moon_knight.sql} +26 -20
- package/migrations/meta/0000_snapshot.json +125 -109
- package/migrations/meta/_journal.json +2 -2
- package/package.json +74 -68
- package/shared/attachment-preview.ts +37 -27
- package/shared/folder-order.ts +106 -0
- package/shared/mail-authentication.ts +8 -3
- package/shared/mail-feedback.ts +18 -25
- package/shared/mail-headers.ts +114 -39
- package/shared/mail-import.ts +38 -0
- package/shared/mail-path.ts +42 -0
- package/shared/mail-received.ts +174 -31
- package/shared/mail-remote.ts +59 -2
- package/shared/mail-sender-intel.ts +22 -4
- package/shared/mail.ts +77 -28
- package/shared/module.ts +33 -0
- package/shared/office-preview.ts +14 -2
- package/shared/pdfjs-assets.ts +35 -0
- package/shared/permissions.ts +73 -0
- package/shared/webhooks.ts +41 -0
- package/src/admin/blocked-senders.tsx +189 -0
- package/src/client.tsx +97 -0
- package/src/lib/mail-api.ts +9 -0
- package/src/mail/attachment-preview-dialog.tsx +161 -0
- package/src/mail/blocked-senders.tsx +138 -0
- package/src/mail/compose-window-chrome.tsx +194 -0
- package/src/mail/compose-window.tsx +486 -0
- package/src/mail/composer-asset-bookmarks.ts +409 -0
- package/src/mail/composer-asset.tsx +229 -0
- package/src/mail/composer-attachment-list.tsx +138 -0
- package/src/mail/composer-editor-document.ts +65 -0
- package/src/mail/composer-editor.tsx +284 -0
- package/src/mail/composer-linked-attachment-text.ts +12 -0
- package/src/mail/composer-recipient-fields.tsx +165 -0
- package/src/mail/composer-recipients.ts +208 -0
- package/src/mail/composer-session.ts +562 -0
- package/src/mail/composer-toolbar.tsx +303 -0
- package/src/mail/composer-upload-client.ts +105 -0
- package/src/mail/composer-upload-progress.ts +53 -0
- package/src/mail/conversation-list.tsx +550 -0
- package/src/mail/conversation-loading-skeleton.tsx +119 -0
- package/src/mail/conversation-message.tsx +346 -0
- package/src/mail/conversation-reply.tsx +470 -0
- package/src/mail/conversation-selection-toolbar.tsx +322 -0
- package/src/mail/conversation-view.tsx +437 -0
- package/src/mail/delivery-indicator.tsx +272 -0
- package/src/mail/email-html-body.tsx +203 -0
- package/src/mail/folder-glyph.tsx +46 -0
- package/src/mail/folder-manager.tsx +532 -0
- package/src/mail/format-bytes.ts +7 -0
- package/src/mail/mail-app-bar.tsx +253 -0
- package/src/mail/mail-background.tsx +12 -0
- package/src/mail/mail-dock.tsx +137 -0
- package/src/mail/mail-folders.ts +44 -0
- package/src/mail/mail-layout.css +236 -0
- package/src/mail/mail-location.ts +73 -0
- package/src/mail/mail-mailbox-sheet.tsx +275 -0
- package/src/mail/mail-nav-rail.tsx +129 -0
- package/src/mail/mail-nav.tsx +324 -0
- package/src/mail/mail-prefetch.ts +59 -0
- package/src/mail/mail-primitives.tsx +66 -0
- package/src/mail/mail-queries.ts +209 -0
- package/src/mail/mail-query-cache.ts +486 -0
- package/src/mail/mail-seed.ts +47 -0
- package/src/mail/mail-shell.tsx +126 -0
- package/src/mail/mailbox-ai-settings.tsx +185 -0
- package/src/mail/mailbox-realtime.tsx +251 -0
- package/src/mail/mailbox-route.tsx +15 -0
- package/src/mail/message-actions.tsx +353 -0
- package/src/mail/message-attachments.tsx +200 -0
- package/src/mail/message-format.ts +75 -0
- package/src/mail/message-header.tsx +260 -0
- package/src/mail/message-translation.tsx +225 -0
- package/src/mail/original-message-sheet.tsx +619 -0
- package/src/mail/original-message.ts +191 -0
- package/src/mail/outbound-notification.ts +53 -0
- package/src/mail/pane-splitter.tsx +117 -0
- package/src/mail/pdf-preview-toolbar.tsx +152 -0
- package/src/mail/pdf-preview.css +44 -0
- package/src/mail/pdf-preview.tsx +156 -0
- package/src/mail/pdf-translation-layout.ts +95 -0
- package/src/mail/print-message.ts +92 -0
- package/src/mail/reader-pane.tsx +535 -0
- package/src/mail/recipient-combobox.tsx +335 -0
- package/src/mail/recipient-field-row.tsx +34 -0
- package/src/mail/reply-to-warning.tsx +50 -0
- package/src/mail/sanitize-email-html.ts +430 -0
- package/src/mail/sender-actions.tsx +149 -0
- package/src/mail/sender-authentication.tsx +485 -0
- package/src/mail/sender-dialogs.tsx +384 -0
- package/src/mail/sender-security.tsx +545 -0
- package/src/mail/toolbar-tooltip.tsx +29 -0
- package/src/mail/translation-html.ts +49 -0
- package/src/mail/translation-language.ts +21 -0
- package/src/mail/types.ts +53 -0
- package/src/mail/unread-document-indicator.tsx +60 -0
- package/src/mail/use-compose-submission.ts +208 -0
- package/src/mail/use-composer-attachment-preflight.ts +184 -0
- package/src/mail/use-composer-submission.ts +117 -0
- package/src/mail/use-conversation-selection.ts +186 -0
- package/src/mail/use-mail-controller.ts +427 -0
- package/src/mail/use-mail-data.ts +279 -0
- package/src/mail/use-mail-safety.ts +155 -0
- package/src/mail/use-mail-send.ts +142 -0
- package/src/mail/use-pdf-translation-overlay.ts +156 -0
- package/src/mail/use-pdf-translation.ts +100 -0
- package/src/mail/use-pdf-viewer.ts +215 -0
- package/src/mail/use-reply-submission.ts +114 -0
- package/src/mail/use-sanitized-email-html.ts +20 -0
- package/src/mail/use-visible-message-read.ts +138 -0
- package/src/pwa/push-subscription.ts +151 -0
- package/src/settings/mail-apps-page.tsx +235 -0
- package/src/settings/notifications-page.tsx +291 -0
- package/worker/admin/blocked-sender-routes.ts +166 -0
- package/worker/admin/schemas.ts +11 -0
- package/worker/bindings.d.ts +14 -10
- package/worker/db/schema.ts +63 -40
- package/worker/jmap/eventsource.ts +84 -16
- package/worker/jmap/methods.ts +1630 -524
- package/worker/jmap/push-types.ts +27 -0
- package/worker/jmap/push.ts +140 -56
- package/worker/jmap/routes.ts +366 -105
- package/worker/mail/access.ts +258 -21
- package/worker/mail/ai-classification.ts +36 -20
- package/worker/mail/ai-translation.ts +13 -6
- package/worker/mail/auth-headers.ts +395 -137
- package/worker/mail/bimi.ts +200 -73
- package/worker/mail/bootstrap.ts +79 -0
- package/worker/mail/capped-body.ts +36 -0
- package/worker/mail/classification-signals.ts +35 -25
- package/worker/mail/conversation-cursor.ts +30 -19
- package/worker/mail/delivery-events.ts +88 -62
- package/worker/mail/delivery-facts.ts +46 -10
- package/worker/mail/demo-routes.ts +34 -10
- package/worker/mail/doh.ts +62 -23
- package/worker/mail/downloads.ts +75 -40
- package/worker/mail/edge-cache.ts +155 -0
- package/worker/mail/header-metadata.ts +88 -22
- package/worker/mail/impersonation.ts +160 -38
- package/worker/mail/import-routes.ts +313 -0
- package/worker/mail/inbound-delivery.ts +19 -9
- package/worker/mail/inbound-threading.ts +18 -8
- package/worker/mail/inbound.ts +82 -40
- package/worker/mail/ip-intel.ts +110 -27
- package/worker/mail/isolate-cache.ts +35 -0
- package/worker/mail/link-domains.ts +29 -7
- package/worker/mail/mailbox-deletion.ts +10 -4
- package/worker/mail/mailbox-directory.ts +16 -6
- package/worker/mail/mailing-list.ts +94 -39
- package/worker/mail/message-security.ts +90 -15
- package/worker/mail/message-view.ts +18 -6
- package/worker/mail/office-conversion.ts +31 -9
- package/worker/mail/office-preview-container.ts +40 -13
- package/worker/mail/office-preview-queue.ts +76 -32
- package/worker/mail/org-domain.ts +8 -1
- package/worker/mail/outbound-content.ts +71 -26
- package/worker/mail/outbound-delivery.ts +31 -17
- package/worker/mail/outbound-service.ts +48 -30
- package/worker/mail/outbound-threading.ts +30 -17
- package/worker/mail/outbound.ts +97 -70
- package/worker/mail/outgoing-context.ts +25 -15
- package/worker/mail/participants.ts +44 -29
- package/worker/mail/push-notifications.ts +271 -173
- package/worker/mail/quote-parser.ts +21 -10
- package/worker/mail/r2-presigned-urls.ts +31 -25
- package/worker/mail/receive.ts +23 -11
- package/worker/mail/recipients.ts +6 -1
- package/worker/mail/remote-proxy.ts +187 -31
- package/worker/mail/remote-routes.ts +87 -0
- package/worker/mail/remote-token.ts +104 -0
- package/worker/mail/repeat.ts +19 -0
- package/worker/mail/reply-plan.ts +62 -33
- package/worker/mail/rfc.ts +32 -7
- package/worker/mail/routes.ts +870 -541
- package/worker/mail/safety-routes.ts +328 -200
- package/worker/mail/schemas.ts +84 -105
- package/worker/mail/search.ts +1 -0
- package/worker/mail/security-settings.ts +41 -9
- package/worker/mail/sender-intel.ts +206 -51
- package/worker/mail/spamhaus.ts +92 -45
- package/worker/mail/unsubscribe.ts +76 -18
- package/worker/mail/uploads.ts +126 -93
- package/worker/mail/webhook-source.ts +35 -12
- package/worker/mail/workspace-safety.ts +97 -38
- package/worker/mailbox/demo-html.ts +7 -7
- package/worker/mailbox/demo-seed.ts +10 -44
- package/worker/mailbox/demo.ts +595 -225
- package/worker/mailbox/email-index.ts +53 -0
- package/worker/mailbox/folder-model.ts +53 -17
- package/worker/mailbox/import-placement.ts +88 -0
- package/worker/mailbox/inbox-counts.ts +106 -0
- package/worker/mailbox/index.ts +1734 -721
- package/worker/mailbox/jmap-store.ts +139 -35
- package/worker/mailbox/model.ts +8 -6
- package/worker/mailbox/office-preview-jobs.ts +56 -25
- package/worker/mailbox/schema.ts +87 -66
- package/worker/mailbox/senders.ts +176 -70
- package/worker/mcp/mail-action-tools.ts +128 -87
- package/worker/mcp/mail-compose-tools.ts +133 -82
- package/worker/mcp/mail-query-tools.ts +120 -71
- package/worker/mcp/mail-safety-tools.ts +321 -248
- package/worker/mcp/schemas.ts +43 -0
- package/worker/mcp/tools.ts +13 -10
- package/worker/module.ts +43 -18
- package/worker/sql.d.ts +8 -0
- package/alchemy.ts +0 -142
- package/containers/office-preview/Dockerfile +0 -10
- package/shared/mail-rules.ts +0 -156
- package/worker/admin/report-routes.ts +0 -164
- package/worker/mail/reported-messages.ts +0 -68
- package/worker/mailbox/migrations.ts +0 -10
- package/worker/mailbox/rules.ts +0 -110
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Checkbox,
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogClose,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropdownMenuContent,
|
|
13
|
+
DropdownMenuGroup,
|
|
14
|
+
DropdownMenuItem,
|
|
15
|
+
DropdownMenuLabel,
|
|
16
|
+
DropdownMenuTrigger,
|
|
17
|
+
} from "@open-workspace/core/ui";
|
|
18
|
+
import {
|
|
19
|
+
Archive,
|
|
20
|
+
FolderInput,
|
|
21
|
+
Inbox,
|
|
22
|
+
LoaderCircle,
|
|
23
|
+
Mail,
|
|
24
|
+
MailOpen,
|
|
25
|
+
OctagonAlert,
|
|
26
|
+
Trash2,
|
|
27
|
+
X,
|
|
28
|
+
} from "lucide-react";
|
|
29
|
+
import { useState } from "react";
|
|
30
|
+
import type { ReactNode } from "react";
|
|
31
|
+
|
|
32
|
+
import { orderedFolders } from "./mail-folders";
|
|
33
|
+
import { ToolbarTooltip } from "./toolbar-tooltip";
|
|
34
|
+
import type { MailFolder } from "./types";
|
|
35
|
+
import type { BulkConversationAction } from "./use-mail-data";
|
|
36
|
+
|
|
37
|
+
function ActionButton({
|
|
38
|
+
label,
|
|
39
|
+
disabled,
|
|
40
|
+
destructive = false,
|
|
41
|
+
onClick,
|
|
42
|
+
children,
|
|
43
|
+
}: {
|
|
44
|
+
label: string;
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
destructive?: boolean;
|
|
47
|
+
onClick: () => void;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<ToolbarTooltip label={label}>
|
|
52
|
+
<Button
|
|
53
|
+
type="button"
|
|
54
|
+
variant={destructive ? "destructive" : "ghost"}
|
|
55
|
+
size="icon-sm"
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
onClick={onClick}
|
|
58
|
+
>
|
|
59
|
+
{children}
|
|
60
|
+
<span className="sr-only">{label}</span>
|
|
61
|
+
</Button>
|
|
62
|
+
</ToolbarTooltip>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function ConversationSelectionToolbar({
|
|
67
|
+
sharedMailboxName,
|
|
68
|
+
canDeletePermanently,
|
|
69
|
+
folder,
|
|
70
|
+
folders,
|
|
71
|
+
selectedCount,
|
|
72
|
+
allLoadedSelected,
|
|
73
|
+
someLoadedSelected,
|
|
74
|
+
anySelectedUnread,
|
|
75
|
+
hasSelectedIncoming,
|
|
76
|
+
allSelectedHaveIncoming,
|
|
77
|
+
busy,
|
|
78
|
+
onToggleAll,
|
|
79
|
+
onAction,
|
|
80
|
+
onReport,
|
|
81
|
+
onExit,
|
|
82
|
+
}: {
|
|
83
|
+
sharedMailboxName?: string;
|
|
84
|
+
canDeletePermanently: boolean;
|
|
85
|
+
folder: string;
|
|
86
|
+
folders: MailFolder[];
|
|
87
|
+
selectedCount: number;
|
|
88
|
+
allLoadedSelected: boolean;
|
|
89
|
+
someLoadedSelected: boolean;
|
|
90
|
+
anySelectedUnread: boolean;
|
|
91
|
+
hasSelectedIncoming: boolean;
|
|
92
|
+
allSelectedHaveIncoming: boolean;
|
|
93
|
+
busy: boolean;
|
|
94
|
+
onToggleAll: () => void;
|
|
95
|
+
onAction: (action: BulkConversationAction, verb: string) => void;
|
|
96
|
+
onReport: () => void;
|
|
97
|
+
onExit: () => void;
|
|
98
|
+
}) {
|
|
99
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
100
|
+
const activeFolder = folders.find((item) => item.id === folder);
|
|
101
|
+
const systemType = activeFolder?.systemType;
|
|
102
|
+
|
|
103
|
+
const customFolders = orderedFolders(folders).filter(
|
|
104
|
+
(item) => item.kind === "custom"
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const isInboxDistribution =
|
|
108
|
+
systemType === "inbox" || activeFolder?.kind === "custom";
|
|
109
|
+
|
|
110
|
+
const nothingSelected = selectedCount === 0;
|
|
111
|
+
const disabled = busy || nothingSelected;
|
|
112
|
+
const moveDisabled = disabled || !allSelectedHaveIncoming;
|
|
113
|
+
|
|
114
|
+
const conversationLabel =
|
|
115
|
+
selectedCount === 1 ? "conversation" : "conversations";
|
|
116
|
+
|
|
117
|
+
const sharedSuffix = sharedMailboxName
|
|
118
|
+
? ` for everyone in ${sharedMailboxName}`
|
|
119
|
+
: "";
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<div className="border-border bg-surface lg:bg-surface-sunken/70 fixed inset-x-0 bottom-0 z-40 flex h-[calc(3.75rem+env(safe-area-inset-bottom))] items-center gap-1 border-t px-3 pb-[env(safe-area-inset-bottom)] lg:static lg:h-10 lg:w-auto lg:rounded-lg lg:border lg:px-1.5 lg:pb-0">
|
|
124
|
+
<label className="mr-auto flex min-w-0 items-center gap-2 pr-2 lg:mr-1">
|
|
125
|
+
<Checkbox
|
|
126
|
+
checked={allLoadedSelected}
|
|
127
|
+
indeterminate={someLoadedSelected && !allLoadedSelected}
|
|
128
|
+
disabled={busy}
|
|
129
|
+
aria-label={
|
|
130
|
+
allLoadedSelected
|
|
131
|
+
? "Deselect loaded conversations"
|
|
132
|
+
: "Select loaded conversations"
|
|
133
|
+
}
|
|
134
|
+
onCheckedChange={onToggleAll}
|
|
135
|
+
/>
|
|
136
|
+
<span className="truncate text-xs font-semibold tabular-nums">
|
|
137
|
+
{selectedCount} selected
|
|
138
|
+
</span>
|
|
139
|
+
</label>
|
|
140
|
+
|
|
141
|
+
<ActionButton
|
|
142
|
+
label={
|
|
143
|
+
anySelectedUnread
|
|
144
|
+
? "Mark selected as read"
|
|
145
|
+
: "Mark selected as unread"
|
|
146
|
+
}
|
|
147
|
+
disabled={disabled || !hasSelectedIncoming}
|
|
148
|
+
onClick={() =>
|
|
149
|
+
onAction(
|
|
150
|
+
{ type: "read", isRead: anySelectedUnread },
|
|
151
|
+
anySelectedUnread ? "marked as read" : "marked as unread"
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
{busy ? (
|
|
156
|
+
<LoaderCircle className="animate-spin" />
|
|
157
|
+
) : anySelectedUnread ? (
|
|
158
|
+
<MailOpen />
|
|
159
|
+
) : (
|
|
160
|
+
<Mail />
|
|
161
|
+
)}
|
|
162
|
+
</ActionButton>
|
|
163
|
+
|
|
164
|
+
{isInboxDistribution ? (
|
|
165
|
+
<ActionButton
|
|
166
|
+
label={`Archive selected${sharedSuffix}`}
|
|
167
|
+
disabled={disabled}
|
|
168
|
+
onClick={() =>
|
|
169
|
+
onAction(
|
|
170
|
+
{ type: "update", update: { mailboxState: "archive" } },
|
|
171
|
+
"archived"
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
>
|
|
175
|
+
<Archive />
|
|
176
|
+
</ActionButton>
|
|
177
|
+
) : null}
|
|
178
|
+
{["archive", "spam", "trash"].includes(systemType ?? "") ? (
|
|
179
|
+
<ActionButton
|
|
180
|
+
label={
|
|
181
|
+
systemType === "spam"
|
|
182
|
+
? `Mark selected as not spam${sharedSuffix}`
|
|
183
|
+
: `Restore selected${sharedSuffix}`
|
|
184
|
+
}
|
|
185
|
+
disabled={disabled}
|
|
186
|
+
onClick={() =>
|
|
187
|
+
onAction(
|
|
188
|
+
{ type: "update", update: { mailboxState: "active" } },
|
|
189
|
+
systemType === "spam" ? "marked as not spam" : "restored"
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
>
|
|
193
|
+
<Inbox />
|
|
194
|
+
</ActionButton>
|
|
195
|
+
) : null}
|
|
196
|
+
|
|
197
|
+
<DropdownMenu>
|
|
198
|
+
<ToolbarTooltip label={`Move selected${sharedSuffix}`}>
|
|
199
|
+
<DropdownMenuTrigger
|
|
200
|
+
render={
|
|
201
|
+
<Button
|
|
202
|
+
type="button"
|
|
203
|
+
variant="ghost"
|
|
204
|
+
size="icon-sm"
|
|
205
|
+
disabled={moveDisabled}
|
|
206
|
+
/>
|
|
207
|
+
}
|
|
208
|
+
>
|
|
209
|
+
<FolderInput />
|
|
210
|
+
<span className="sr-only">Move selected</span>
|
|
211
|
+
</DropdownMenuTrigger>
|
|
212
|
+
</ToolbarTooltip>
|
|
213
|
+
<DropdownMenuContent align="end" className="w-64">
|
|
214
|
+
<DropdownMenuGroup>
|
|
215
|
+
<DropdownMenuLabel>Move to</DropdownMenuLabel>
|
|
216
|
+
<DropdownMenuItem
|
|
217
|
+
disabled={systemType === "inbox"}
|
|
218
|
+
onClick={() =>
|
|
219
|
+
onAction(
|
|
220
|
+
{
|
|
221
|
+
type: "update",
|
|
222
|
+
update: { mailboxState: "active", folderId: null },
|
|
223
|
+
},
|
|
224
|
+
"moved to Inbox"
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
>
|
|
228
|
+
<Inbox /> Inbox
|
|
229
|
+
</DropdownMenuItem>
|
|
230
|
+
{customFolders.map((item) => (
|
|
231
|
+
<DropdownMenuItem
|
|
232
|
+
key={item.id}
|
|
233
|
+
disabled={item.id === folder}
|
|
234
|
+
onClick={() =>
|
|
235
|
+
onAction(
|
|
236
|
+
{
|
|
237
|
+
type: "update",
|
|
238
|
+
update: { mailboxState: "active", folderId: item.id },
|
|
239
|
+
},
|
|
240
|
+
`moved to ${item.name}`
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
>
|
|
244
|
+
<FolderInput /> {item.name}
|
|
245
|
+
</DropdownMenuItem>
|
|
246
|
+
))}
|
|
247
|
+
</DropdownMenuGroup>
|
|
248
|
+
</DropdownMenuContent>
|
|
249
|
+
</DropdownMenu>
|
|
250
|
+
|
|
251
|
+
{systemType === "trash" ? (
|
|
252
|
+
canDeletePermanently ? (
|
|
253
|
+
<ActionButton
|
|
254
|
+
label="Delete selected permanently"
|
|
255
|
+
destructive
|
|
256
|
+
disabled={disabled}
|
|
257
|
+
onClick={() => setDeleteDialogOpen(true)}
|
|
258
|
+
>
|
|
259
|
+
<Trash2 />
|
|
260
|
+
</ActionButton>
|
|
261
|
+
) : null
|
|
262
|
+
) : (
|
|
263
|
+
<ActionButton
|
|
264
|
+
label={`Move selected to Trash${sharedSuffix}`}
|
|
265
|
+
disabled={disabled}
|
|
266
|
+
onClick={() =>
|
|
267
|
+
onAction(
|
|
268
|
+
{ type: "update", update: { mailboxState: "trash" } },
|
|
269
|
+
"moved to Trash"
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
>
|
|
273
|
+
<Trash2 />
|
|
274
|
+
</ActionButton>
|
|
275
|
+
)}
|
|
276
|
+
|
|
277
|
+
{["sent", "spam", "trash"].includes(systemType ?? "") ? null : (
|
|
278
|
+
<ActionButton
|
|
279
|
+
label="Report spam"
|
|
280
|
+
disabled={disabled || !hasSelectedIncoming}
|
|
281
|
+
onClick={onReport}
|
|
282
|
+
>
|
|
283
|
+
<OctagonAlert />
|
|
284
|
+
</ActionButton>
|
|
285
|
+
)}
|
|
286
|
+
|
|
287
|
+
<span className="bg-border mx-0.5 hidden h-5 w-px lg:block" />
|
|
288
|
+
<ActionButton label="Exit selection" disabled={busy} onClick={onExit}>
|
|
289
|
+
<X />
|
|
290
|
+
</ActionButton>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<Dialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
|
|
294
|
+
<DialogContent>
|
|
295
|
+
<DialogHeader>
|
|
296
|
+
<DialogTitle>Delete permanently?</DialogTitle>
|
|
297
|
+
<DialogDescription>
|
|
298
|
+
{selectedCount} selected {conversationLabel} and all attachments
|
|
299
|
+
will be deleted for everyone. This cannot be undone.
|
|
300
|
+
</DialogDescription>
|
|
301
|
+
</DialogHeader>
|
|
302
|
+
<DialogFooter>
|
|
303
|
+
<DialogClose render={<Button type="button" variant="outline" />}>
|
|
304
|
+
Cancel
|
|
305
|
+
</DialogClose>
|
|
306
|
+
<Button
|
|
307
|
+
type="button"
|
|
308
|
+
variant="destructive"
|
|
309
|
+
disabled={busy}
|
|
310
|
+
onClick={() => {
|
|
311
|
+
setDeleteDialogOpen(false);
|
|
312
|
+
onAction({ type: "delete_permanently" }, "deleted permanently");
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
Delete permanently
|
|
316
|
+
</Button>
|
|
317
|
+
</DialogFooter>
|
|
318
|
+
</DialogContent>
|
|
319
|
+
</Dialog>
|
|
320
|
+
</>
|
|
321
|
+
);
|
|
322
|
+
}
|