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 int id;
|
||||||
private final String username;
|
private final String username;
|
||||||
|
|
||||||
|
private final int nbPlayedGames;
|
||||||
|
private final int nbWin;
|
||||||
|
private final double rigthClickPercentRate;
|
||||||
|
private final double rapidClickPercentRate;
|
||||||
|
|
||||||
public SimpleUser(User user) {
|
public SimpleUser(User user) {
|
||||||
this.id = user.getId().intValue();
|
this.id = user.getId().intValue();
|
||||||
this.username = user.getUsername();
|
this.username = user.getUsername();
|
||||||
|
this.nbPlayedGames = user.getNbPlayedGame();
|
||||||
|
this.nbWin = user.getNbWin();
|
||||||
|
this.rigthClickPercentRate = user.getRightClickPercentRate();
|
||||||
|
this.rapidClickPercentRate = user.getRapidClickPercentRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -18,4 +27,20 @@ public class SimpleUser {
|
|||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
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">
|
<component:card title="Menu principal">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="${pageContext.request.contextPath}/new">Nouvelle partie</a></li>
|
<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>
|
</ul>
|
||||||
</component:card>
|
</component:card>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<component:card>
|
<component:card title="Utilisateurs connectés">
|
||||||
<component:connected-user-list/>
|
<component:connected-user-list/>
|
||||||
</component:card>
|
</component:card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
<table id="connected-user-list" class="table is-fullwidth">
|
<table id="connected-user-list" class="table is-fullwidth">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Utilisateur</th>
|
<th>Nom d'utilisateur</th>
|
||||||
|
<th>Nombre de parties jouées</th>
|
||||||
|
<th>Nombre de victoires</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
@@ -27,12 +29,20 @@
|
|||||||
// Add the users to the table
|
// Add the users to the table
|
||||||
users.forEach(user => {
|
users.forEach(user => {
|
||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
const td = document.createElement('td');
|
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);
|
tr.appendChild(tdUsername);
|
||||||
|
tr.appendChild(tdNbGames);
|
||||||
|
tr.appendChild(tdNbWin);
|
||||||
table.appendChild(tr);
|
table.appendChild(tr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user