From 08786844024b86e0aaa5f683ac0bde2f05fa739a Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 15 May 2026 18:03:28 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20Giftk=C3=B6der=20=E2=80=94=20Danke-O?= =?UTF-8?q?verlay=20nach=20erfolgreicher=20Meldung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Statt sofort zu schließen zeigt das Modal nach dem Submit eine Bestätigung: 'Wir kümmern uns darum und melden es den anderen Nutzern in der Umgebung. Vielen Dank, dass du die Community schützt!' Auto-Close nach 5 Sekunden, OK-Button zum sofortigen Schließen. Bei gequeuter Meldung (offline) zusätzlicher Hinweis auf spätere Synchronisierung. SW by-v993, APP_VER 993 --- backend/main.py | 2 +- backend/static/js/app.js | 2 +- backend/static/js/pages/poison.js | 43 ++++++++++++++++++++++++++----- backend/static/sw.js | 2 +- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/backend/main.py b/backend/main.py index e5e68dc..42f22ba 100644 --- a/backend/main.py +++ b/backend/main.py @@ -410,7 +410,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "992" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "993" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 28492bb..aa2c342 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 = '992'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '993'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen diff --git a/backend/static/js/pages/poison.js b/backend/static/js/pages/poison.js index f4b1dd4..2a3988b 100644 --- a/backend/static/js/pages/poison.js +++ b/backend/static/js/pages/poison.js @@ -543,8 +543,11 @@ window.Page_poison = (() => { const created = await API.poison.report(payload); - // SW hat Request in Queue gelegt (offline) — Modal schließen, kein Marker - if (created?._queued) { UI.modal.close(); return; } + // SW hat Request in Queue gelegt (offline) + if (created?._queued) { + _showPoisonThanks(true); + return; + } // Foto hochladen if (photoInput?.files[0]) { @@ -558,8 +561,7 @@ window.Page_poison = (() => { } } - // Distanz client-seitig berechnen (für sofortige Anzeige) - // _userPos aktualisieren falls Picker neuen Standort geliefert hat + // Distanz client-seitig berechnen if (loc.lat && loc.lon) _userPos = { lat: loc.lat, lon: loc.lon }; created.distanz_m = _userPos ? Math.round(_haversine(_userPos.lat, _userPos.lon, created.lat, created.lon)) @@ -571,12 +573,41 @@ window.Page_poison = (() => { _updateBadge(_reports.length); App.checkNearbyAlerts(); App.callModule('map', 'refresh'); - UI.toast.success('Giftköder gemeldet! Danke für die Warnung.'); - UI.modal.close(); + _showPoisonThanks(false); }); }); } + // ---------------------------------------------------------- + // DANKE-OVERLAY nach Giftköder-Meldung + // ---------------------------------------------------------- + function _showPoisonThanks(isQueued) { + const offlineNote = isQueued + ? `

+ 📡 Wird synchronisiert sobald du wieder online bist. +

` + : ''; + UI.modal.open({ + title: '✅ Danke für deine Meldung!', + body: ` +
+
🚨
+

+ Wir kümmern uns darum und melden es den anderen Nutzern in der Umgebung. +

+

+ Vielen Dank, dass du die Community schützt! 🐾 +

+ ${offlineNote} +
+ `, + footer: ``, + }); + document.getElementById('poison-thanks-ok')?.addEventListener('click', UI.modal.close); + setTimeout(() => UI.modal.close(), 5000); + } + // ---------------------------------------------------------- // BADGE (Sidebar + Bottom-Nav) // ---------------------------------------------------------- diff --git a/backend/static/sw.js b/backend/static/sw.js index cee7de1..aa5a66d 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-v992'; +const CACHE_VERSION = 'by-v993'; 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