feat: devWeb - update connected User list on new game page

This commit is contained in:
kmitresse
2024-04-17 18:51:28 +02:00
parent a6dbfccfb8
commit 304463fff9
2 changed files with 62 additions and 3 deletions
@@ -12,6 +12,10 @@
<thead>
<tr>
<th>Utilisateur</th>
<th>Nombre parties jouées</th>
<th>Nombre de victoires</th>
<th>Clics corrects</th>
<th>Clics rapides</th>
<th>Action</th>
</tr>
</thead>
@@ -60,12 +64,20 @@
users.forEach(user => {
const trElement = document.createElement('tr');
const tdElement = [
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td')
];
const buttonElement = document.createElement('button');
tdElement[0].textContent = user.username;
tdElement[1].textContent = user.nbPlayedGames;
tdElement[2].textContent = user.WinRate + '%';
tdElement[3].textContent = user.rightClickPercentRate + '%';
tdElement[4].textContent = user.rapidClickPercentRate + '%';
// If it's not the current user, we can display the button
if (user.id !== <%= user.getId() %>) {
@@ -75,11 +87,15 @@
// TODO Ajouter l'événement click
}
tdElement[1].appendChild(buttonElement);
tdElement[5].appendChild(buttonElement);
trElement.appendChild(tdElement[0]);
trElement.appendChild(tdElement[1]);
trElement.appendChild(tdElement[2]);
trElement.appendChild(tdElement[3]);
trElement.appendChild(tdElement[4]);
trElement.appendChild(tdElement[5]);
tbodyElement.appendChild(trElement);
});
}
</script>
</script>