fix qr code
This commit is contained in:
@@ -310,7 +310,7 @@ const buildDriverActivePracticeStats = (trainingState, driverId, nowTs = Date.no
|
|||||||
const buildTrainingRecommendation = (stats) => buildTrainingRecommendationLogic(stats);
|
const buildTrainingRecommendation = (stats) => buildTrainingRecommendationLogic(stats);
|
||||||
const getTrainingGoalProgress = (goal, stats) => getTrainingGoalProgressLogic(goal, stats);
|
const getTrainingGoalProgress = (goal, stats) => getTrainingGoalProgressLogic(goal, stats);
|
||||||
const getNextTrainingMilestone = (stats) => getNextTrainingMilestoneLogic(stats);
|
const getNextTrainingMilestone = (stats) => getNextTrainingMilestoneLogic(stats);
|
||||||
const renderTraining = () => renderTrainingView({ state, dom, t, escapeHtml, formatLap, formatRaceClock, uid, saveState, renderView, normalizeTrainingState, syncTrainingLedger, buildDriverTrainingStats, buildDriverTimingChannelStats: buildDriverTimingChannelStatsLogic, buildDriverActivePracticeStats, buildTrainingRecommendation, getTrainingGoalProgress, getNextTrainingMilestone, buildTrainingMissions: buildTrainingMissionsLogic, buildTrainingHighlights: buildTrainingHighlightsLogic, getClubTrainingGoalProgress: getClubTrainingGoalProgressLogic, buildTrainingPaceBuckets: buildTrainingPaceBucketsLogic, buildTrainingWeekdayStats: buildTrainingWeekdayStatsLogic, buildTrainingStintAnalysis: buildTrainingStintAnalysisLogic, buildTrainingMarkerComparisons: buildTrainingMarkerComparisonsLogic, getSelectedDriverId: () => selectedTrainingDriverId, setSelectedDriverId: (value) => { selectedTrainingDriverId = value; updateViewUrl("training", value, selectedTrainingClassId); }, getSelectedClassId: () => selectedTrainingClassId, setSelectedClassId: (value) => { selectedTrainingClassId = value; updateViewUrl("training", selectedTrainingDriverId, value); } });
|
const renderTraining = () => renderTrainingView({ state, dom, t, escapeHtml, formatLap, formatRaceClock, uid, saveState, syncStateToBackend, renderView, normalizeTrainingState, syncTrainingLedger, buildDriverTrainingStats, buildDriverTimingChannelStats: buildDriverTimingChannelStatsLogic, buildDriverActivePracticeStats, buildTrainingRecommendation, getTrainingGoalProgress, getNextTrainingMilestone, buildTrainingMissions: buildTrainingMissionsLogic, buildTrainingHighlights: buildTrainingHighlightsLogic, getClubTrainingGoalProgress: getClubTrainingGoalProgressLogic, buildTrainingPaceBuckets: buildTrainingPaceBucketsLogic, buildTrainingWeekdayStats: buildTrainingWeekdayStatsLogic, buildTrainingStintAnalysis: buildTrainingStintAnalysisLogic, buildTrainingMarkerComparisons: buildTrainingMarkerComparisonsLogic, getSelectedDriverId: () => selectedTrainingDriverId, setSelectedDriverId: (value) => { selectedTrainingDriverId = value; updateViewUrl("training", value, selectedTrainingClassId); }, getSelectedClassId: () => selectedTrainingClassId, setSelectedClassId: (value) => { selectedTrainingClassId = value; updateViewUrl("training", selectedTrainingDriverId, value); } });
|
||||||
const applyCompetitorCorrection = (session, row, options = {}) => {
|
const applyCompetitorCorrection = (session, row, options = {}) => {
|
||||||
const result = applyCompetitorCorrectionLogic(session, row, options, { ensureSessionResult, uid, t, formatLap, saveState });
|
const result = applyCompetitorCorrectionLogic(session, row, options, { ensureSessionResult, uid, t, formatLap, saveState });
|
||||||
if (!options.reset && ((Number(options.timeMsDelta || 0) > 0) || (Number(options.lapDelta || 0) < 0))) {
|
if (!options.reset && ((Number(options.timeMsDelta || 0) > 0) || (Number(options.lapDelta || 0) < 0))) {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ function renderStintRow(row, { t, escapeHtml, formatLap, formatRaceClock }) {
|
|||||||
|
|
||||||
export function renderTrainingView(deps) {
|
export function renderTrainingView(deps) {
|
||||||
const moreStatsWasOpen = Boolean(document.getElementById("trainingMoreStats")?.open);
|
const moreStatsWasOpen = Boolean(document.getElementById("trainingMoreStats")?.open);
|
||||||
|
const goalsSharingElement = document.getElementById("trainingGoalsSharing");
|
||||||
|
const goalsSharingWasOpen = goalsSharingElement ? goalsSharingElement.open : true;
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
dom,
|
dom,
|
||||||
@@ -38,6 +40,7 @@ export function renderTrainingView(deps) {
|
|||||||
formatRaceClock,
|
formatRaceClock,
|
||||||
uid,
|
uid,
|
||||||
saveState,
|
saveState,
|
||||||
|
syncStateToBackend,
|
||||||
renderView,
|
renderView,
|
||||||
normalizeTrainingState,
|
normalizeTrainingState,
|
||||||
syncTrainingLedger,
|
syncTrainingLedger,
|
||||||
@@ -420,7 +423,7 @@ export function renderTrainingView(deps) {
|
|||||||
` : ""}
|
` : ""}
|
||||||
|
|
||||||
<div class="training-secondary">
|
<div class="training-secondary">
|
||||||
<details class="training-disclosure">
|
<details class="training-disclosure" id="trainingGoalsSharing" ${goalsSharingWasOpen ? "open" : ""}>
|
||||||
<summary>
|
<summary>
|
||||||
<span><strong>${escapeHtml(t("training.manage_goals_sharing"))}</strong><small>${escapeHtml(t("training.manage_goals_sharing_hint"))}</small></span>
|
<span><strong>${escapeHtml(t("training.manage_goals_sharing"))}</strong><small>${escapeHtml(t("training.manage_goals_sharing_hint"))}</small></span>
|
||||||
<span class="training-disclosure-arrow">+</span>
|
<span class="training-disclosure-arrow">+</span>
|
||||||
@@ -700,7 +703,7 @@ export function renderTrainingView(deps) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("trainingPublicBaseSave")?.addEventListener("click", () => {
|
document.getElementById("trainingPublicBaseSave")?.addEventListener("click", async () => {
|
||||||
const input = document.getElementById("trainingPublicBaseUrl");
|
const input = document.getElementById("trainingPublicBaseUrl");
|
||||||
const normalized = normalizePublicBaseUrl(input?.value);
|
const normalized = normalizePublicBaseUrl(input?.value);
|
||||||
if (input?.value && !normalized) {
|
if (input?.value && !normalized) {
|
||||||
@@ -709,6 +712,7 @@ export function renderTrainingView(deps) {
|
|||||||
}
|
}
|
||||||
state.settings.publicBaseUrl = normalized;
|
state.settings.publicBaseUrl = normalized;
|
||||||
saveState();
|
saveState();
|
||||||
|
await syncStateToBackend();
|
||||||
renderView();
|
renderView();
|
||||||
});
|
});
|
||||||
document.getElementById("trainingPublicAddressDetect")?.addEventListener("click", async () => {
|
document.getElementById("trainingPublicAddressDetect")?.addEventListener("click", async () => {
|
||||||
@@ -725,9 +729,10 @@ export function renderTrainingView(deps) {
|
|||||||
if (status) status.textContent = t("training.detect_public_ip_failed");
|
if (status) status.textContent = t("training.detect_public_ip_failed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.getElementById("trainingPublicProfileEnable")?.addEventListener("click", () => {
|
document.getElementById("trainingPublicProfileEnable")?.addEventListener("click", async () => {
|
||||||
replacePublicProfileShare(state, selectedProfileId, profileReferences);
|
replacePublicProfileShare(state, selectedProfileId, profileReferences);
|
||||||
saveState();
|
saveState();
|
||||||
|
await syncStateToBackend();
|
||||||
renderView();
|
renderView();
|
||||||
});
|
});
|
||||||
document.getElementById("trainingPublicProfileCopy")?.addEventListener("click", async () => {
|
document.getElementById("trainingPublicProfileCopy")?.addEventListener("click", async () => {
|
||||||
@@ -736,15 +741,17 @@ export function renderTrainingView(deps) {
|
|||||||
document.getElementById("trainingPublicProfileOpen")?.addEventListener("click", () => {
|
document.getElementById("trainingPublicProfileOpen")?.addEventListener("click", () => {
|
||||||
window.open(publicProfileUrl, "_blank", "noopener,noreferrer");
|
window.open(publicProfileUrl, "_blank", "noopener,noreferrer");
|
||||||
});
|
});
|
||||||
document.getElementById("trainingPublicProfileRotate")?.addEventListener("click", () => {
|
document.getElementById("trainingPublicProfileRotate")?.addEventListener("click", async () => {
|
||||||
if (!confirm(t("training.replace_link_confirm"))) return;
|
if (!confirm(t("training.replace_link_confirm"))) return;
|
||||||
replacePublicProfileShare(state, selectedProfileId, profileReferences);
|
replacePublicProfileShare(state, selectedProfileId, profileReferences);
|
||||||
saveState();
|
saveState();
|
||||||
|
await syncStateToBackend();
|
||||||
renderView();
|
renderView();
|
||||||
});
|
});
|
||||||
document.getElementById("trainingPublicProfileDisable")?.addEventListener("click", () => {
|
document.getElementById("trainingPublicProfileDisable")?.addEventListener("click", async () => {
|
||||||
state.training.shares = state.training.shares.map((share) => profileReferences.has(String(share.driverId || "")) ? { ...share, enabled: false } : share);
|
state.training.shares = state.training.shares.map((share) => profileReferences.has(String(share.driverId || "")) ? { ...share, enabled: false } : share);
|
||||||
saveState();
|
saveState();
|
||||||
|
await syncStateToBackend();
|
||||||
renderView();
|
renderView();
|
||||||
});
|
});
|
||||||
document.querySelectorAll(".training-club-driver").forEach((button) => {
|
document.querySelectorAll(".training-club-driver").forEach((button) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user