courrier preview
This commit is contained in:
parent
5adf1a9a62
commit
81a107147c
@ -89,7 +89,7 @@ export default function EmailDetailView({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="flex flex-col h-full overflow-hidden">
|
||||||
{/* Email actions header */}
|
{/* Email actions header */}
|
||||||
<div className="flex-none px-4 py-3 border-b border-gray-100">
|
<div className="flex-none px-4 py-3 border-b border-gray-100">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
@ -147,57 +147,87 @@ export default function EmailDetailView({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Scrollable content area */}
|
{/* Scrollable content area - enhanced for better scrolling */}
|
||||||
<ScrollArea className="flex-1 p-6">
|
<ScrollArea className="flex-1 overflow-auto">
|
||||||
<div className="flex items-center gap-4 mb-6">
|
<div className="p-6">
|
||||||
<Avatar className="h-10 w-10">
|
{/* Email header info */}
|
||||||
<AvatarFallback>
|
<div className="flex items-center gap-4 mb-6">
|
||||||
{(email.from?.[0]?.name || '').charAt(0) || (email.from?.[0]?.address || '').charAt(0) || '?'}
|
<Avatar className="h-10 w-10">
|
||||||
</AvatarFallback>
|
<AvatarFallback>
|
||||||
</Avatar>
|
{(email.from?.[0]?.name || '').charAt(0) || (email.from?.[0]?.address || '').charAt(0) || '?'}
|
||||||
<div className="flex-1">
|
</AvatarFallback>
|
||||||
<p className="font-medium text-gray-900">
|
</Avatar>
|
||||||
{email.from?.[0]?.name || ''} <span className="text-gray-500"><{email.from?.[0]?.address || ''}></span>
|
<div className="flex-1">
|
||||||
</p>
|
<p className="font-medium text-gray-900">
|
||||||
<p className="text-sm text-gray-500">
|
{email.from?.[0]?.name || ''} <span className="text-gray-500"><{email.from?.[0]?.address || ''}></span>
|
||||||
to {email.to?.[0]?.address || ''}
|
|
||||||
</p>
|
|
||||||
{email.cc && email.cc.length > 0 && (
|
|
||||||
<p className="text-sm text-gray-500">
|
|
||||||
cc {email.cc.map(c => c.address).join(', ')}
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
<p className="text-sm text-gray-500">
|
||||||
</div>
|
to {email.to?.[0]?.address || ''}
|
||||||
<div className="text-sm text-gray-500 whitespace-nowrap">
|
</p>
|
||||||
{formatDate(email.date)}
|
{email.cc && email.cc.length > 0 && (
|
||||||
</div>
|
<p className="text-sm text-gray-500">
|
||||||
</div>
|
cc {email.cc.map(c => c.address).join(', ')}
|
||||||
|
</p>
|
||||||
{/* Email content */}
|
)}
|
||||||
<div className="prose prose-sm max-w-none">
|
</div>
|
||||||
{renderEmailContent()}
|
<div className="text-sm text-gray-500 whitespace-nowrap">
|
||||||
</div>
|
{formatDate(email.date)}
|
||||||
|
|
||||||
{/* Attachments (if any) */}
|
|
||||||
{email.hasAttachments && email.attachments && email.attachments.length > 0 && (
|
|
||||||
<div className="mt-6 border-t border-gray-100 pt-4">
|
|
||||||
<h3 className="text-sm font-medium text-gray-900 mb-2">Attachments</h3>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
|
||||||
{email.attachments.map((attachment, idx) => (
|
|
||||||
<div
|
|
||||||
key={idx}
|
|
||||||
className="flex items-center gap-2 p-2 border border-gray-200 rounded-md"
|
|
||||||
>
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<p className="text-sm font-medium text-gray-700 truncate">{attachment.filename}</p>
|
|
||||||
<p className="text-xs text-gray-500">{(attachment.size / 1024).toFixed(1)} KB</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
|
{/* Email content with improved scrolling */}
|
||||||
|
<div className="prose prose-sm max-w-none email-content-wrapper">
|
||||||
|
{renderEmailContent()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Attachments (if any) */}
|
||||||
|
{email.hasAttachments && email.attachments && email.attachments.length > 0 && (
|
||||||
|
<div className="mt-6 border-t border-gray-100 pt-4">
|
||||||
|
<h3 className="text-sm font-medium text-gray-900 mb-2">Attachments</h3>
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||||
|
{email.attachments.map((attachment, idx) => (
|
||||||
|
<div
|
||||||
|
key={idx}
|
||||||
|
className="flex items-center gap-2 p-2 border border-gray-200 rounded-md"
|
||||||
|
>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<p className="text-sm font-medium text-gray-700 truncate">{attachment.filename}</p>
|
||||||
|
<p className="text-xs text-gray-500">{(attachment.size / 1024).toFixed(1)} KB</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</>
|
|
||||||
|
{/* Add CSS for better email content display */}
|
||||||
|
<style jsx global>{`
|
||||||
|
.email-content-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-content-wrapper img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-content-wrapper table {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.email-content-wrapper {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user