diff --git a/components/email/EmailPreview.tsx b/components/email/EmailPreview.tsx index 4c6ade51..f1c4722a 100644 --- a/components/email/EmailPreview.tsx +++ b/components/email/EmailPreview.tsx @@ -1,11 +1,14 @@ 'use client'; import { useState } from 'react'; -import { Loader2, Paperclip } from 'lucide-react'; +import { Loader2, Paperclip, User } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { ScrollArea } from '@/components/ui/scroll-area'; import { sanitizeHtml } from '@/lib/utils/email-formatter'; +import { Avatar } from '@/components/ui/avatar'; +import { AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Card } from '@/components/ui/card'; interface EmailAddress { name: string; @@ -78,6 +81,19 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP ).join(', '); }; + // Get sender initials for avatar + const getSenderInitials = (sender: EmailAddress | undefined) => { + if (!sender) return 'U'; + if (sender.name) { + const parts = sender.name.split(' '); + if (parts.length > 1) { + return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase(); + } + return sender.name[0].toUpperCase(); + } + return sender.address[0].toUpperCase(); + }; + // Display loading state if (loading) { return ( @@ -101,70 +117,74 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP ); } + const sender = email.from && email.from.length > 0 ? email.from[0] : undefined; + return ( -
No content available
- )} +No content available
+ )} +