mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-13 17:11:49 +00:00
draft: devWeb - Add informations of connected users
This commit is contained in:
@@ -6,9 +6,18 @@ public class SimpleUser {
|
||||
private final int id;
|
||||
private final String username;
|
||||
|
||||
private final int nbPlayedGames;
|
||||
private final int nbWin;
|
||||
private final double rigthClickPercentRate;
|
||||
private final double rapidClickPercentRate;
|
||||
|
||||
public SimpleUser(User user) {
|
||||
this.id = user.getId().intValue();
|
||||
this.username = user.getUsername();
|
||||
this.nbPlayedGames = user.getNbPlayedGame();
|
||||
this.nbWin = user.getNbWin();
|
||||
this.rigthClickPercentRate = user.getRightClickPercentRate();
|
||||
this.rapidClickPercentRate = user.getRapidClickPercentRate();
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
@@ -18,4 +27,20 @@ public class SimpleUser {
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public int getNbPlayedGames() {
|
||||
return nbPlayedGames;
|
||||
}
|
||||
|
||||
public int getNbWin() {
|
||||
return nbWin;
|
||||
}
|
||||
|
||||
public double getRigthClickPercentRate() {
|
||||
return rigthClickPercentRate;
|
||||
}
|
||||
|
||||
public double getRapidClickPercentRate() {
|
||||
return rapidClickPercentRate;
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,12 @@
|
||||
<component:card title="Menu principal">
|
||||
<ul>
|
||||
<li><a href="${pageContext.request.contextPath}/new">Nouvelle partie</a></li>
|
||||
<li><a href="${pageContext.request.contextPath}/join">Rejoindre une partie</a></li>
|
||||
<%-- <li><a href="${pageContext.request.contextPath}/join">Rejoindre une partie</a></li>--%>
|
||||
</ul>
|
||||
</component:card>
|
||||
</div>
|
||||
<div class="column">
|
||||
<component:card>
|
||||
<component:card title="Utilisateurs connectés">
|
||||
<component:connected-user-list/>
|
||||
</component:card>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
<table id="connected-user-list" class="table is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Nom d'utilisateur</th>
|
||||
<th>Nombre de parties jouées</th>
|
||||
<th>Nombre de victoires</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
@@ -26,14 +28,22 @@
|
||||
|
||||
// Add the users to the table
|
||||
users.forEach(user => {
|
||||
const tr = document.createElement('tr');
|
||||
const td = document.createElement('td');
|
||||
const tr = document.createElement('tr');
|
||||
const tdUsername = document.createElement('td');
|
||||
tdUsername.dataset.id = user.id;
|
||||
tdUsername.textContent = user.username;
|
||||
const tdNbGames = document.createElement('td');
|
||||
tdNbGames.dataset.id = user.id;
|
||||
tdNbGames.textContent = user.nbPlayedGames;
|
||||
const tdNbWin = document.createElement('td');
|
||||
tdNbWin.dataset.id = user.id;
|
||||
tdNbWin.textContent = user.nbWin;
|
||||
|
||||
td.dataset.id = user.id;
|
||||
td.textContent = user.username;
|
||||
|
||||
tr.appendChild(td);
|
||||
table.appendChild(tr);
|
||||
tr.appendChild(tdUsername);
|
||||
tr.appendChild(tdNbGames);
|
||||
tr.appendChild(tdNbWin);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user