fix(settings): open the right Settings tab from the update link and Race Day
The sidebar update notice now lands on System & backup at Updates, and Race Day's decoder/backend/audio fix buttons open the matching tab, instead of whichever tab was used last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9d79bcb4d3
commit
7f267e17fe
10 files changed
+57
-11
No files matched your search
@@ -4,7 +4,7 @@ import { PROLOGUE_OPTIONS_SEC, formatPrologueOption } from "./prologue_logic.js"
|
||||
export function getRaceDayCheckAction(item, session) {
|
||||
if (item.level === "ok") return null;
|
||||
if (["backend", "decoder", "split_decoder", "pit_decoders", "audio"].includes(item.id)) {
|
||||
return { view: "settings", label: "nav.settings" };
|
||||
return { view: "settings", settingsTab: item.id === "audio" ? "audio" : "connection", label: "nav.settings" };
|
||||
}
|
||||
if (item.id === "lap_window" && session?.mode === "race") {
|
||||
return { field: "minLapSec", label: "race_day.lap_window_edit" };
|
||||
@@ -257,7 +257,7 @@ export function renderRaceDayView(deps) {
|
||||
<div class="panel-body race-day-checks">
|
||||
${checks.map((item) => {
|
||||
const action = getRaceDayCheckAction(item, session);
|
||||
return `<article class="race-day-check is-${item.level}"><span aria-hidden="true"></span><div><strong>${t(`race_day.check_${item.id}`)}</strong><small>${renderPreflightDetail(item, { t, formatLap, escapeHtml })}</small>${item.level !== "ok" ? `<small>${t(`race_day.check_${item.level}`)}</small>` : ""}${action ? `<button class="btn btn-mini race-day-check-action" type="button" ${action.view ? `data-race-day-fix-view="${action.view}"` : `data-race-day-fix-field="${action.field}"`}>${t(action.label)}</button>` : ""}</div></article>`;
|
||||
return `<article class="race-day-check is-${item.level}"><span aria-hidden="true"></span><div><strong>${t(`race_day.check_${item.id}`)}</strong><small>${renderPreflightDetail(item, { t, formatLap, escapeHtml })}</small>${item.level !== "ok" ? `<small>${t(`race_day.check_${item.level}`)}</small>` : ""}${action ? `<button class="btn btn-mini race-day-check-action" type="button" ${action.view ? `data-race-day-fix-view="${action.view}"${action.settingsTab ? ` data-race-day-fix-tab="${action.settingsTab}"` : ""}` : `data-race-day-fix-field="${action.field}"`}>${t(action.label)}</button>` : ""}</div></article>`;
|
||||
}).join("")}
|
||||
</div>
|
||||
${session?.mode === "race" && lapWindowCheck ? `
|
||||
@@ -286,7 +286,7 @@ export function renderRaceDayView(deps) {
|
||||
</section>`;
|
||||
|
||||
dom.view.querySelectorAll("[data-race-day-fix-view]").forEach((button) => {
|
||||
button.addEventListener("click", () => navigateTo(button.dataset.raceDayFixView));
|
||||
button.addEventListener("click", () => navigateTo(button.dataset.raceDayFixView, { settingsTab: button.dataset.raceDayFixTab || "" }));
|
||||
});
|
||||
dom.view.querySelectorAll("[data-race-day-fix-field]").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
|
||||
Reference in new issue
Block a user