{currentView === 'Sent' ? email.to : (
(() => {
- // Check if email is in format "name "
const fromMatch = email.from.match(/^([^<]+)\s*<([^>]+)>$/);
- if (fromMatch) {
- // If we have both name and email, return just the name
- return fromMatch[1].trim();
- }
- // If it's just an email address, return the full email
- return email.from;
+ return fromMatch ? fromMatch[1].trim() : email.from;
})()
)}