Feature: JETZT-Welt — Gassirunde+Übungs-Vorschlag-Balken, Desktop-Zahnrad entfernt, SW by-v648
This commit is contained in:
parent
1d50bf1430
commit
bb8ceaf114
5 changed files with 88 additions and 7 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@
|
|||
</script>
|
||||
|
||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=647">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=647">
|
||||
<link rel="stylesheet" href="/css/components.css?v=647">
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=648">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=648">
|
||||
<link rel="stylesheet" href="/css/components.css?v=648">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
@ -565,7 +565,7 @@
|
|||
<script src="/js/api.js?v=94"></script>
|
||||
<script src="/js/ui.js?v=94"></script>
|
||||
<script src="/js/app.js?v=94"></script>
|
||||
<script src="/js/worlds.js?v=647"></script>
|
||||
<script src="/js/worlds.js?v=648"></script>
|
||||
|
||||
<!-- Feature-Seiten werden lazy geladen -->
|
||||
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -715,6 +715,33 @@ window.Worlds = (() => {
|
|||
</div>
|
||||
${alertHtml}
|
||||
${streakHtml}
|
||||
${user && dog ? `
|
||||
<div id="wj-suggestions" style="display:flex;flex-direction:column;gap:8px">
|
||||
<div class="world-reminder" id="wj-route-chip" data-wnav="routes">
|
||||
<svg class="ph-icon" style="width:1.1rem;height:1.1rem;color:var(--c-primary)">
|
||||
<use href="/icons/phosphor.svg#path"></use></svg>
|
||||
<div style="flex:1;min-width:0">
|
||||
<div style="font-size:9px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
|
||||
color:rgba(255,255,255,0.45);line-height:1">Gassirunde</div>
|
||||
<div id="wj-route-val" style="font-size:var(--text-xs);font-weight:700;color:white;margin-top:3px;
|
||||
white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Berechne…</div>
|
||||
</div>
|
||||
<svg class="ph-icon" style="width:.9rem;height:.9rem;color:rgba(255,255,255,0.35);flex-shrink:0">
|
||||
<use href="/icons/phosphor.svg#arrow-right"></use></svg>
|
||||
</div>
|
||||
<div class="world-reminder" id="wj-exercise-chip" data-wnav="uebungen">
|
||||
<svg class="ph-icon" style="width:1.1rem;height:1.1rem;color:var(--c-primary)">
|
||||
<use href="/icons/phosphor.svg#target"></use></svg>
|
||||
<div style="flex:1;min-width:0">
|
||||
<div style="font-size:9px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
|
||||
color:rgba(255,255,255,0.45);line-height:1">Übung des Tages</div>
|
||||
<div id="wj-exercise-val" style="font-size:var(--text-xs);font-weight:700;color:white;margin-top:3px;
|
||||
white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Lade…</div>
|
||||
</div>
|
||||
<svg class="ph-icon" style="width:.9rem;height:.9rem;color:rgba(255,255,255,0.35);flex-shrink:0">
|
||||
<use href="/icons/phosphor.svg#arrow-right"></use></svg>
|
||||
</div>
|
||||
</div>` : ''}
|
||||
</div>
|
||||
<div class="world-bottom">
|
||||
<div class="world-section-label">Deine Bereiche</div>
|
||||
|
|
@ -727,6 +754,59 @@ window.Worlds = (() => {
|
|||
</div>
|
||||
`;
|
||||
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 ───────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue