courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 15:31:52 +02:00
parent efbc11bee1
commit 3b455d33d4

View File

@ -17,6 +17,8 @@ interface EmailListItemProps {
onToggleStarred: (e: React.MouseEvent) => void;
}
const PREVIEW_LENGTH = 70;
export default function EmailListItem({
email,
isSelected,
@ -96,23 +98,26 @@ export default function EmailListItem({
};
// Get preview text from email content
const getPreviewText = () => {
if (email.preview) return email.preview;
const getPreviewText = (content: { text: string; html: string } | string) => {
let text = '';
let content = email.content || '';
// Strip HTML tags if present
content = content.replace(/<[^>]+>/g, ' ');
// Clean up whitespace
content = content.replace(/\s+/g, ' ').trim();
// Limit to ~70 chars
if (content.length > 70) {
return content.substring(0, 70) + '...';
if (typeof content === 'string') {
text = content;
} else {
// Prefer text content if available, fall back to HTML
text = content.text || content.html;
}
return content || 'No preview available';
// Strip HTML tags if present
text = text.replace(/<[^>]+>/g, ' ');
// Clean up whitespace
text = text.replace(/\s+/g, ' ').trim();
// Truncate to preview length
return text.length > PREVIEW_LENGTH
? text.substring(0, PREVIEW_LENGTH) + '...'
: text;
};
return (
@ -155,7 +160,7 @@ export default function EmailListItem({
</h3>
<div className="text-xs text-gray-500 truncate">
{getPreviewText()}
{getPreviewText(email.content)}
</div>
</div>
</div>