Add simplified Open Practice flow and reorganize

This commit is contained in:
larssand
2026-08-24 19:25:21 +02:00
parent 5a6e51c51b
commit 2e6866a013
13 changed files with 481 additions and 55 deletions

View File

@@ -51,6 +51,7 @@ export function renderDashboardView(deps) {
formatLap,
renderSessionsTable,
setCurrentView,
updateViewUrl,
renderNav,
renderView,
connectDecoder,
@@ -75,6 +76,40 @@ export function renderDashboardView(deps) {
: t("settings.passing_sound_off");
dom.view.innerHTML = `
<section class="panel dashboard-workflow">
<div class="panel-header">
<div>
<h3>${t("dashboard.get_started")}</h3>
<p class="hint">${t("dashboard.get_started_hint")}</p>
</div>
</div>
<div class="panel-body dashboard-workflow-grid">
<article class="dashboard-workflow-card">
<span class="workflow-number">1</span>
<div><strong>${t("dashboard.step_system")}</strong><p>${t("dashboard.step_system_hint")}</p></div>
<button id="workflowSettings" class="btn" type="button">${t("dashboard.open_settings")}</button>
</article>
<article class="dashboard-workflow-card">
<span class="workflow-number">2</span>
<div><strong>${t("dashboard.step_register")}</strong><p>${t("dashboard.step_register_hint")}</p></div>
<button id="workflowDrivers" class="btn" type="button">${t("dashboard.open_register")}</button>
</article>
<article class="dashboard-workflow-card dashboard-workflow-card-primary">
<span class="workflow-number">3</span>
<div><strong>${t("dashboard.step_create")}</strong><p>${t("dashboard.step_create_hint")}</p></div>
<button id="workflowRaceSetup" class="btn btn-primary" type="button">${t("dashboard.open_race_setup")}</button>
</article>
<article class="dashboard-workflow-card">
<span class="workflow-number">4</span>
<div><strong>${t("dashboard.step_run")}</strong><p>${t("dashboard.step_run_hint")}</p></div>
<div class="actions-inline">
<button id="workflowTiming" class="btn" type="button">${t("dashboard.open_timing")}</button>
<button id="workflowOverlay" class="btn" type="button">${t("dashboard.open_overlay")}</button>
</div>
</article>
</div>
</section>
<div class="grid cols-4">
${statCard(t("dashboard.events"), String(state.events.length), t("dashboard.created"))}
${statCard(t("dashboard.drivers"), String(state.drivers.length), t("dashboard.registered"))}
@@ -93,7 +128,7 @@ export function renderDashboardView(deps) {
active
? `<p><strong>${active.name}</strong> (${getSessionTypeLabel(active.type)})</p>
<p>${getEventName(active.eventId)} • ${getModeLabel(active.mode)}</p>
<p>${t("dashboard.duration")}: ${active.durationMin} min</p>`
<p>${t("dashboard.duration")}: ${active.type === "open_practice" ? t("dashboard.untimed") : `${active.durationMin} min`}</p>`
: `<p>${t("dashboard.no_session")}</p>`
}
</div>
@@ -157,17 +192,22 @@ export function renderDashboardView(deps) {
</section>
`;
document.getElementById("goEvents")?.addEventListener("click", () => {
setCurrentView("events");
const navigateTo = (view) => {
setCurrentView(view);
updateViewUrl(view);
renderNav();
renderView();
});
};
document.getElementById("goTiming")?.addEventListener("click", () => {
setCurrentView("timing");
renderNav();
renderView();
});
document.getElementById("workflowSettings")?.addEventListener("click", () => navigateTo("settings"));
document.getElementById("workflowDrivers")?.addEventListener("click", () => navigateTo("drivers"));
document.getElementById("workflowRaceSetup")?.addEventListener("click", () => navigateTo("race_setup"));
document.getElementById("workflowTiming")?.addEventListener("click", () => navigateTo("timing"));
document.getElementById("workflowOverlay")?.addEventListener("click", () => navigateTo("overlay"));
document.getElementById("goEvents")?.addEventListener("click", () => navigateTo("events"));
document.getElementById("goTiming")?.addEventListener("click", () => navigateTo("timing"));
document.getElementById("connectNow")?.addEventListener("click", connectDecoder);
document.getElementById("disconnectNow")?.addEventListener("click", disconnectDecoder);