feat(results): gold, silver and bronze medals for the top three in PDF, printouts and result tables (1.73.0)

This commit is contained in:
larssand committed 2026-11-06 23:12:29 +01:00
1 parent 7c25f23ad0
commit 41043a990d
12 files changed
+72 -12

No files matched your search

+6 -2
View File
@@ -1,3 +1,4 @@
import { medal } from "./medal.js";
import { getSyncStatus } from "./sync_status.js";
import { installListSorting } from "./list_sorting.js";
import { escapeHtml } from "./html_escape.js";
@@ -158,7 +159,7 @@ const renderRaceOverviewHeatsHtml = (event) => (getRaceOverview(event)?.phases |
<section class="print-block">
<h2>${escapeHtml(raceOverviewPhaseLabel(phase.type))} • ${escapeHtml(session.name)}</h2>
${renderTable([t("table.pos"), t("table.driver"), ...(rows.some((row) => row.car) ? [t("race_overview.car")] : []), t("table.laps"), t("table.result"), t("table.best_lap")],
rows.map((row) => `<tr><td>${row.pos}</td><td>${escapeHtml(row.name)}</td>${rows.some((item) => item.car) ? `<td>${escapeHtml(row.car || "-")}</td>` : ""}<td>${row.laps}</td><td>${escapeHtml(row.result)}</td><td>${row.bestLapMs ? escapeHtml(formatLap(row.bestLapMs)) : "-"}</td></tr>`))}
rows.map((row) => `<tr><td>${medal(row.pos)}</td><td>${escapeHtml(row.name)}</td>${rows.some((item) => item.car) ? `<td>${escapeHtml(row.car || "-")}</td>` : ""}<td>${row.laps}</td><td>${escapeHtml(row.result)}</td><td>${row.bestLapMs ? escapeHtml(formatLap(row.bestLapMs)) : "-"}</td></tr>`))}
</section>`)).join("");
const getSessionsForEvent = (eventId) => getSessionsForEventHelper(state, eventId);
const getModeLabel = (mode) => getModeLabelHelper(mode, { t });
@@ -1021,7 +1022,7 @@ const printSeries = (series, tables) => openPrintWindow(series.name, `
<div class="print-meta"><p>${escapeHtml(new Date().toLocaleDateString())}</p></div></div>
${tables.map((table) => `<div class="print-block"><h2>${escapeHtml(table.className)} - ${escapeHtml(t("series.counted_of", { counted: table.countedCount, completed: table.completedCount, total: table.events.length }))}</h2>
<table><thead><tr><th>${escapeHtml(t("table.pos"))}</th><th>${escapeHtml(t("table.driver"))}</th>${table.events.map((event, index) => `<th>${index + 1}</th>`).join("")}<th>${escapeHtml(t("series.starts"))}</th><th>${escapeHtml(t("series.total"))}</th></tr></thead>
<tbody>${table.rows.map((row) => `<tr><td>${row.rank}</td><td>${escapeHtml(row.driverName)}</td>${table.events.map((event) => `<td>${escapeHtml(seriesCell(table, row, event))}</td>`).join("")}<td>${row.starts}</td><td><strong>${row.total}</strong></td></tr>`).join("")}</tbody></table>
<tbody>${table.rows.map((row) => `<tr><td>${medal(row.rank)}</td><td>${escapeHtml(row.driverName)}</td>${table.events.map((event) => `<td>${escapeHtml(seriesCell(table, row, event))}</td>`).join("")}<td>${row.starts}</td><td><strong>${row.total}</strong></td></tr>`).join("")}</tbody></table>
<p>${table.events.map((event, index) => `${index + 1}: ${escapeHtml(event.date || "")} ${escapeHtml(event.name)}`).join(" · ")}</p></div>`).join("")}
<p>${escapeHtml(t("series.legend"))}</p>`);
const exportSeriesPdf = async (series, tables) => {
@@ -7493,6 +7494,9 @@ function openPrintWindow(title, bodyHtml) {
td.pos, th.pos { text-align: center; width: 1%; white-space: nowrap; }
tr.podium-1 td:first-child { box-shadow: inset 4px 0 #d4af37; } tr.podium-2 td:first-child { box-shadow: inset 4px 0 #a9b0bb; } tr.podium-3 td:first-child { box-shadow: inset 4px 0 #c27c3e; }
tr.podium-1 td, tr.podium-2 td, tr.podium-3 td { font-weight: 700; }
.medal { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; text-align: center; font-weight: 800; font-size: 11px; color: #4a3500; background: radial-gradient(circle at 32% 28%, #fff7cf 0%, #f4cf55 38%, #c9971c 75%, #9c7210 100%); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4); }
.medal-2 { color: #33383f; background: radial-gradient(circle at 32% 28%, #ffffff 0%, #dfe3e8 38%, #a8b0ba 75%, #7d8691 100%); }
.medal-3 { color: #3d2109; background: radial-gradient(circle at 32% 28%, #ffe2c4 0%, #e3a46a 38%, #b06a2c 75%, #84491a 100%); }
</style>
</head>
<body>