diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index d4c90318..c0de511b 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -60,25 +60,7 @@ import { useConfig } from "@/hooks/use-config"; import { usePluginStore } from "@/stores/plugin-store"; import { useThemeStore } from "@/stores/theme-store"; import { appLifecycleHooks, uiHooks, routerHooks, toastHooks, emailHooks } from "@/lib/plugin-hooks"; -import type { EmailReadView } from "@/lib/plugin-types"; - -function emailToReadView(email: Email): EmailReadView { - return { - id: email.id, - threadId: email.threadId, - mailboxIds: Object.keys(email.mailboxIds || {}).filter(k => email.mailboxIds[k]), - from: (email.from || []).map(a => ({ name: a.name || '', email: a.email })), - to: (email.to || []).map(a => ({ name: a.name || '', email: a.email })), - cc: (email.cc || []).map(a => ({ name: a.name || '', email: a.email })), - subject: email.subject || '', - receivedAt: email.receivedAt, - isRead: !!email.keywords?.['$seen'], - isFlagged: !!email.keywords?.['$flagged'], - hasAttachment: email.hasAttachment, - preview: email.preview || '', - keywords: Object.keys(email.keywords || {}).filter(k => email.keywords[k]), - }; -} +import { emailToReadView } from "@/lib/plugin-projection"; export default function Home() { diff --git a/components/email/email-viewer.tsx b/components/email/email-viewer.tsx index f92b435a..b37f5abe 100644 --- a/components/email/email-viewer.tsx +++ b/components/email/email-viewer.tsx @@ -9,6 +9,7 @@ import { Button } from "@/components/ui/button"; import { Avatar } from "@/components/ui/avatar"; import { formatFileSize, cn, buildMailboxTree, MailboxNode, formatDateTime, generateUUID } from "@/lib/utils"; import { getSecurityStatus, extractListHeaders } from "@/lib/email-headers"; +import { emailToReadView } from "@/lib/plugin-projection"; import { Reply, ReplyAll, @@ -4886,7 +4887,7 @@ export function EmailViewer({