feat(training): fold-out practice stints with every lap time on Training and the driver's page (1.86.0)
This commit is contained in:
1 parent
3870510d8c
commit
73e1c0ccf3
16 files changed
+224
-5
No files matched your search
@@ -4,6 +4,7 @@ import { normalizeTrackLayouts } from "./track_layouts_logic.js";
|
||||
import { renderTrackLayoutBar, bindTrackLayoutBar } from "./track_layout_bar.js";
|
||||
import { buildTrainingRaceSessions } from "./training_logic.js";
|
||||
import { normalizePublicBaseUrl } from "./public_url.js";
|
||||
import { renderStintLapCards, openStintLapCardIds } from "./stint_laps_view.js";
|
||||
|
||||
// Which track layout the pace/record/consistency numbers are for: "current" (default),
|
||||
// "all" (overall), "none" (laps from before any layout existed), or a layout id. Module
|
||||
@@ -421,12 +422,20 @@ export function renderTrainingView(deps) {
|
||||
? featuredStints.map((row) => renderStintRow(row, { t, escapeHtml, formatLap, formatRaceClock, state })).join("")
|
||||
: `<tr><td colspan="11">${escapeHtml(t("training.no_stints"))}</td></tr>`;
|
||||
const allStintRows = stintAnalysis.rows.map((row) => renderStintRow(row, { t, escapeHtml, formatLap, formatRaceClock, state })).join("");
|
||||
// The 10 latest stints as fold-out cards with every lap, above the analysis table.
|
||||
const stintLapCards = renderStintLapCards(stintAnalysis.rows.slice(0, 10), {
|
||||
formatLap, formatDuration: formatRaceClock, escapeHtml, openIds: openStintLapCardIds(document),
|
||||
labels: { stint: t("training.stint"), laps: t("training.laps"), best: t("training.best_lap"), average: t("training.stint_average"), duration: t("training.stint_duration"), lap: t("training.stint_lap_times"), excluded: t("training.stint_out_lap"), empty: t("training.no_stints") },
|
||||
});
|
||||
// Stints are for practice only; with "Races" chosen the race-session table replaces them.
|
||||
const stintSectionMarkup = `
|
||||
<div class="training-section-title">
|
||||
<div><h3>${escapeHtml(t("training.stint_analysis"))}</h3><p class="hint">${escapeHtml(t("training.stint_analysis_hint"))}</p></div>
|
||||
${stintAnalysis.best ? `<span class="badge success">${escapeHtml(t("training.best_stint", { stint: stintAnalysis.best.number, laps: stintAnalysis.best.lapCount, pace: formatLap(stintAnalysis.best.paceMs) }))}</span>` : ""}
|
||||
</div>
|
||||
<h4 class="stint-laps-title">${escapeHtml(t("training.stint_lap_times"))}</h4>
|
||||
<p class="hint">${escapeHtml(t("training.stint_lap_times_hint"))}</p>
|
||||
${stintLapCards}
|
||||
<div class="table-wrap training-history-wrap">
|
||||
<table data-sort-id="training-stints-featured" class="training-history-table training-stint-table"><thead>${stintColumns}</thead><tbody>${featuredStintRows}</tbody></table>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user