Show emoji votes and my vote in results
This commit is contained in:
@@ -71,9 +71,8 @@ const translations = {
|
||||
"results.rank": "Rank",
|
||||
"results.game": "Game",
|
||||
"results.author": "Author",
|
||||
"results.votes": "Votes",
|
||||
"results.avg": "Average",
|
||||
"results.total": "Total",
|
||||
"results.votesList": "Votes",
|
||||
"results.myVote": "Your vote",
|
||||
"results.links": "Links",
|
||||
"results.link.site": "Site ↗",
|
||||
"results.link.youtube": "YouTube ↗",
|
||||
@@ -177,9 +176,8 @@ const translations = {
|
||||
"results.rank": "Rang",
|
||||
"results.game": "Spiel",
|
||||
"results.author": "Autor",
|
||||
"results.votes": "Stimmen",
|
||||
"results.avg": "Durchschnitt",
|
||||
"results.total": "Gesamt",
|
||||
"results.votesList": "Stimmen (Emojis)",
|
||||
"results.myVote": "Deine Stimme",
|
||||
"results.links": "Links",
|
||||
"results.link.site": "Webseite ↗",
|
||||
"results.link.youtube": "YouTube ↗",
|
||||
|
||||
@@ -216,9 +216,8 @@ export function renderResults() {
|
||||
<th>${t("results.rank")}</th>
|
||||
<th>${t("results.game")}</th>
|
||||
<th>${t("results.author")}</th>
|
||||
<th>${t("results.votes")}</th>
|
||||
<th>${t("results.avg")}</th>
|
||||
<th>${t("results.total")}</th>
|
||||
<th>${t("results.votesList")}</th>
|
||||
<th>${t("results.myVote")}</th>
|
||||
<th>${t("results.links")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -240,9 +239,8 @@ export function renderResults() {
|
||||
</div>
|
||||
</td>
|
||||
<td class="author-cell">${r.author ?? "—"}</td>
|
||||
<td>${r.count}</td>
|
||||
<td>${r.average.toFixed(1)}</td>
|
||||
<td>${r.total}</td>
|
||||
<td>${formatVotes(r.votes)}</td>
|
||||
<td>${formatMyVote(r.myVote)}</td>
|
||||
<td>
|
||||
${r.gameUrl ? `<a class="link compact" href="${r.gameUrl}" target="_blank" rel="noopener">${t("results.link.site")}</a><br>` : ''}
|
||||
${r.youtubeUrl ? `<a class="link compact" href="${r.youtubeUrl}" target="_blank" rel="noopener">${t("results.link.youtube")}</a>` : ''}
|
||||
@@ -587,6 +585,17 @@ export function neutralEmoji() {
|
||||
return "😐";
|
||||
}
|
||||
|
||||
function formatVotes(votes) {
|
||||
if (!Array.isArray(votes) || votes.length === 0) return "—";
|
||||
const sorted = [...votes].sort((a, b) => a - b);
|
||||
return sorted.map((v) => scoreToEmoji(v)).join(" ");
|
||||
}
|
||||
|
||||
function formatMyVote(score) {
|
||||
if (score == null || Number.isNaN(score)) return "—";
|
||||
return `${score} ${scoreToEmoji(score)}`;
|
||||
}
|
||||
|
||||
function isValidImageUrl(url) {
|
||||
if (!url) return true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user