Wetter-Chip auf Karte + Bugfix private Routen zählen für km-Stats
- GET /api/weather?lat=&lon= (Open-Meteo, 30-min TTL-Cache) - Zecken-Warnung regelbasiert: März–Okt + Temp > 7°C - Karte: Wetterchip oben rechts nach GPS-Fix - stats.py + achievements.py: is_public-Filter entfernt — private Routen zählen jetzt für eigene km/Achievements - SW by-v320, APP_VER 308
This commit is contained in:
parent
43d33c0fd1
commit
0461f936ce
9 changed files with 185 additions and 13 deletions
|
|
@ -144,6 +144,7 @@ window.Page_map = (() => {
|
|||
_userPos = pos;
|
||||
if (_frankfurtTimer) { clearTimeout(_frankfurtTimer); _frankfurtTimer = null; }
|
||||
_map?.flyTo([pos.lat, pos.lon], 14, { duration: 1.2 });
|
||||
_loadWeather(pos.lat, pos.lon);
|
||||
}).catch(() => {
|
||||
const btn = document.getElementById('map-locate-btn');
|
||||
if (btn) {
|
||||
|
|
@ -195,6 +196,8 @@ window.Page_map = (() => {
|
|||
<button class="map-fab" id="map-locate-btn" title="Meinen Standort"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#map-pin"></use></svg></button>
|
||||
</div>
|
||||
|
||||
<div class="map-weather-chip map-weather-chip--hidden" id="map-weather-chip"></div>
|
||||
|
||||
<div class="map-statusbar" id="map-statusbar">
|
||||
<span id="map-zoom-info"></span>
|
||||
<span id="map-osm-status"></span>
|
||||
|
|
@ -1512,6 +1515,26 @@ window.Page_map = (() => {
|
|||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// WETTER-CHIP
|
||||
// ----------------------------------------------------------
|
||||
async function _loadWeather(lat, lon) {
|
||||
const chip = document.getElementById('map-weather-chip');
|
||||
if (!chip) return;
|
||||
try {
|
||||
const w = await API.get(`/api/weather?lat=${lat}&lon=${lon}`);
|
||||
const temp = w.temp_c != null ? `${Math.round(w.temp_c)}°` : '–';
|
||||
const icon = `<svg class="ph-icon" aria-hidden="true" style="width:16px;height:16px"><use href="/icons/phosphor.svg#${w.icon}"></use></svg>`;
|
||||
let zeckenHtml = '';
|
||||
if (w.zecken_warnung) {
|
||||
const cls = w.zecken_warnung === 'hoch' ? 'map-weather-chip__zecken map-weather-chip__zecken--hoch' : 'map-weather-chip__zecken';
|
||||
zeckenHtml = `<span class="${cls}" title="Zeckenrisiko ${w.zecken_warnung}">🦟 Zecken</span>`;
|
||||
}
|
||||
chip.innerHTML = `${icon}<span class="map-weather-chip__temp">${temp}</span><span class="map-weather-chip__desc">${w.desc}</span>${zeckenHtml}`;
|
||||
chip.classList.remove('map-weather-chip--hidden');
|
||||
} catch { /* still */ }
|
||||
}
|
||||
|
||||
return { init, refresh, onDogChange, startRecording: _startRecording, stopRecording: _stopRecording, isRecording: () => _recActive };
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue