From f425265e5a0f41082357af97adb8d7f4eb31c251 Mon Sep 17 00:00:00 2001 From: Stream Date: Tue, 5 May 2026 22:20:01 +0300 Subject: [PATCH] auto-sync: 2026-05-05 22:20:01 --- tasks/enduro-trails/prototype/static/app.css | 15 +++++ tasks/enduro-trails/prototype/static/app.js | 65 +++++++++++++------ .../enduro-trails/prototype/static/index.html | 18 +++++ 3 files changed, 78 insertions(+), 20 deletions(-) diff --git a/tasks/enduro-trails/prototype/static/app.css b/tasks/enduro-trails/prototype/static/app.css index df0ff5a..b060ea1 100644 --- a/tasks/enduro-trails/prototype/static/app.css +++ b/tasks/enduro-trails/prototype/static/app.css @@ -665,3 +665,18 @@ body.has-map-mode #sheet-backdrop.visible { pointer-events: none; } @media (min-width: 768px) { #sheet-route-mini { left: 72px; width: 380px; right: auto; border-radius: 0 14px 0 0; } } + +/* ── Moto Wheel Loading Indicator ────────────── */ +.moto-wheel { + width: 32px; height: 32px; + flex-shrink: 0; + display: none; +} +.moto-wheel.spinning { + display: block; + animation: wheelSpin 0.8s linear infinite; +} +@keyframes wheelSpin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} diff --git a/tasks/enduro-trails/prototype/static/app.js b/tasks/enduro-trails/prototype/static/app.js index 095476d..6b7fd5a 100644 --- a/tasks/enduro-trails/prototype/static/app.js +++ b/tasks/enduro-trails/prototype/static/app.js @@ -399,29 +399,25 @@ function toggleRouteMode() { const btn = document.getElementById('tb-route'); if (routeMode) { - // X button pressed while panel open → exit mode + clear route + // If sheet is open — close sheet but stay in mode + const sheet = document.getElementById('sheet-route'); + if (sheet && sheet.classList.contains('open')) { + closeSheet('sheet-route'); + return; + } + // Sheet is closed — exit mode and clear route routeMode = false; btn.classList.remove('active'); - closeSheet('sheet-route'); clearRoute(); window._map.getCanvas().style.cursor = ''; - } else if (routeResults.length > 0) { - // Route exists, mini-bar visible → show full panel - hideMiniRouteSheet(); - deactivateAllModes(); - routeMode = true; - btn.classList.add('active'); - openSheet('sheet-route'); - window._map.getCanvas().style.cursor = 'crosshair'; } else { - // No route → enter route input mode - hideMiniRouteSheet(); + // Enter route mode — do NOT open sheet deactivateAllModes(); routeMode = true; btn.classList.add('active'); - openSheet('sheet-route'); clearRoute(); window._map.getCanvas().style.cursor = 'crosshair'; + // sheet is NOT opened — user taps mini-bar to open it } updateMapModeClass(); } @@ -450,7 +446,6 @@ function clearRoute() { function addWaypointMode() { if (routeWaypoints.length >= 10) return; - // Убедиться что routeMode активен — иначе клик на карте игнорируется if (!routeMode) { routeMode = true; document.getElementById('tb-route').classList.add('active'); @@ -458,7 +453,12 @@ function addWaypointMode() { } addingWaypoint = true; window._map.getCanvas().style.cursor = 'crosshair'; - document.getElementById('route-status').textContent = 'Тапни на карте для добавления точки'; + // Hide main sheet so the map is visible for tapping + closeSheet('sheet-route'); + // Show hint in mini-bar + const statsEl = document.getElementById('mini-stats'); + if (statsEl) statsEl.textContent = 'Тапни на карте для добавления точки'; + document.getElementById('sheet-route-mini').classList.add('visible'); } // ─── Маркеры точек ───────────────────────────────────────────────── @@ -729,10 +729,15 @@ async function buildRoute() { if (routeWaypoints.length < 2) return; const map = window._map; const basePath = getBasePath(); - - document.getElementById('route-status').textContent = '⏳ Строю маршрут...'; + + // Show mini-bar with spinning wheel + showMiniRouteLoading(); + // Close main sheet if open + closeSheet('sheet-route'); + + document.getElementById('route-status').textContent = 'Строю маршрут...'; showSkeleton('route-cards', 3); - + try { const resp = await fetch(basePath + '/api/route', { method: 'POST', @@ -743,13 +748,19 @@ async function buildRoute() { const data = await resp.json(); routeResults = data.routes || []; if (!routeResults.length) throw new Error('Маршрут не найден'); - + drawRouteResults(routeResults, 0); - + document.getElementById('route-status').textContent = `${routeResults.length} маршрут(ов)`; + // Show mini-bar with result — do NOT open main sheet + hideMiniRouteLoading(); + showMiniRouteSheet(); } catch(e) { + hideMiniRouteLoading(); document.getElementById('route-status').textContent = '❌ ' + e.message; document.getElementById('route-cards').innerHTML = ''; + const statsEl = document.getElementById('mini-stats'); + if (statsEl) statsEl.textContent = '❌ ' + e.message; } } @@ -1857,6 +1868,20 @@ function selectMiniRoute(idx) { updateMiniRouteCard(); } +// ─── Mini Route Loading Indicator ───────────────────────────────── +function showMiniRouteLoading() { + const wheel = document.getElementById('mini-wheel'); + const statsEl = document.getElementById('mini-stats'); + if (wheel) wheel.classList.add('spinning'); + if (statsEl) statsEl.textContent = 'Строю маршрут...'; + document.getElementById('sheet-route-mini').classList.add('visible'); +} + +function hideMiniRouteLoading() { + const wheel = document.getElementById('mini-wheel'); + if (wheel) wheel.classList.remove('spinning'); +} + function initMiniRouteInteraction() { const mini = document.getElementById('sheet-route-mini'); if (!mini) return; diff --git a/tasks/enduro-trails/prototype/static/index.html b/tasks/enduro-trails/prototype/static/index.html index 4ed0bb2..7f23cc1 100644 --- a/tasks/enduro-trails/prototype/static/index.html +++ b/tasks/enduro-trails/prototype/static/index.html @@ -233,6 +233,24 @@
+ + + + + + + + + + + + + + + + + +
Вариант 1