feat(overlay): click a driver to open their training stats
In RaceCore's own overlay a driver row opens Training stats for that driver and class; the stand-alone overlay window opens them in a new tab. The public overlay gets no links: the mobile profile link is personal and can write.
This commit is contained in:
1 parent
cade201d5a
commit
4def444202
8 files changed
+105
-3
No files matched your search
+5
-2
@@ -56,7 +56,9 @@ export function renderOverlaySidePanel(panel, { t, escapeHtml }) {
|
||||
`;
|
||||
}
|
||||
|
||||
export function renderOverlayLeaderboard(rows, { t, escapeHtml, formatTeamActiveMemberLabel, formatLap, formatPredictedLapDelta }, { sortable = true } = {}) {
|
||||
// driverLinks: a click on a driver opens their training stats (RaceCore's own overlay only - never
|
||||
// the public overlay, see openDriverTrainingStats in app.js).
|
||||
export function renderOverlayLeaderboard(rows, { t, escapeHtml, formatTeamActiveMemberLabel, formatLap, formatPredictedLapDelta }, { sortable = true, driverLinks = false } = {}) {
|
||||
if (!rows.length) {
|
||||
return `<p>${t("timing.no_laps")}</p>`;
|
||||
}
|
||||
@@ -70,8 +72,9 @@ export function renderOverlayLeaderboard(rows, { t, escapeHtml, formatTeamActive
|
||||
.map((row, idx) => {
|
||||
const posClass = idx === 0 ? "pos-1" : idx === 1 ? "pos-2" : idx === 2 ? "pos-3" : "";
|
||||
const rowSortAttr = sortable ? ` data-sort-values="${sortValuesAttribute([idx + 1, row.displayName || row.driverName, row.laps ?? 0, row.resultDisplay, row.gapDisplay || row.gapAhead || null, row.gapAhead || null, row.lapDelta || null, row.bestLapMs || null])}"` : "";
|
||||
const linkAttrs = driverLinks && row.driverId && !row.teamId ? ` data-training-driver="${escapeHtml(row.driverId)}" title="${escapeHtml(t("overlay.open_training_stats"))}"` : "";
|
||||
return `
|
||||
<article class="overlay-race-row ${idx === 0 ? "overlay-race-row-leader" : ""} ${row.invalidPending ? "overlay-race-row-invalid" : ""}"${rowSortAttr} data-overlay-competitor="${escapeHtml(row.key)}">
|
||||
<article class="overlay-race-row ${idx === 0 ? "overlay-race-row-leader" : ""} ${row.invalidPending ? "overlay-race-row-invalid" : ""} ${linkAttrs ? "is-linked" : ""}"${rowSortAttr}${linkAttrs} data-overlay-competitor="${escapeHtml(row.key)}">
|
||||
<div class="overlay-race-pos">
|
||||
<span class="pos-pill ${posClass}">${idx + 1}</span>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user