From ded13f02cc83c445259df08bfa4c5238004cc156 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 6 May 2026 01:14:01 +0200 Subject: [PATCH] fix: show notification banners above attachments --- components/email/email-viewer.tsx | 350 +++++++++++++++--------------- 1 file changed, 175 insertions(+), 175 deletions(-) diff --git a/components/email/email-viewer.tsx b/components/email/email-viewer.tsx index f5bfaac6..40897af6 100644 --- a/components/email/email-viewer.tsx +++ b/components/email/email-viewer.tsx @@ -4419,6 +4419,181 @@ export function EmailViewer({ + {/* Mobile/Tablet Sender Info - scrolls with content */} +
+
+ +
+ {/* Row 1: Sender name + badges */} +
+ + + {shouldShowUnsubBanner && listHeaders?.listUnsubscribe && ( + { + const messageId = email?.messageId || ''; + const newSet = new Set(dismissedUnsubBanners).add(messageId); + setDismissedUnsubBanners(newSet); + localStorage.setItem('dismissed-unsub-banners', JSON.stringify([...newSet])); + }} + /> + )} +
+ {/* Email address under name */} + {sender?.email && sender?.name && ( +
{sender.email}
+ )} + {/* Row 2: Recipients */} +
+ {email.to && email.to.length > 0 && ( + <> + → {t('recipient_to_prefix')} + {renderClickableRecipients(email.to, currentUserEmail, t, handleViewContactSidebar)} + + )} + {email.cc && email.cc.length > 0 && ( + <> + | + CC: + {renderClickableRecipients(email.cc, currentUserEmail, t, handleViewContactSidebar)} + {email.cc.length > 2 && ( + +{email.cc.length - 2} + )} + + )} +
+
+ {/* Date/time + size on the right (mobile) */} +
+ + {formatDateTime(email.receivedAt, timeFormat, { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' })} + + {email.size > 0 && ( +
+ {formatFileSize(email.size)} +
+ )} +
+
+
+ + {/* S/MIME Status Banner */} + {smimeStatus && ( +
+
+ +
+
+ )} + + {/* Draft Banner */} + {isDraft && ( +
+
+
+ + {t('draft_banner')} +
+ {onEditDraft && ( + + )} +
+
+ )} + + { + setSmimeUnlockDialogOpen(false); + setSmimeUnlockError(null); + }} + onSubmit={handleSmimeUnlockSubmit} + title={tSmime('unlock_key')} + description={tSmime('unlock_key_desc')} + error={smimeUnlockError} + /> + + {/* Unified Notification Banner - External Content + Calendar Invitation */} + {((hasBlockedContent && !allowExternalContent && externalContentPolicy !== 'allow') || + hasCalendarInvitation) && ( +
+
+
+ {/* External Content Controls */} + {hasBlockedContent && !allowExternalContent && externalContentPolicy !== 'allow' && ( +
+ {externalContentPolicy === 'ask' && ( + + )} + {email.from?.[0]?.email && ( + + )} +
+ )} + + + + {/* Calendar Invitation Banner */} + {hasCalendarInvitation && ( +
+ +
+ )} +
+
+
+ )} + {/* === ATTACHMENTS below header (below-header mode, desktop only) === */} {attachmentPosition === 'below-header' && effectiveAttachments.length > 0 && (
@@ -4710,181 +4885,6 @@ export function EmailViewer({
)} - {/* Mobile/Tablet Sender Info - scrolls with content */} -
-
- -
- {/* Row 1: Sender name + badges */} -
- - - {shouldShowUnsubBanner && listHeaders?.listUnsubscribe && ( - { - const messageId = email?.messageId || ''; - const newSet = new Set(dismissedUnsubBanners).add(messageId); - setDismissedUnsubBanners(newSet); - localStorage.setItem('dismissed-unsub-banners', JSON.stringify([...newSet])); - }} - /> - )} -
- {/* Email address under name */} - {sender?.email && sender?.name && ( -
{sender.email}
- )} - {/* Row 2: Recipients */} -
- {email.to && email.to.length > 0 && ( - <> - → {t('recipient_to_prefix')} - {renderClickableRecipients(email.to, currentUserEmail, t, handleViewContactSidebar)} - - )} - {email.cc && email.cc.length > 0 && ( - <> - | - CC: - {renderClickableRecipients(email.cc, currentUserEmail, t, handleViewContactSidebar)} - {email.cc.length > 2 && ( - +{email.cc.length - 2} - )} - - )} -
-
- {/* Date/time + size on the right (mobile) */} -
- - {formatDateTime(email.receivedAt, timeFormat, { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' })} - - {email.size > 0 && ( -
- {formatFileSize(email.size)} -
- )} -
-
-
- - {/* S/MIME Status Banner */} - {smimeStatus && ( -
-
- -
-
- )} - - {/* Draft Banner */} - {isDraft && ( -
-
-
- - {t('draft_banner')} -
- {onEditDraft && ( - - )} -
-
- )} - - { - setSmimeUnlockDialogOpen(false); - setSmimeUnlockError(null); - }} - onSubmit={handleSmimeUnlockSubmit} - title={tSmime('unlock_key')} - description={tSmime('unlock_key_desc')} - error={smimeUnlockError} - /> - - {/* Unified Notification Banner - External Content + Calendar Invitation */} - {((hasBlockedContent && !allowExternalContent && externalContentPolicy !== 'allow') || - hasCalendarInvitation) && ( -
-
-
- {/* External Content Controls */} - {hasBlockedContent && !allowExternalContent && externalContentPolicy !== 'allow' && ( -
- {externalContentPolicy === 'ask' && ( - - )} - {email.from?.[0]?.email && ( - - )} -
- )} - - - - {/* Calendar Invitation Banner */} - {hasCalendarInvitation && ( -
- -
- )} -
-
-
- )} -