From a6bdaf961393326bfcd6bfc7c76e8eae06082310 Mon Sep 17 00:00:00 2001 From: Frank Tovar Date: Wed, 28 Jan 2026 16:13:47 +0100 Subject: [PATCH] Present results in data grid with thumbnails and lightbox links --- wwwroot/app.js | 59 +++++++++++++++++++++++++++++++++++----------- wwwroot/styles.css | 29 +++++++++++++++++++++++ 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/wwwroot/app.js b/wwwroot/app.js index b0e0d58..910cf49 100644 --- a/wwwroot/app.js +++ b/wwwroot/app.js @@ -153,19 +153,50 @@ function renderVotes() { } function renderResults() { - const list = $("results-list"); - list.innerHTML = ""; - state.results.forEach((r) => { - const card = buildCard({ - id: r.id, - name: r.name, - genre: `${r.total} pts • ${r.count} votes • avg ${r.average.toFixed(1)}`, - description: r.description || (r.author ? `By ${r.author}` : ""), - screenshotUrl: r.screenshotUrl, - youtubeUrl: r.youtubeUrl, - author: r.author - }, { showAuthor: true }); - list.appendChild(card); + const container = $("results-list"); + container.innerHTML = ""; + const table = document.createElement("table"); + table.className = "results-table"; + table.innerHTML = ` + + + Rank + Game + Author + Votes + Avg + Total + Links + + + + `; + const tbody = table.querySelector("tbody"); + state.results.forEach((r, idx) => { + const row = document.createElement("tr"); + row.innerHTML = ` + ${idx + 1} + + ${r.screenshotUrl ? `${r.name}` : ''} +
+
${r.name}
+ ${r.genre ? `
${r.genre}
` : ''} +
+ + ${r.author ?? "—"} + ${r.count} + ${r.average.toFixed(1)} + ${r.total} + + ${r.youtubeUrl ? `YouTube ↗` : ''} + ${r.screenshotUrl ? `` : ''} + + `; + tbody.appendChild(row); + }); + container.appendChild(table); + container.querySelectorAll(".thumb-open").forEach(btn => { + btn.addEventListener("click", () => openLightbox(btn.dataset.img, "Screenshot")); }); } @@ -271,8 +302,8 @@ function buildCard(s, { showAuthor }) {

${s.name}

+ ${s.youtubeUrl ? `YouTube ↗` : ""}
- ${s.youtubeUrl ? `YouTube ↗` : ""} ${showAuthor && s.author ? `${s.author}` : ""}
diff --git a/wwwroot/styles.css b/wwwroot/styles.css index 876c0da..5e35bcb 100644 --- a/wwwroot/styles.css +++ b/wwwroot/styles.css @@ -291,3 +291,32 @@ input[type="range"].full-slider::-moz-range-track { justify-content: space-between; align-items: center; } + +.results-table { + width: 100%; + border-collapse: collapse; +} +.results-table th, .results-table td { + padding: 10px; + border-bottom: 1px solid #1f2937; +} +.results-table th { text-align: left; color: #9ca3af; font-size: 12px; letter-spacing: 0.3px; } +.results-table .game-cell { display: flex; gap: 10px; align-items: center; } +.results-table .thumb { + width: 72px; + height: 48px; + object-fit: cover; + border-radius: 6px; + border: 1px solid #1f2937; +} +.results-table .game-meta { display: flex; flex-direction: column; gap: 2px; } +.results-table .title-line { font-weight: 700; } +.results-table .muted.small { font-size: 12px; color: #9ca3af; } +.thumb-open { + background: #111827; + border: 1px solid #1f2937; + color: #e5e7eb; + border-radius: 6px; + padding: 4px 8px; + cursor: pointer; +}