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;