Neah version mail design fix 3 ?

This commit is contained in:
alma 2025-04-16 18:23:51 +02:00
parent 79b9038f50
commit 1be9b35d01

View File

@ -1085,7 +1085,7 @@ export default function MailPage() {
{sortedEmails.map((email) => (
<div
key={email.id}
className={`flex items-start gap-3 p-3 hover:bg-gray-50/80 cursor-pointer ${
className={`flex items-start gap-3 p-2 hover:bg-gray-50/80 cursor-pointer ${
selectedEmail?.id === email.id ? 'bg-blue-50/50' : ''
} ${!email.read ? 'bg-blue-50/20' : ''}`}
onClick={() => handleEmailSelect(email.id)}
@ -1123,32 +1123,11 @@ export default function MailPage() {
</Button>
</div>
</div>
<h3 className={`text-sm mb-0.5 truncate ${!email.read ? 'font-medium text-gray-900' : 'text-gray-700'}`}>
<h3 className="text-sm text-gray-900 truncate">
{email.subject || '(No subject)'}
</h3>
<div className="flex items-center gap-2 text-xs text-gray-500">
<span className="truncate">
{(() => {
// 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 className="text-xs text-gray-500 truncate">
--{email.id.toString().substring(0, 32)}...
</div>
</div>
</div>