@octarq/plugin-mail 0.0.0-stage → 0.1.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/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { lazy } from "react";
2
+ import type { UIPlugin } from "@octarq/plugin-sdk";
3
+ import { mailI18n } from "./i18n";
4
+
5
+ const mail: UIPlugin = {
6
+ name: "mail",
7
+ routes: [{ path: "/mail", Component: lazy(() => import("./pages")) }],
8
+ widgets: [
9
+ { slot: "home-overview", order: 20, Component: lazy(() => import("./widgets/MailStatCardWidget")) },
10
+ { slot: "home-setup-steps", order: 30, Component: lazy(() => import("./widgets/MailSetupStepWidget")) },
11
+ { slot: "home-rows", order: 10, Component: lazy(() => import("./widgets/RecentMailPanelWidget")) },
12
+ ],
13
+ i18n: mailI18n,
14
+ };
15
+
16
+ export { mail, mail as mailPlugin };
17
+ export default mail;
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@octarq/plugin-mail",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Mailboxes, SMTP relay, and inbound webhook processing plugin for Octarq",
5
+ "type": "module",
6
+ "main": "./index.ts",
7
+ "types": "./index.ts",
8
+ "exports": {
9
+ ".": "./index.ts"
10
+ },
11
+ "peerDependencies": {
12
+ "@octarq/plugin-sdk": "^0.25.0",
13
+ "react": "^18.3.1",
14
+ "react-dom": "^18.3.1",
15
+ "react-router-dom": "^6.28.0 || ^7.0.0"
16
+ },
17
+ "dependencies": {
18
+ "lucide-react": "^1.21.0"
19
+ },
20
+ "devDependencies": {
21
+ "@octarq/plugin-sdk": "^0.25.0",
22
+ "@types/react": "^18.3.1",
23
+ "@types/react-dom": "^18.3.1",
24
+ "react": "^18.3.1",
25
+ "react-dom": "^18.3.1",
26
+ "react-router-dom": "^6.28.0",
27
+ "typescript": "^5.6.0"
28
+ }
6
29
  }
@@ -0,0 +1,33 @@
1
+ import { Badge } from "@octarq/plugin-sdk";
2
+
3
+ export function AuthBadges({
4
+ spf,
5
+ dkim,
6
+ dmarc,
7
+ compact = false,
8
+ }: {
9
+ spf?: string;
10
+ dkim?: string;
11
+ dmarc?: string;
12
+ compact?: boolean;
13
+ }) {
14
+ const badge = (label: string, result: string | undefined) => {
15
+ if (!result || result === "none" || result === "") return null;
16
+ const pass = result === "pass";
17
+ const warn = result === "softfail" || result === "neutral";
18
+ if (compact && pass) return null; // only show problems in list view
19
+
20
+ let tone: "success" | "warning" | "danger" = "danger";
21
+ if (pass) tone = "success";
22
+ else if (warn) tone = "warning";
23
+
24
+ return (
25
+ <Badge key={label} tone={tone} className="font-mono text-[10px] uppercase tracking-wider">
26
+ {label}:{result}
27
+ </Badge>
28
+ );
29
+ };
30
+ const badges = [badge("SPF", spf), badge("DKIM", dkim), badge("DMARC", dmarc)].filter(Boolean);
31
+ if (badges.length === 0) return null;
32
+ return <div className="flex gap-1 items-center">{badges}</div>;
33
+ }
@@ -0,0 +1,291 @@
1
+ import { Field, Input, Textarea, Modal, Button, Select, FormError, buttonVariants, toast, useTranslation } from "@octarq/plugin-sdk";
2
+ import { useEffect, useState, useRef } from "react";
3
+ import { Link } from "react-router-dom";
4
+ import { mailApi, MailContact } from "../api";
5
+ import { CheckCircle, Save, AlertTriangle } from "lucide-react";
6
+ import { ReplyDraft } from "./types";
7
+
8
+ export function Compose({
9
+ draft,
10
+ onClose,
11
+ onDraftSaved,
12
+ }: {
13
+ draft?: ReplyDraft;
14
+ onClose: () => void;
15
+ onDraftSaved?: () => void;
16
+ }) {
17
+ const [draftId, setDraftId] = useState<number | undefined>(draft?.id);
18
+ const [to, setTo] = useState(draft?.to ?? "");
19
+ const [from, setFrom] = useState("");
20
+ const [subject, setSubject] = useState(draft?.subject ?? "");
21
+ const [text, setText] = useState(draft?.text ?? "");
22
+ const [smtpSenderId, setSmtpSenderId] = useState<number>(0);
23
+ // Which registry owns smtpSenderId. The two registries number their rows
24
+ // independently, so the ID alone cannot identify a sender.
25
+ const [senderSource, setSenderSource] = useState<"local" | "integration" | null>(null);
26
+ const [senders, setSenders] = useState<any[]>([]);
27
+ const [loadingSenders, setLoadingSenders] = useState(true);
28
+ const [err, setErr] = useState<string | { message?: string; status?: number; requestId?: string }>("");
29
+ const [ok, setOk] = useState(false);
30
+ const [autoWrapLinksEnabled, setAutoWrapLinksEnabled] = useState(false);
31
+ const [trackLinks, setTrackLinks] = useState(false);
32
+
33
+ // Contacts autocomplete
34
+ const [contacts, setContacts] = useState<MailContact[]>([]);
35
+ const [showSuggestions, setShowSuggestions] = useState(false);
36
+ const toContainerRef = useRef<HTMLDivElement>(null);
37
+ const blurTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
38
+ const { t } = useTranslation();
39
+
40
+ useEffect(() => {
41
+ return () => {
42
+ if (blurTimerRef.current) clearTimeout(blurTimerRef.current);
43
+ };
44
+ }, []);
45
+
46
+ useEffect(() => {
47
+ let cancelled = false;
48
+ setLoadingSenders(true);
49
+ (async () => {
50
+ try {
51
+ const res = await fetch("/api/vault/items?provider_type=communication", {
52
+ credentials: "same-origin",
53
+ });
54
+ if (res.status === 404) {
55
+ // Core Vault is unavailable on this instance: the local SMTP sender
56
+ // registry is the only source, so offer it instead of an empty list.
57
+ const list = await mailApi.smtpSenders();
58
+ if (cancelled) return;
59
+ setSenderSource("local");
60
+ setSenders(list);
61
+ setSmtpSenderId(list.length > 0 ? list[0].id : 0);
62
+ return;
63
+ }
64
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
65
+ const data = await res.json();
66
+ const raw = Array.isArray(data) ? data : (data?.body ?? []);
67
+ const commSenders = (Array.isArray(raw) ? raw : []).filter(
68
+ (item: any) => item.provider === "smtp" || item.provider === "resend"
69
+ );
70
+ if (cancelled) return;
71
+ setSenderSource("integration");
72
+ setSenders(commSenders);
73
+ const preferred = commSenders.find((s: any) => s.isDefault) || commSenders[0];
74
+ setSmtpSenderId(preferred ? preferred.id : 0);
75
+ } catch {
76
+ if (cancelled) return;
77
+ // Do not guess at a sender when the lookup fails: sending through the
78
+ // wrong registry is worse than asking the user to retry.
79
+ setSenderSource(null);
80
+ setSenders([]);
81
+ setSmtpSenderId(0);
82
+ } finally {
83
+ if (!cancelled) setLoadingSenders(false);
84
+ }
85
+ })();
86
+
87
+ mailApi.settings().then((s: any) => {
88
+ if (s.autoWrapLinks) {
89
+ setAutoWrapLinksEnabled(true);
90
+ setTrackLinks(true);
91
+ }
92
+ }).catch(() => {});
93
+
94
+ return () => {
95
+ cancelled = true;
96
+ };
97
+ }, []);
98
+
99
+ useEffect(() => {
100
+ if (!to.trim()) {
101
+ mailApi.contacts({ limit: 5 }).then(setContacts).catch(() => {});
102
+ return;
103
+ }
104
+ const timer = setTimeout(() => {
105
+ mailApi.contacts({ query: to.trim(), limit: 5 }).then(setContacts).catch(() => {});
106
+ }, 150);
107
+ return () => clearTimeout(timer);
108
+ }, [to]);
109
+
110
+ async function handleSaveDraft() {
111
+ try {
112
+ const res = await mailApi.saveDraft({
113
+ id: draftId,
114
+ to,
115
+ subject,
116
+ text,
117
+ });
118
+ setDraftId(res.id);
119
+ toast.success(t("mail.draftSaved"));
120
+ onDraftSaved?.();
121
+ } catch (e: any) {
122
+ toast.error(e.message || "Failed to save draft");
123
+ }
124
+ }
125
+
126
+ async function send() {
127
+ setErr("");
128
+ try {
129
+ await mailApi.sendEmail({
130
+ to: to.split(",").map((s) => s.trim()).filter(Boolean),
131
+ from,
132
+ subject,
133
+ text,
134
+ smtpSenderId: smtpSenderId || undefined,
135
+ smtpSenderSource: senderSource ?? undefined,
136
+ trackLinks: autoWrapLinksEnabled ? trackLinks : false,
137
+ });
138
+ if (draftId) {
139
+ mailApi.deleteDraft(draftId).catch(() => {});
140
+ }
141
+ setOk(true);
142
+ } catch (e: any) {
143
+ setErr(e);
144
+ }
145
+ }
146
+
147
+ function selectContact(c: MailContact) {
148
+ setTo(c.address);
149
+ setShowSuggestions(false);
150
+ }
151
+
152
+ return (
153
+ <Modal title={t("mail.composeMail")} onClose={onClose}>
154
+ {ok ? (
155
+ <div className="py-6 text-center space-y-4">
156
+ <div className="h-12 w-12 rounded-full bg-success-bg border border-success-border flex items-center justify-center text-success-fg mx-auto">
157
+ <CheckCircle className="h-6 w-6" />
158
+ </div>
159
+ <p className="text-foreground font-semibold">{t("mail.messageSent")}</p>
160
+ <Button variant="primary" onClick={onClose} >
161
+ {t("mail.done")}
162
+ </Button>
163
+ </div>
164
+ ) : (
165
+ <div className="space-y-4">
166
+ {!loadingSenders && senders.length === 0 ? (
167
+ <div className="rounded-lg border border-warning-border bg-warning-bg p-4 text-xs text-foreground space-y-3">
168
+ <div className="flex items-start gap-2.5">
169
+ <AlertTriangle className="h-4 w-4 text-warning-fg shrink-0 mt-0.5" />
170
+ <div className="space-y-1">
171
+ <p className="font-semibold text-foreground">
172
+ {t("settings.noSmtpSenders")}
173
+ </p>
174
+ <p className="text-muted-foreground">
175
+ {senderSource === "local"
176
+ ? t("settings.smtpLocalSenderHint", "Add a local SMTP sender in Outgoing Gateways, then return here.")
177
+ : t("settings.integrationsHubBanner")}
178
+ </p>
179
+ </div>
180
+ </div>
181
+ {senderSource === "integration" && (
182
+ <Link
183
+ to="/settings/integrations?category=communication"
184
+ className={buttonVariants({ variant: "primary", size: "sm" })}
185
+ >
186
+ {t("settings.openIntegrationsHub")} →
187
+ </Link>
188
+ )}
189
+ </div>
190
+ ) : (
191
+ <Field label={t("mail.smtpConnection")} hint={t("mail.smtpConnectionHint")}>
192
+ <Select
193
+ className="text-sm"
194
+ value={String(smtpSenderId)}
195
+ onValueChange={(v) => setSmtpSenderId(Number(v))}
196
+ options={senders.map((s) => {
197
+ const detail =
198
+ s.metadata?.fromEmail ||
199
+ s.fromEmail ||
200
+ s.summary ||
201
+ s.metadata?.smtpHost ||
202
+ s.provider;
203
+ return {
204
+ value: String(s.id),
205
+ label: detail ? `${s.name} (${detail})` : s.name,
206
+ };
207
+ })}
208
+ />
209
+ </Field>
210
+ )}
211
+ <Field label={t("mail.fromOverride")} hint={t("mail.fromOverrideHint")}>
212
+ <Input className="font-mono text-sm" value={from} onChange={(e) => setFrom(e.target.value)} placeholder={t("mail.fromPlaceholder")} />
213
+ </Field>
214
+ <div ref={toContainerRef} className="relative">
215
+ <Field label={t("mail.toRecipients")} hint={t("mail.toHint")}>
216
+ <Input
217
+ className="font-mono text-sm"
218
+ value={to}
219
+ onChange={(e) => {
220
+ setTo(e.target.value);
221
+ setShowSuggestions(true);
222
+ }}
223
+ onFocus={() => setShowSuggestions(true)}
224
+ onBlur={() => {
225
+ blurTimerRef.current = setTimeout(() => setShowSuggestions(false), 200);
226
+ }}
227
+ placeholder={t("mail.toPlaceholder")}
228
+ required
229
+ />
230
+ </Field>
231
+ {showSuggestions && contacts.length > 0 && (
232
+ <div className="absolute left-0 right-0 top-full mt-1 z-30 bg-card border border-border rounded-lg shadow-lg overflow-hidden divide-y divide-border">
233
+ {contacts.map((c) => (
234
+ <button
235
+ key={c.id}
236
+ type="button"
237
+ className="px-3.5 py-2 text-left text-xs hover:bg-well transition-colors flex items-center justify-between cursor-pointer"
238
+ onMouseDown={(e) => {
239
+ e.preventDefault();
240
+ selectContact(c);
241
+ }}
242
+ >
243
+ <span className="font-mono text-foreground">{c.name ? `${c.name} <${c.address}>` : c.address}</span>
244
+ <span className="text-[10px] text-muted-foreground font-mono">{c.interactionCount}</span>
245
+ </button>
246
+ ))}
247
+ </div>
248
+ )}
249
+ </div>
250
+ <Field label={t("mail.subjectTitle")}>
251
+ <Input className="text-sm" value={subject} onChange={(e) => setSubject(e.target.value)} placeholder={t("mail.subjectPlaceholder")} required />
252
+ </Field>
253
+ <Field label={t("mail.bodyLabel")}>
254
+ <Textarea className="text-sm font-sans" rows={6} value={text} onChange={(e) => setText(e.target.value)} placeholder={t("mail.bodyPlaceholder")} required />
255
+ </Field>
256
+ {autoWrapLinksEnabled && (
257
+ <label className="flex items-center gap-2 cursor-pointer text-[13px] text-foreground select-none">
258
+ <Input
259
+ type="checkbox"
260
+ checked={trackLinks}
261
+ onChange={(e) => setTrackLinks(e.target.checked)}
262
+ className="h-4 w-4 rounded border-border accent-primary"
263
+ />
264
+ <span>{t("mail.trackLinks")}</span>
265
+ </label>
266
+ )}
267
+ {err && <FormError err={err} />}
268
+ <div className="flex items-center justify-between gap-2.5 pt-4 border-t border-border">
269
+ <Button
270
+ variant="outline"
271
+ type="button"
272
+ onClick={handleSaveDraft}
273
+ className="text-xs py-1.5 px-3 gap-1.5"
274
+ >
275
+ <Save className="h-3.5 w-3.5" />
276
+ {t("mail.saveDraft")}
277
+ </Button>
278
+ <div className="flex gap-2">
279
+ <Button variant="ghost" onClick={onClose}>
280
+ {t("mail.cancel")}
281
+ </Button>
282
+ <Button variant="primary" onClick={send} disabled={!to || !subject || senders.length === 0}>
283
+ {t("mail.sendMail")}
284
+ </Button>
285
+ </div>
286
+ </div>
287
+ </div>
288
+ )}
289
+ </Modal>
290
+ );
291
+ }
@@ -0,0 +1,85 @@
1
+ import { Badge, timeAgo, useTranslation } from "@octarq/plugin-sdk";
2
+ import { Email } from "../api";
3
+ import { AuthBadges } from "./AuthBadges";
4
+ import { MailFolder } from "./types";
5
+
6
+ interface EmailListItemProps {
7
+ email: Email;
8
+ folder: MailFolder;
9
+ isSelected: boolean;
10
+ onSelect: () => void;
11
+ }
12
+
13
+ const CATEGORY_META: Record<string, { tone: "warning" | "info" | "danger" | "default"; label: string }> = {
14
+ bill: { tone: "warning", label: "Bill" },
15
+ otp: { tone: "info", label: "OTP" },
16
+ marketing: { tone: "default", label: "Marketing" },
17
+ important: { tone: "danger", label: "Important" },
18
+ };
19
+
20
+ function renderImportanceDots(n?: number) {
21
+ if (!n || n <= 0) return null;
22
+ const clamped = Math.max(1, Math.min(5, n));
23
+ return (
24
+ <span
25
+ className="text-[10px] tracking-wider text-warning-fg/80"
26
+ title={`Importance: ${clamped}/5`}
27
+ data-testid="importance-dots"
28
+ >
29
+ {"●".repeat(clamped)}{"○".repeat(5 - clamped)}
30
+ </span>
31
+ );
32
+ }
33
+
34
+ export function EmailListItem({
35
+ email,
36
+ folder,
37
+ isSelected,
38
+ onSelect,
39
+ }: EmailListItemProps) {
40
+ const { t } = useTranslation();
41
+
42
+ const isOutbound = folder === "sent" || folder === "drafts";
43
+ const displayAddress = isOutbound
44
+ ? (email.to ? `${t("mail.toLabel")} ${email.to}` : t("mail.noSubject"))
45
+ : (email.from || t("mail.unknownSender"));
46
+
47
+ const catMeta = email.category ? CATEGORY_META[email.category] : undefined;
48
+
49
+ return (
50
+ <button
51
+ type="button"
52
+ className={`flex w-full flex-col border-l-2 p-3.5 text-left transition-colors duration-[var(--dur-fast)] cursor-pointer ${
53
+ isSelected ? "border-primary bg-accent-soft" : "border-transparent hover:bg-well"
54
+ }`}
55
+ onClick={onSelect}
56
+ >
57
+ <div className="mb-1 flex w-full items-center justify-between gap-2">
58
+ <div className="flex min-w-0 items-center gap-2">
59
+ {!email.read && <span className="h-1.5 w-1.5 shrink-0 rounded-full bg-primary" />}
60
+ <span className={`truncate text-[13px] ${email.read ? "text-muted-foreground" : "font-semibold text-foreground"}`}>
61
+ {displayAddress}
62
+ </span>
63
+ {catMeta && (
64
+ <Badge tone={catMeta.tone} className="shrink-0 px-1.5 py-0 text-[10px] font-medium uppercase">
65
+ {t(`mail.cat_${email.category}`, catMeta.label)}
66
+ </Badge>
67
+ )}
68
+ </div>
69
+ <div className="ml-2 flex shrink-0 items-center gap-1.5">
70
+ {renderImportanceDots(email.importance)}
71
+ {!isOutbound && <AuthBadges spf={email.authSpf} dkim={email.authDkim} dmarc={email.authDmarc} compact />}
72
+ <span className="font-mono text-[10.5px] text-muted-foreground">{timeAgo(email.receivedAt)}</span>
73
+ </div>
74
+ </div>
75
+ <div className={`truncate text-xs ${email.read ? "text-muted-foreground" : "font-medium text-foreground"}`}>
76
+ {email.subject || t("mail.noSubject")}
77
+ </div>
78
+ {email.summary && email.summary !== email.subject && (
79
+ <p className="mt-1 line-clamp-1 text-[11px] text-muted-foreground">
80
+ {email.summary}
81
+ </p>
82
+ )}
83
+ </button>
84
+ );
85
+ }
@@ -0,0 +1,152 @@
1
+ import { PageCard, Empty, Button, Input, Skeleton, useTranslation } from "@octarq/plugin-sdk";
2
+ import { Search, X, Mail as MailIcon, Inbox } from "lucide-react";
3
+ import { Email, Mailbox } from "../api";
4
+ import { MailFolder } from "./types";
5
+ import { EmailListItem } from "./EmailListItem";
6
+
7
+ interface EmailListPaneProps {
8
+ emails: Email[];
9
+ loading: boolean;
10
+ folder: MailFolder;
11
+ q: string;
12
+ onSearchChange: (q: string) => void;
13
+ openEmailId?: number;
14
+ onOpenEmail: (e: Email) => void;
15
+ onScroll: (e: React.UIEvent<HTMLDivElement>) => void;
16
+ boxes: Mailbox[];
17
+ activeMailboxId?: number;
18
+ onNewBox: () => void;
19
+ }
20
+
21
+ export function EmailListPane({
22
+ emails,
23
+ loading,
24
+ folder,
25
+ q,
26
+ onSearchChange,
27
+ openEmailId,
28
+ onOpenEmail,
29
+ onScroll,
30
+ boxes,
31
+ activeMailboxId,
32
+ onNewBox,
33
+ }: EmailListPaneProps) {
34
+ const { t } = useTranslation();
35
+
36
+ return (
37
+ <div className="flex h-full min-h-0 w-full flex-col">
38
+ <div className="relative mb-3">
39
+ <Search className="pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
40
+ <Input
41
+ className="!pl-10"
42
+ aria-label={t("mail.searchPlaceholder")}
43
+ placeholder={t("mail.searchPlaceholder")}
44
+ value={q}
45
+ onChange={(e) => onSearchChange(e.target.value)}
46
+ />
47
+ {q && (
48
+ <button
49
+ type="button"
50
+ onClick={() => onSearchChange("")}
51
+ aria-label={t("mail.clearSearch")}
52
+ className="absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer rounded-md p-0.5 text-muted-foreground transition-colors duration-[var(--dur-fast)] hover:bg-surface-hover hover:text-foreground"
53
+ >
54
+ <X className="h-3.5 w-3.5" />
55
+ </button>
56
+ )}
57
+ </div>
58
+
59
+ <PageCard className="mt-0 flex-1 overflow-hidden p-0">
60
+ {emails.length === 0 && loading ? (
61
+ <div
62
+ role="status"
63
+ aria-busy="true"
64
+ aria-label={t("mail.loading")}
65
+ className="divide-y divide-border"
66
+ >
67
+ {Array.from({ length: 7 }).map((_, i) => (
68
+ <div key={i} className="flex flex-col gap-1.5 p-3.5">
69
+ <div className="flex items-center justify-between gap-2">
70
+ <Skeleton className="h-3.5 w-36" />
71
+ <Skeleton className="h-3 w-12" />
72
+ </div>
73
+ <Skeleton className="h-3.5 w-4/5" />
74
+ <Skeleton className="h-3 w-3/5" />
75
+ </div>
76
+ ))}
77
+ </div>
78
+ ) : (
79
+ <div className="max-h-[650px] divide-y divide-border overflow-y-auto" onScroll={onScroll}>
80
+ {emails.length === 0 ? (
81
+ q ? (
82
+ <div className="flex flex-col items-center gap-2.5 px-6 py-10 text-center">
83
+ <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground">
84
+ <Search className="h-4 w-4" />
85
+ </div>
86
+ <p className="text-[13px] text-muted-foreground">
87
+ {t("mail.emptyFilteredReason")} <span className="font-mono text-foreground">{`“${q}”`}</span>
88
+ </p>
89
+ <Button variant="ghost" size="sm" onClick={() => onSearchChange("")}>
90
+ {t("mail.clearSearch")}
91
+ </Button>
92
+ </div>
93
+ ) : boxes.length === 0 ? (
94
+ <Empty
95
+ reason={t("mail.emptyNoBoxesReason")}
96
+ detail={t("mail.emptyNoBoxesDetail")}
97
+ action={
98
+ <Button variant="primary" size="sm" className="mt-1" onClick={onNewBox}>
99
+ {t("mail.newMailbox")}
100
+ </Button>
101
+ }
102
+ >
103
+ <MailIcon />
104
+ </Empty>
105
+ ) : (
106
+ <Empty
107
+ reason={
108
+ <>
109
+ {t("mail.emptyInboxReasonPre")}{" "}
110
+ <span className="font-mono">
111
+ {`“${boxes.find((b) => b.id === activeMailboxId)?.address ?? boxes[0]?.address}”`}
112
+ </span>
113
+ </>
114
+ }
115
+ detail={t("mail.emptyInboxDetail")}
116
+ >
117
+ <Inbox />
118
+ </Empty>
119
+ )
120
+ ) : (
121
+ <>
122
+ {emails.map((e) => (
123
+ <EmailListItem
124
+ key={e.id}
125
+ email={e}
126
+ folder={folder}
127
+ isSelected={openEmailId === e.id}
128
+ onSelect={() => onOpenEmail(e)}
129
+ />
130
+ ))}
131
+ {loading && (
132
+ <div
133
+ role="status"
134
+ aria-busy="true"
135
+ aria-label={t("mail.loading")}
136
+ className="flex flex-col gap-1.5 p-3.5"
137
+ >
138
+ <div className="flex items-center justify-between gap-2">
139
+ <Skeleton className="h-3.5 w-32" />
140
+ <Skeleton className="h-3 w-12" />
141
+ </div>
142
+ <Skeleton className="h-3.5 w-3/4" />
143
+ </div>
144
+ )}
145
+ </>
146
+ )}
147
+ </div>
148
+ )}
149
+ </PageCard>
150
+ </div>
151
+ );
152
+ }