diff --git a/backend/static/css/components.css b/backend/static/css/components.css index 4f93c16..9415702 100644 --- a/backend/static/css/components.css +++ b/backend/static/css/components.css @@ -7826,9 +7826,10 @@ svg.empty-state-icon { color: rgba(255, 255, 255, 0.9); } -/* Desktop-Sidebar entfernt — Welten übernehmen Navigation */ +/* Desktop-Sidebar + Zahnrad entfernt — Welten übernehmen Navigation */ @media (min-width: 768px) { #sidebar { display: none !important; } + #worlds-settings { display: none !important; } #page-content { padding-left: 0 !important; } .map-full-layout { left: 0 !important; } .rk-map-section { left: 0 !important; } diff --git a/backend/static/index.html b/backend/static/index.html index cab50bc..a1fdb4c 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -93,9 +93,9 @@ - - - + + + @@ -565,7 +565,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index d6ec7a7..3f47c07 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '647'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '648'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.2.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; diff --git a/backend/static/js/worlds.js b/backend/static/js/worlds.js index 2056b6f..3722220 100644 --- a/backend/static/js/worlds.js +++ b/backend/static/js/worlds.js @@ -715,6 +715,33 @@ window.Worlds = (() => { ${alertHtml} ${streakHtml} + ${user && dog ? ` +
+
+ + +
+
Gassirunde
+
Berechne…
+
+ + +
+
+ + +
+
Übung des Tages
+
Lade…
+
+ + +
+
` : ''}
Deine Bereiche
@@ -727,6 +754,59 @@ window.Worlds = (() => {
`; el.querySelectorAll('[data-wnav]').forEach(e => e.addEventListener('click', () => navigateTo(e.dataset.wnav))); + + if (user && dog) { + _loadJetztExercise(dog); + _loadJetztRoute(); + } + } + + async function _loadJetztExercise(dog) { + const valEl = document.getElementById('wj-exercise-val'); + if (!valEl) return; + try { + const res = await _cachedGet(`dash_${dog.id}`, `/dogs/${dog.id}/welcome-dashboard`); + const ex = res.data?.daily_exercise; + valEl.textContent = ex?.name || '—'; + } catch { valEl.textContent = '—'; } + } + + async function _loadJetztRoute() { + const valEl = document.getElementById('wj-route-val'); + if (!valEl) return; + + // Tages-Cache (gleicher Key wie welcome.js) + const today = new Date().toISOString().slice(0, 10); + const cacheKey = 'by_daily_route_' + today; + const cached = localStorage.getItem(cacheKey); + if (cached) { + try { _applyJetztRoute(valEl, JSON.parse(cached)); return; } catch {} + } + + let loc; + try { loc = await API.getLocation({ timeout: 5000, maximumAge: 300000 }); } + catch { valEl.textContent = 'Standort nötig'; return; } + + const dayIdx = Math.floor(Date.now() / 86400000); + const km = [2, 4, 6][dayIdx % 3]; + const seed = dayIdx % 5; + try { + const result = await API.post('/routes/suggest', { lat: loc.lat, lon: loc.lon, distance_km: km, seed }); + if (!result?.gps_track?.length) { valEl.textContent = 'Keine Route gefunden'; return; } + localStorage.setItem(cacheKey, JSON.stringify(result)); + // alte Einträge aufräumen + Object.keys(localStorage) + .filter(k => k.startsWith('by_daily_route_') && k !== cacheKey) + .forEach(k => localStorage.removeItem(k)); + _applyJetztRoute(valEl, result); + } catch { valEl.textContent = 'Route nicht verfügbar'; } + } + + function _applyJetztRoute(valEl, result) { + const durStr = result.dauer_min < 60 + ? `${result.dauer_min} min` + : `${Math.floor(result.dauer_min / 60)}h ${result.dauer_min % 60 > 0 ? ' ' + (result.dauer_min % 60) + 'min' : ''}`; + valEl.textContent = `${result.distanz_km} km · ${durStr}`; } // ── HUND WORLD ─────────────────────────────────────────────── diff --git a/backend/static/sw.js b/backend/static/sw.js index 27f400a..b70d445 100644 --- a/backend/static/sw.js +++ b/backend/static/sw.js @@ -3,7 +3,7 @@ Offline-Cache + Push Notifications + Tile-Cache ============================================================ */ -const CACHE_VERSION = 'by-v647'; +const CACHE_VERSION = 'by-v648'; const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache