From 662190e3080d74e93b170531745b8fb9afa6d87f Mon Sep 17 00:00:00 2001 From: rene Date: Fri, 8 May 2026 13:16:51 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20Geburtstags-Banner=20in=20HUND-Welt?= =?UTF-8?q?=20=E2=80=94=20heute=20&=20morgen,=20mit=20Alter=20und=20Animat?= =?UTF-8?q?ion=20(SW=20by-v776)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 2 +- backend/static/index.html | 2 +- backend/static/js/app.js | 2 +- backend/static/js/worlds.js | 31 +++++++++++++++++++++++++++++++ backend/static/sw.js | 2 +- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/backend/main.py b/backend/main.py index e6f1d30..a3f8685 100644 --- a/backend/main.py +++ b/backend/main.py @@ -327,7 +327,7 @@ MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media") os.makedirs(MEDIA_DIR, exist_ok=True) app.mount("/media", StaticFiles(directory=MEDIA_DIR), name="media") -APP_VER = "775" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "776" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/static/index.html b/backend/static/index.html index 27c1028..74e7a38 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -578,7 +578,7 @@ - + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 88eb9e0..aedf1a8 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 = '775'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '776'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.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/worlds.js b/backend/static/js/worlds.js index 4fcd9de..8086b5b 100644 --- a/backend/static/js/worlds.js +++ b/backend/static/js/worlds.js @@ -1236,6 +1236,23 @@ window.Worlds = (() => { if (_dogIdx >= _dogs.length) _dogIdx = 0; const dog = _dogs[_dogIdx]; + // Geburtstag prüfen (heute oder morgen → Feature sichtbar) + function _birthdayState(geb) { + if (!geb) return null; + const today = new Date(); + const tomorrow = new Date(today); tomorrow.setDate(today.getDate() + 1); + const mm = String(today.getMonth() + 1).padStart(2, '0'); + const dd = String(today.getDate()).padStart(2, '0'); + const mt = String(tomorrow.getMonth() + 1).padStart(2, '0'); + const dt = String(tomorrow.getDate()).padStart(2, '0'); + const mmdd = geb.slice(5); // 'MM-DD' + if (mmdd === `${mm}-${dd}`) return 'today'; + if (mmdd === `${mt}-${dt}`) return 'tomorrow'; + return null; + } + const bday = _birthdayState(dog.geburtstag); + const bdayYear = dog.geburtstag ? new Date().getFullYear() - parseInt(dog.geburtstag.slice(0, 4)) : null; + const [streakRes, diaryRes] = await Promise.allSettled([ _cachedGet(`streak_${dog.id}`, `/streak/${dog.id}`), _cachedGet(`diary_${dog.id}`, `/dogs/${dog.id}/diary?limit=1`), @@ -1294,6 +1311,20 @@ window.Worlds = (() => {
${otherAvatarsHtml}
+ ${bday ? ` +
+
${bday === 'today' ? '🎂' : '🎁'}
+
+ ${bday === 'today' + ? `Alles Gute zum ${bdayYear}. Geburtstag, ${_esc(dog.name)}! 🎉` + : `Morgen hat ${_esc(dog.name)} Geburtstag! 🥳`} +
+ ${bdayYear ? `
+ ${bday === 'today' ? `${bdayYear} Jahr${bdayYear !== 1 ? 'e' : ''} gemeinsam` : `Wird ${bdayYear} Jahr${bdayYear !== 1 ? 'e' : ''} alt`} +
` : ''} +
` : ''}
${!_hasBgPhoto ? ` diff --git a/backend/static/sw.js b/backend/static/sw.js index 9cf2a4a..63dcb19 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-v775'; +const CACHE_VERSION = 'by-v776'; 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