Wetter: aktuelle Ist-Temperatur als Jetzt-Banner oben (API.weather.get parallel), SW v1121
This commit is contained in:
parent
26b515cede
commit
b239eee0d6
6 changed files with 63 additions and 18 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1120'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1121'; // ← 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;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ window.Page_wetter = (() => {
|
|||
let _container = null;
|
||||
let _appState = null;
|
||||
let _data = null;
|
||||
let _current = null;
|
||||
let _selDay = 0;
|
||||
let _loading = false;
|
||||
let _recordsLoaded = false;
|
||||
|
|
@ -239,8 +240,13 @@ window.Page_wetter = (() => {
|
|||
if (_loading) return;
|
||||
_loading = true;
|
||||
try {
|
||||
_data = await API.weather.forecast(lat, lon);
|
||||
_selDay = 0;
|
||||
const [forecast, current] = await Promise.all([
|
||||
API.weather.forecast(lat, lon),
|
||||
API.weather.get(lat, lon).catch(() => null), // Ist-Temperatur, best-effort
|
||||
]);
|
||||
_data = forecast;
|
||||
_current = current;
|
||||
_selDay = 0;
|
||||
_renderWeather();
|
||||
} catch {
|
||||
const body = _container.querySelector('#wttr-body');
|
||||
|
|
@ -275,6 +281,8 @@ window.Page_wetter = (() => {
|
|||
if (!days.length) return;
|
||||
|
||||
body.innerHTML = `
|
||||
${_nowBanner()}
|
||||
|
||||
<!-- 7-Tage-Strip -->
|
||||
<div id="wttr-strip-wrap"
|
||||
style="overflow-x:auto;-webkit-overflow-scrolling:touch;
|
||||
|
|
@ -320,6 +328,43 @@ window.Page_wetter = (() => {
|
|||
_loadRecords();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// "JETZT"-BANNER (aktuelle Ist-Temperatur)
|
||||
// ----------------------------------------------------------
|
||||
function _nowBanner() {
|
||||
const c = _current;
|
||||
if (!c || c.temp_c == null) return '';
|
||||
|
||||
const desc = c.desc || WMO_DESC[c.weathercode] || '';
|
||||
const place = c.location_name || '';
|
||||
const feels = c.feels_like_c != null && Math.round(c.feels_like_c) !== Math.round(c.temp_c)
|
||||
? `Gefühlt ${Math.round(c.feels_like_c)}°`
|
||||
: '';
|
||||
const sub = [desc, feels, place].filter(Boolean).join(' · ');
|
||||
|
||||
return `
|
||||
<div class="section-card mb-4"
|
||||
style="display:flex;align-items:center;gap:var(--space-3);
|
||||
padding:var(--space-3) var(--space-4)">
|
||||
${_wmoIcon(c.weathercode, '3rem')}
|
||||
<div style="display:flex;flex-direction:column;line-height:1.1">
|
||||
<span style="font-size:2.25rem;font-weight:700;letter-spacing:-1px">
|
||||
${Math.round(c.temp_c)}°
|
||||
</span>
|
||||
<span style="font-size:var(--text-xs);color:var(--c-text-secondary);
|
||||
font-weight:600;text-transform:uppercase;letter-spacing:.5px">
|
||||
Jetzt
|
||||
</span>
|
||||
</div>
|
||||
<div style="margin-left:auto;text-align:right;
|
||||
font-size:var(--text-sm);color:var(--c-text-secondary);
|
||||
max-width:55%">
|
||||
${UI.escape(sub)}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// STRIP AKTUALISIEREN (aktiver Tag)
|
||||
// ----------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue