Show player game counts with tooltip in admin table
This commit is contained in:
@@ -8,7 +8,7 @@ public record SuggestionDto(int Id, string Name, string? Genre, string? Descript
|
||||
public record VoteRequest(int SuggestionId, int Score);
|
||||
public record ResultsOpenRequest(bool ResultsOpen);
|
||||
public record VoteFinalizeRequest(bool Final);
|
||||
public record VoteStatusDto(Guid PlayerId, string Name, string Username, Phase Phase, bool Finalized, bool HasJoker);
|
||||
public record VoteStatusDto(Guid PlayerId, string Name, string Username, Phase Phase, bool Finalized, bool HasJoker, int SuggestionCount, IReadOnlyList<string> SuggestionTitles);
|
||||
public record LinkSuggestionsRequest(int SourceSuggestionId, int TargetSuggestionId);
|
||||
public record UnlinkSuggestionsRequest(int SuggestionId);
|
||||
public record GrantJokerRequest(Guid PlayerId);
|
||||
|
||||
@@ -42,13 +42,16 @@ public static class AdminEndpoints
|
||||
|
||||
var voters = await db.Players
|
||||
.AsNoTracking()
|
||||
.Include(p => p.Suggestions)
|
||||
.OrderBy(p => p.DisplayName ?? p.Username)
|
||||
.Select(p => new VoteStatusDto(p.Id,
|
||||
p.DisplayName ?? p.Username,
|
||||
p.Username,
|
||||
p.CurrentPhase,
|
||||
p.VotesFinal,
|
||||
p.HasJoker))
|
||||
p.HasJoker,
|
||||
p.Suggestions.Count,
|
||||
p.Suggestions.Select(s => s.Name).ToList()))
|
||||
.ToListAsync();
|
||||
|
||||
var waiting = voters.Where(v => !v.Finalized).Select(v => v.Name).ToList();
|
||||
|
||||
@@ -153,6 +153,7 @@
|
||||
<th data-i18n="admin.playerName">Name</th>
|
||||
<th data-i18n="admin.playerUsername">Username</th>
|
||||
<th data-i18n="admin.playerStatus">Status</th>
|
||||
<th data-i18n="admin.playerGames">Games</th>
|
||||
<th data-i18n="admin.playerJoker">Joker</th>
|
||||
<th data-i18n="admin.playerDelete">Delete</th>
|
||||
</tr>
|
||||
|
||||
@@ -113,6 +113,7 @@ const translations = {
|
||||
"admin.playerName": "Name",
|
||||
"admin.playerUsername": "Username",
|
||||
"admin.playerStatus": "Status",
|
||||
"admin.playerGames": "Games",
|
||||
"admin.playerJoker": "Joker",
|
||||
"admin.playerDelete": "Delete",
|
||||
"admin.grantJokerChip": "Grant",
|
||||
@@ -272,6 +273,7 @@ const translations = {
|
||||
"admin.playerName": "Name",
|
||||
"admin.playerUsername": "Benutzername",
|
||||
"admin.playerStatus": "Status",
|
||||
"admin.playerGames": "Spiele",
|
||||
"admin.playerJoker": "Joker",
|
||||
"admin.playerDelete": "Löschen",
|
||||
"admin.grantJokerChip": "Joker",
|
||||
|
||||
@@ -728,10 +728,12 @@ function renderAdminVoteStatus() {
|
||||
state.adminVoteStatus.voters.forEach((v) => {
|
||||
const tr = document.createElement("tr");
|
||||
const statusText = displayPlayerStatus(v);
|
||||
const gamesTooltip = (v.suggestionTitles || []).join(", ");
|
||||
tr.innerHTML = `
|
||||
<td title="${v.name}">${truncate(v.name, 28)}</td>
|
||||
<td class="muted small" title="${v.username}">${truncate(v.username, 24)}</td>
|
||||
<td>${statusText}</td>
|
||||
<td title="${gamesTooltip}">${v.suggestionCount ?? 0}</td>
|
||||
<td><button class="chip" data-grant-joker="${v.playerId}" type="button">${v.hasJoker ? "🎟" : t("admin.grantJokerChip")}</button></td>
|
||||
<td><button class="chip danger-chip" data-delete-player="${v.playerId}" data-name="${v.name}" type="button">✕</button></td>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user