diff --git a/public/game.html b/public/game.html
index bfd705f..7df2144 100644
--- a/public/game.html
+++ b/public/game.html
@@ -15,6 +15,9 @@
z-index: 50;
cursor: default;
}
+ /* activity feed for user-facing logs (card plays) */
+ #activityFeed { max-height: 140px; overflow:auto; padding:8px; background:#fff; border:1px solid #eee; border-radius:6px; font-size:14px; color:#222 }
+ #log { display:none; }
@@ -46,6 +49,10 @@
@@ -70,6 +77,8 @@
const myColorEl = document.getElementById('myColor');
let socket = null;
let myColor = null;
+ // map playerId -> color (kept up-to-date from room:update)
+ let playerColors = {};
// selection state for this client
let selectedSquare = null; // algebraic name like 'e2'
let selectedSquareEl = null;
@@ -98,6 +107,22 @@
}
}
+ // append a user-facing activity message (visible to players). Keeps recent N entries.
+ function appendActivity(message){
+ try{
+ const feed = document.getElementById('activityFeed');
+ if(!feed) return;
+ const line = document.createElement('div');
+ // show only the message (no timestamp)
+ line.textContent = message;
+ // prepend newest at top
+ if(feed.textContent && feed.textContent.indexOf("Aucune activité") !== -1){ feed.textContent = ''; }
+ feed.insertBefore(line, feed.firstChild);
+ // limit to 30 entries
+ while(feed.children.length > 30) feed.removeChild(feed.lastChild);
+ }catch(_){ }
+ }
+
// small toast notification helper (non-blocking)
function showToast(message, opts){
try{
@@ -190,8 +215,12 @@
if(playersEl){
playersEl.innerHTML = '';
(data.players||[]).forEach(p=>{
+ // keep a mapping from playerId -> color for activity feed formatting
+ try{ playerColors[p.id] = p.color; }catch(_){ }
+ // if this is our player, store the color locally and update UI
+ try{ if(p.id === myPlayerId){ myColor = p.color; if(myColorEl) myColorEl.textContent = myColor; } }catch(_){ }
const li = document.createElement('li');
- li.textContent = p.id + ' (' + p.color + ')';
+ li.textContent = (p.color || 'Joueur') + (p.id === myPlayerId ? ' (vous)' : '');
playersEl.appendChild(li);
});
}
@@ -286,6 +315,13 @@
});
}
}
+ // show friendly activity: who played which card (use title if available)
+ try{
+ const title = (cardObj && (cardObj.title || cardObj.cardId)) || (played && played.card && (played.card.title || played.card.cardId)) || 'Carte';
+ // show player's color instead of their id; fallback to generic label
+ const actor = (owner === myPlayerId) ? 'Vous' : (playerColors[owner] ? playerColors[owner] : 'Adversaire');
+ appendActivity(`${actor} : a joué la carte "${title}"`);
+ }catch(_){ }
}catch(e){ console.warn('card:played handler error', e); }
});
// show card effect notifications (both public and private) so owners get feedback on failed placements/promotions