From 0dc0d70986e0aa22c6a6ee1167964ce83915173b Mon Sep 17 00:00:00 2001 From: Sterling Archer Date: Sat, 20 Jun 2026 23:35:39 -0700 Subject: [PATCH] Use nickname initial for avatar letter when no image URL set --- index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 4ca4cc7..d332a39 100644 --- a/index.html +++ b/index.html @@ -697,9 +697,9 @@ function todayKey() { function esc(str) { return (str||'').replace(/&/g,'&').replace(//g,'>'); } -function avatarHtml(profile, size=40) { - const name = profile?.displayName || 'No Display Name'; - const initial = name[0].toUpperCase(); +function avatarHtml(profile, size=40, nickname='') { + const displayName = profile?.displayName || 'No Display Name'; + const initial = (nickname || displayName)[0].toUpperCase(); const url = profile?.avatarUrl || ''; if (url) return `
${initial}
`; return `
${initial}
`; @@ -996,7 +996,8 @@ function renderLeaderboard() { const rank = i + 1; const rankClass = rank===1?'top1':rank===2?'top2':rank===3?'top3':''; const name = e.isMe ? (currentProfileData?.displayName || 'Me') : getFriendDisplayName(e.uid); - const avatar = avatarHtml(e.profile, 40); + const nick = e.isMe ? '' : (friendsData[e.uid]?.nickname || ''); + const avatar = avatarHtml(e.profile, 40, nick); return `
${rank}
@@ -1163,7 +1164,7 @@ window.openFriendProfile = async function(uid) { const avatarEl = document.getElementById('fp-avatar'); if (profile.avatarUrl) avatarEl.innerHTML = ``; - else avatarEl.textContent = displayName[0].toUpperCase(); + else avatarEl.textContent = (nick || displayName)[0].toUpperCase(); document.getElementById('fp-name-text').textContent = nick || displayName;