Routen: Bestätigungs-Toast nach Ablaufen + "X× gelaufen · zuletzt" auf der Karte
- record_walk gibt total_km zurück → Toast "🐾 X km gezählt · Lebenswerk Y km". - Nachtrag-Toast (_flushPendingNavWalk) zeigt ebenfalls km + Lebenswerk. - list_routes liefert my_walk_count + my_last_walked → Routen-Karte zeigt "🐾 X× gelaufen · zuletzt heute/gestern/vor N Tagen". Macht für Angie sichtbar, dass das Ablaufen einer gespeicherten Route mitzählt.
This commit is contained in:
parent
91624dac25
commit
667ed91f33
7 changed files with 49 additions and 20 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1160'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1161'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||
window.APP_VERSION = APP_VERSION;
|
||||
|
|
|
|||
|
|
@ -1442,6 +1442,20 @@ window.Page_routes = (() => {
|
|||
? `<div class="rk-card-creator">${UI.icon('user')} ${UI.escape(r.user_name||'Anonym')}</div>`
|
||||
: '';
|
||||
|
||||
// „X× gelaufen · zuletzt …" — macht sichtbar, dass das Ablaufen mitzählt
|
||||
const _wc = r.my_walk_count || 0;
|
||||
let walkedLine = '';
|
||||
if (_wc > 0) {
|
||||
let last = '';
|
||||
if (r.my_last_walked) {
|
||||
const d = new Date(String(r.my_last_walked).replace(' ', 'T') + 'Z'); // walked_at ist UTC
|
||||
const days = Math.floor((Date.now() - d.getTime()) / 86400000);
|
||||
last = days <= 0 ? 'heute' : days === 1 ? 'gestern' : `vor ${days} Tagen`;
|
||||
}
|
||||
walkedLine = `<div style="font-size:11px;color:var(--c-text-secondary);margin:2px 0 0">
|
||||
🐾 ${_wc}× gelaufen${last ? ' · zuletzt ' + last : ''}</div>`;
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="rk-card" data-id="${r.id}" ${r._isPending ? 'data-pending="1"' : ''}>
|
||||
<div class="rk-card-preview">${previewContent}</div>
|
||||
|
|
@ -1461,6 +1475,7 @@ window.Page_routes = (() => {
|
|||
${r.hunde_tauglichkeit ? _pill(HUNDE_TEXT[r.hunde_tauglichkeit]||'', 'rgba(234,179,8,0.10)','#facc15','rgba(234,179,8,0.30)') : ''}
|
||||
${!isDiscover && !r.is_public ? _pill('Privat','rgba(59,130,246,0.10)','#60a5fa','rgba(59,130,246,0.30)') : ''}
|
||||
</div>
|
||||
${walkedLine}
|
||||
<div class="rk-card-footer">
|
||||
<div class="rk-stars">${_starsHTML(r.id, r.bewertung||0, r.anz_bewertungen||0)}</div>
|
||||
<div class="rk-card-actions">
|
||||
|
|
@ -2014,6 +2029,9 @@ window.Page_routes = (() => {
|
|||
API.routes.walked(_navWalkMeta.routeId, walkedKm, pct)
|
||||
.then(res => {
|
||||
try { localStorage.removeItem(_PENDING_WALK_KEY); } catch {}
|
||||
const km = walkedKm.toFixed(1).replace('.', ',');
|
||||
const tot = res?.total_km != null ? ` · Lebenswerk ${String(res.total_km).replace('.', ',')} km` : '';
|
||||
UI.toast.success(`🐾 ${km} km gezählt${tot}`);
|
||||
if (res?.new_badges?.length) UI.toast.success(`🏅 Neues Badge: ${res.new_badges[0].name}!`);
|
||||
})
|
||||
.catch(() => {}); // bleibt in localStorage → Nachtrag beim nächsten Start
|
||||
|
|
@ -2033,7 +2051,9 @@ window.Page_routes = (() => {
|
|||
API.routes.walked(p.routeId, p.walkedKm, p.pct)
|
||||
.then(res => {
|
||||
try { localStorage.removeItem(_PENDING_WALK_KEY); } catch {}
|
||||
UI.toast.success('Gelaufene Tour nachgetragen 🐾');
|
||||
const km = Number(p.walkedKm || 0).toFixed(1).replace('.', ',');
|
||||
const tot = res?.total_km != null ? ` · Lebenswerk ${String(res.total_km).replace('.', ',')} km` : '';
|
||||
UI.toast.success(`🐾 ${km} km nachgetragen${tot}`);
|
||||
if (res?.new_badges?.length) UI.toast.success(`🏅 Neues Badge: ${res.new_badges[0].name}!`);
|
||||
})
|
||||
.catch(() => {}); // bleibt für den nächsten Versuch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue