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:
1 parent
c4df90706a
commit
ba35f9e7d2
5 files changed
+46
-8
No files matched your search
@@ -15,6 +15,7 @@ No changes recorded yet.
|
|||||||
- **Race Day is where sessions are run.** Quick actions at the top: **Start practice** (continues today's Open Practice or creates and starts a new one), **New track layout** (only for practice; the running practice moves onto it) and **Create race**. A session picker switches session without going to Timing. Only the buttons that apply are shown (no greyed-out Pause before a start), with practice wording (Pause practice / Finish practice) and no start lights for practice.
|
- **Race Day is where sessions are run.** Quick actions at the top: **Start practice** (continues today's Open Practice or creates and starts a new one), **New track layout** (only for practice; the running practice moves onto it) and **Create race**. A session picker switches session without going to Timing. Only the buttons that apply are shown (no greyed-out Pause before a start), with practice wording (Pause practice / Finish practice) and no start lights for practice.
|
||||||
- **New practice day** on Race Day replaces "Reset data" on Timing: clears today's timing for the selected Open Practice while every lap stays in the training stats.
|
- **New practice day** on Race Day replaces "Reset data" on Timing: clears today's timing for the selected Open Practice while every lap stays in the training stats.
|
||||||
- **Timing is for following.** Start, stop and reset moved to Race Day; Timing keeps the session picker, the leaderboard and lap clean-up, with a link to Race Day. Opening a session from Race Setup now goes to Race Day.
|
- **Timing is for following.** Start, stop and reset moved to Race Day; Timing keeps the session picker, the leaderboard and lap clean-up, with a link to Race Day. Opening a session from Race Setup now goes to Race Day.
|
||||||
|
- Run buttons use traffic-light colours: green starts or resumes (also Go now and the count-down's Resume), amber pauses or holds, red finishes. The Start practice button turns green with a pulsing dot while the practice runs, and amber while it is paused.
|
||||||
- The Dashboard shows the three common tasks first: Start practice, Create race and Series / cup.
|
- The Dashboard shows the three common tasks first: Start practice, Create race and Series / cup.
|
||||||
- The guide, both READMEs, the Race Day screenshot and the "Run a session" video follow the new flow (count-down, hold, To 10 s, pause, finish).
|
- The guide, both READMEs, the Race Day screenshot and the "Run a session" video follow the new flow (count-down, hold, To 10 s, pause, finish).
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 368 KiB |
+1
-1
@@ -80,7 +80,7 @@ export function renderDashboardView(deps) {
|
|||||||
dom.view.innerHTML = `
|
dom.view.innerHTML = `
|
||||||
${renderTrackLayoutBar({ state, t, escapeHtml, showNewButton: !active || isPracticeSessionType(active.type) })}
|
${renderTrackLayoutBar({ state, t, escapeHtml, showNewButton: !active || isPracticeSessionType(active.type) })}
|
||||||
<section class="dashboard-quick mt-16" aria-label="${escapeHtml(t("dashboard.quick_title"))}">
|
<section class="dashboard-quick mt-16" aria-label="${escapeHtml(t("dashboard.quick_title"))}">
|
||||||
<button class="btn btn-primary dashboard-quick-btn" type="button" id="dashboardQuickPractice"><strong>▶ ${t("dashboard.quick_practice")}</strong><small>${t("dashboard.quick_practice_hint")}</small></button>
|
<button class="btn btn-go dashboard-quick-btn" type="button" id="dashboardQuickPractice"><strong>▶ ${t("dashboard.quick_practice")}</strong><small>${t("dashboard.quick_practice_hint")}</small></button>
|
||||||
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickRace"><strong>🏁 ${t("dashboard.quick_race")}</strong><small>${t("dashboard.quick_race_hint")}</small></button>
|
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickRace"><strong>🏁 ${t("dashboard.quick_race")}</strong><small>${t("dashboard.quick_race_hint")}</small></button>
|
||||||
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickSeries"><strong>🏆 ${t("dashboard.quick_series")}</strong><small>${t("dashboard.quick_series_hint")}</small></button>
|
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickSeries"><strong>🏆 ${t("dashboard.quick_series")}</strong><small>${t("dashboard.quick_series_hint")}</small></button>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -78,17 +78,17 @@ function renderPrologueControls({ t, escapeHtml, getDefaultPrologueSec }, sessio
|
|||||||
<label class="prologue-length">${t("prologue.length")}
|
<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>
|
<select id="raceDayPrologueLength">${PROLOGUE_OPTIONS_SEC.map((seconds) => `<option value="${seconds}" ${seconds === defaultSec ? "selected" : ""}>${escapeHtml(formatPrologueOption(seconds, t))}</option>`).join("")}</select>
|
||||||
</label>
|
</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;
|
const held = prologue.heldRemainingMs !== null;
|
||||||
return `
|
return `
|
||||||
<strong class="prologue-clock ${held ? "is-held" : ""}" data-prologue-clock>${formatMmSs(check.remainingMs)}</strong>
|
<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>
|
<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="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="to30">${t("prologue.to_30")}</button>
|
||||||
<button class="btn" type="button" data-prologue="to10">${t("prologue.to_10")}</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>`;
|
<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);
|
const layoutAllowed = !session || isPracticeSessionType(session.type);
|
||||||
dom.view.innerHTML = `
|
dom.view.innerHTML = `
|
||||||
<section class="race-day-quick" aria-label="${escapeHtml(t("race_day.quick_title"))}">
|
<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>` : ""}
|
${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>
|
<button class="btn race-day-quick-btn" type="button" id="raceDayQuickRace">🏁 ${escapeHtml(t("race_day.quick_race"))}</button>
|
||||||
</section>
|
</section>
|
||||||
@@ -251,11 +251,11 @@ export function renderRaceDayView(deps) {
|
|||||||
<div class="race-day-actions">
|
<div class="race-day-actions">
|
||||||
${usesPrologue
|
${usesPrologue
|
||||||
? renderPrologueControls({ t, escapeHtml, getDefaultPrologueSec }, session, warmupForChecks, canStart)
|
? 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 ? "" : `
|
${prologue ? "" : `
|
||||||
<!-- Practice gets plain words; a race keeps race wording. Only the buttons that apply are shown. -->
|
<!-- 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 === "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-primary" type="button">${t(isPracticeSession ? "race_day.resume_practice" : "audio.race_resume")}</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>` : ""}
|
${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>` : ""}`}
|
${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>
|
</div>
|
||||||
|
|||||||
@@ -1930,6 +1930,43 @@ body {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Traffic-light run controls: green starts or resumes, amber holds, red (.btn-danger) finishes. */
|
||||||
|
.btn-go {
|
||||||
|
color: #fff;
|
||||||
|
border-color: color-mix(in srgb, var(--ok) 62%, black 38%);
|
||||||
|
background: linear-gradient(180deg, color-mix(in srgb, var(--ok) 82%, white 18%), color-mix(in srgb, var(--ok) 70%, black 30%));
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-hold {
|
||||||
|
color: #1a1200;
|
||||||
|
border-color: color-mix(in srgb, var(--warn) 62%, black 38%);
|
||||||
|
background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 85%, white 15%), color-mix(in srgb, var(--warn) 80%, black 20%));
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-go:disabled,
|
||||||
|
.btn-hold:disabled {
|
||||||
|
filter: grayscale(0.7);
|
||||||
|
opacity: 0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live-dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 0.7em;
|
||||||
|
height: 0.7em;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
vertical-align: middle;
|
||||||
|
animation: live-dot-pulse 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes live-dot-pulse {
|
||||||
|
50% { opacity: 0.25; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.live-dot { animation: none; }
|
||||||
|
}
|
||||||
|
|
||||||
.btn-mini {
|
.btn-mini {
|
||||||
padding: 3px 8px;
|
padding: 3px 8px;
|
||||||
font-size: 0.76rem;
|
font-size: 0.76rem;
|
||||||
|
|||||||
Reference in new issue
Block a user