Neah version mail design fix 2

This commit is contained in:
alma 2025-04-16 18:16:40 +02:00
parent a700adf8bf
commit 79b9038f50

View File

@ -1128,7 +1128,26 @@ export default function MailPage() {
</h3>
<div className="flex items-center gap-2 text-xs text-gray-500">
<span className="truncate">
{email.folder === 'INBOX' && 'Folder: INBOX'}
{(() => {
// Try to get clean preview text from the email body
let previewText = '';
try {
// Remove HTML tags and decode entities
previewText = email.body
.replace(/<[^>]+>/g, '') // Remove HTML tags
.replace(/&nbsp;/g, ' ') // Replace &nbsp; with space
.replace(/\s+/g, ' ') // Normalize whitespace
.trim();
// Limit to a reasonable length
if (previewText.length > 100) {
previewText = previewText.substring(0, 100) + '...';
}
} catch (e) {
previewText = ''; // Fallback to empty string if there's an error
}
return previewText || 'No preview available';
})()}
</span>
</div>
</div>