Fix email display logic in WinnerBadge component

Replaced the conditional display of the winner's email with a more robust logic to show either the trimmed display name or the email. This ensures better handling of cases where the display name is unavailable or matches the email.
This commit is contained in:
2026-02-06 13:24:38 +01:00
parent fa89987f39
commit 745b661709

View File

@@ -22,6 +22,8 @@ export default function WinnerBadge({ winner, winnerEmail }) {
(winner?.display_name || "").trim() && (winner?.display_name || "").trim() &&
winner.email.trim().toLowerCase() !== winner.display_name.trim().toLowerCase(); winner.email.trim().toLowerCase() !== winner.display_name.trim().toLowerCase();
const displayName = me ? ((me.display_name || "").trim() || me.email) : "";
return ( return (
<div <div
style={{ style={{
@@ -49,7 +51,7 @@ export default function WinnerBadge({ winner, winnerEmail }) {
{showEmail && ( {showEmail && (
<div style={{ fontSize: 12, opacity: 0.8, color: stylesTokens.textDim }}> <div style={{ fontSize: 12, opacity: 0.8, color: stylesTokens.textDim }}>
{winner.email} {displayName}
</div> </div>
)} )}
</div> </div>