feat(race-day): traffic-light colours on the run buttons

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Opus 5.5 committed 2026-10-17 18:45:21 +02:00
1 parent c4df90706a
commit ba35f9e7d2
5 files changed
+46 -8

No files matched your search

+7 -7
View File
@@ -78,17 +78,17 @@ function renderPrologueControls({ t, escapeHtml, getDefaultPrologueSec }, sessio
<label class="prologue-length">${t("prologue.length")}
<select id="raceDayPrologueLength">${PROLOGUE_OPTIONS_SEC.map((seconds) => `<option value="${seconds}" ${seconds === defaultSec ? "selected" : ""}>${escapeHtml(formatPrologueOption(seconds, t))}</option>`).join("")}</select>
</label>
<button id="raceDayStart" class="btn btn-primary" type="button" ${canStart ? "" : "disabled"}>${t("prologue.start")}</button>`;
<button id="raceDayStart" class="btn btn-go" type="button" ${canStart ? "" : "disabled"}>${t("prologue.start")}</button>`;
}
const held = prologue.heldRemainingMs !== null;
return `
<strong class="prologue-clock ${held ? "is-held" : ""}" data-prologue-clock>${formatMmSs(check.remainingMs)}</strong>
<span class="pill ${held ? "pill-warn" : "pill-green"}">${t(held ? "prologue.held" : "prologue.running")}</span>
<button class="btn ${held ? "btn-primary" : ""}" type="button" data-prologue="${held ? "resume" : "hold"}">${t(held ? "prologue.resume" : "prologue.hold")}</button>
<button class="btn ${held ? "btn-go" : "btn-hold"}" type="button" data-prologue="${held ? "resume" : "hold"}">${t(held ? "prologue.resume" : "prologue.hold")}</button>
<button class="btn" type="button" data-prologue="plus">${t("prologue.plus_minute")}</button>
<button class="btn" type="button" data-prologue="to30">${t("prologue.to_30")}</button>
<button class="btn" type="button" data-prologue="to10">${t("prologue.to_10")}</button>
<button class="btn btn-primary" type="button" data-prologue="go">${t("prologue.go")}</button>
<button class="btn btn-go" type="button" data-prologue="go">${t("prologue.go")}</button>
<button class="btn btn-danger" type="button" data-prologue="cancel">${t("prologue.cancel")}</button>`;
}
@@ -216,7 +216,7 @@ export function renderRaceDayView(deps) {
const layoutAllowed = !session || isPracticeSessionType(session.type);
dom.view.innerHTML = `
<section class="race-day-quick" aria-label="${escapeHtml(t("race_day.quick_title"))}">
<button class="btn btn-primary race-day-quick-btn" type="button" id="raceDayQuickPractice">▶ ${escapeHtml(practiceLabel)}</button>
<button class="btn ${practice?.status === "running" ? "btn-go is-live" : practice?.status === "paused" ? "btn-hold" : "btn-go"} race-day-quick-btn" type="button" id="raceDayQuickPractice">${practice?.status === "running" ? '<span class="live-dot" aria-hidden="true"></span>' : practice?.status === "paused" ? "⏸" : "▶"} ${escapeHtml(practiceLabel)}</button>
${layoutAllowed ? `<button class="btn race-day-quick-btn" type="button" data-track-layout-new>🧱 ${escapeHtml(t("race_day.quick_layout"))}</button>` : ""}
<button class="btn race-day-quick-btn" type="button" id="raceDayQuickRace">🏁 ${escapeHtml(t("race_day.quick_race"))}</button>
</section>
@@ -251,11 +251,11 @@ export function renderRaceDayView(deps) {
<div class="race-day-actions">
${usesPrologue
? renderPrologueControls({ t, escapeHtml, getDefaultPrologueSec }, session, warmupForChecks, canStart)
: isLiveSession ? "" : `<button id="raceDayStart" class="btn btn-primary" type="button" ${canStart ? "" : "disabled"}>${t(isPracticeSession ? "race_day.start_practice" : "timing.start")}</button>`}
: isLiveSession ? "" : `<button id="raceDayStart" class="btn btn-go" type="button" ${canStart ? "" : "disabled"}>${t(isPracticeSession ? "race_day.start_practice" : "timing.start")}</button>`}
${prologue ? "" : `
<!-- Practice gets plain words; a race keeps race wording. Only the buttons that apply are shown. -->
${session?.status === "running" ? `<button id="raceDayPause" class="btn" type="button">${t(isPracticeSession ? "race_day.pause_practice" : "audio.race_pause")}</button>` : ""}
${session?.status === "paused" ? `<button id="raceDayResume" class="btn btn-primary" type="button">${t(isPracticeSession ? "race_day.resume_practice" : "audio.race_resume")}</button>` : ""}
${session?.status === "running" ? `<button id="raceDayPause" class="btn btn-hold" type="button">${t(isPracticeSession ? "race_day.pause_practice" : "audio.race_pause")}</button>` : ""}
${session?.status === "paused" ? `<button id="raceDayResume" class="btn btn-go" type="button">${t(isPracticeSession ? "race_day.resume_practice" : "audio.race_resume")}</button>` : ""}
${isLiveSession ? `<button id="raceDayFinish" class="btn btn-danger" type="button">${t(isPracticeSession ? "race_day.finish_practice" : "race_day.finish")}</button>` : ""}
${isPracticeSession ? `<button id="raceDayNewPracticeDay" class="btn" type="button" title="${escapeHtml(t("race_day.new_practice_day_hint"))}">${t("race_day.new_practice_day")}</button>` : ""}`}
</div>