diff --git a/index.html b/index.html index 628563c..9335e57 100644 --- a/index.html +++ b/index.html @@ -452,20 +452,6 @@ - - -
-
-
Manage Friends
-
-
- -
-
- -
@@ -523,27 +509,23 @@
-
- — - ✏️ -
-
+
-
- Joined StepMates - — -
-
- Avg. steps per day - — +
+ Display Name + —
- Last sync - — + Date Joined + —
- + +
+ + +
@@ -1159,24 +1141,11 @@ window.openFriendProfile = async function(uid) { else avatarEl.textContent = displayName[0].toUpperCase(); document.getElementById('fp-name-text').textContent = nick || displayName; - const nickShown = document.getElementById('fp-nickname-shown'); - if (nick) { nickShown.textContent = displayName; nickShown.style.display = 'block'; } - else nickShown.style.display = 'none'; const userSnap = await getDoc(doc(db, 'users', uid)); const userData = userSnap.exists() ? userSnap.data() : {}; const joined = userData.createdAt?.toDate?.(); - document.getElementById('fp-joined').textContent = joined ? joined.toLocaleDateString('en-US',{month:'long',day:'numeric',year:'numeric'}) : '—'; - - const steps = friendSteps[uid] || {}; - const vals = Object.values(steps); - const days = Object.keys(steps).length; - const avg = days > 0 ? Math.round(vals.reduce((a,b)=>a+b,0)/days) : 0; - document.getElementById('fp-avg').textContent = avg.toLocaleString() + ' steps'; - - const dates = Object.keys(steps).sort(); - const lastDate = dates[dates.length-1]; - document.getElementById('fp-last-sync').textContent = lastDate ? new Date(lastDate+'T12:00:00').toLocaleDateString('en-US',{month:'long',day:'numeric',year:'numeric'}) : 'Never'; + document.getElementById('fp-joined').textContent = joined ? joined.toLocaleDateString('en-US', {month:'long', day:'numeric', year:'numeric'}) : '—'; showScreen('friend-profile'); } @@ -1208,8 +1177,8 @@ window.saveNickname = async function() { await updateDoc(doc(db, 'friends', currentUser.uid, 'list', uid), { nickname: val || deleteField() }); if (friendsData[uid]) friendsData[uid].nickname = val; closeNicknameModal(); - openFriendProfile(uid); - renderManageFriends(); + const displayName = friendProfiles[uid]?.displayName || 'No Display Name'; + document.getElementById('fp-name-text').textContent = val || displayName; renderLeaderboard(); showToast(val ? 'Nickname saved ✓' : 'Nickname cleared', 'success'); }