Feature: User-Geburtstag im Profil + Glückwunsch in JETZT-Welt
Settings: - Feld 'Dein Geburtstag (optional)' im Profil-Formular (Format MM-TT) - Hinweis: nur für Geburtstagsgrüße, kein Jahr nötig - profile.py: geburtstag gespeichert + Format-Validierung MM-DD JETZT-Welt wenn heute User-Geburtstag: - Greet-Text: 'Herzlichen Glückwunsch' statt Tageszeit-Gruß - Animiertes Geburtstags-Reminder-Card (confetti + cake Icons) - 'Alles Gute zum Geburtstag, [Name]!' SW by-v1028, APP_VER 1028
This commit is contained in:
parent
1328e2c4e3
commit
a4377033ec
6 changed files with 48 additions and 5 deletions
|
|
@ -410,7 +410,7 @@ async def serve_media(path: str, request: _Request):
|
|||
raise _HE(404, "Nicht gefunden.")
|
||||
return _media_response(filepath)
|
||||
|
||||
APP_VER = "1027" # muss mit APP_VER in app.js übereinstimmen
|
||||
APP_VER = "1028" # muss mit APP_VER in app.js übereinstimmen
|
||||
|
||||
@app.get("/.well-known/assetlinks.json")
|
||||
async def assetlinks():
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
|
|
@ -29,6 +30,7 @@ class ProfileUpdate(BaseModel):
|
|||
gassi_stunde_push: Optional[int] = None
|
||||
preferred_theme: Optional[str] = None
|
||||
billing_address: Optional[str] = None
|
||||
geburtstag: Optional[str] = None
|
||||
|
||||
|
||||
def _load_user(user_id: int) -> dict:
|
||||
|
|
@ -36,7 +38,8 @@ def _load_user(user_id: int) -> dict:
|
|||
row = conn.execute(
|
||||
"""SELECT id, name, real_name, email, rolle, is_premium, email_verified,
|
||||
bio, wohnort, erfahrung, social_link,
|
||||
profil_sichtbarkeit, avatar_url, created_at, billing_address
|
||||
profil_sichtbarkeit, avatar_url, created_at, billing_address,
|
||||
geburtstag
|
||||
FROM users WHERE id=?""",
|
||||
(user_id,)
|
||||
).fetchone()
|
||||
|
|
@ -64,6 +67,9 @@ async def update_profile(data: ProfileUpdate, user=Depends(get_current_user)):
|
|||
raise HTTPException(400, "wohnort darf maximal 60 Zeichen lang sein.")
|
||||
if "social_link" in fields and len(fields["social_link"]) > 120:
|
||||
raise HTTPException(400, "social_link darf maximal 120 Zeichen lang sein.")
|
||||
if "geburtstag" in fields and fields["geburtstag"]:
|
||||
if not re.fullmatch(r"\d{2}-\d{2}", fields["geburtstag"]):
|
||||
raise HTTPException(400, "geburtstag muss im Format MM-DD sein (z.B. 03-15).")
|
||||
|
||||
if not fields:
|
||||
return _load_user(user["id"])
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1027'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1028'; // ← 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
|
||||
|
|
|
|||
|
|
@ -1184,6 +1184,15 @@ window.Page_settings = (() => {
|
|||
placeholder="Musterstraße 1 12345 Berlin"
|
||||
style="${inputStyle};resize:vertical;font-family:inherit">${_esc(u.billing_address || '')}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label style="display:block;font-size:var(--text-sm);font-weight:600;margin-bottom:var(--space-1)">Dein Geburtstag <span style="font-weight:400;color:var(--c-text-secondary)">(optional)</span></label>
|
||||
<input name="geburtstag" type="text" maxlength="5" placeholder="MM-TT"
|
||||
value="${_esc(u.geburtstag || '')}"
|
||||
pattern="\\d{2}-\\d{2}"
|
||||
title="Format: MM-TT, z.B. 03-15"
|
||||
style="${inputStyle}">
|
||||
<div style="font-size:var(--text-xs);color:var(--c-text-secondary);margin-top:var(--space-1)">Wird nur für Geburtstagsgrüße in der App verwendet.</div>
|
||||
</div>
|
||||
<div>
|
||||
<label style="display:block;font-size:var(--text-sm);font-weight:600;margin-bottom:var(--space-1)">Profil-Sichtbarkeit</label>
|
||||
<select name="profil_sichtbarkeit" style="${inputStyle}">${sichtbarkeitOpts}</select>
|
||||
|
|
@ -1211,6 +1220,7 @@ window.Page_settings = (() => {
|
|||
social_link: fd.social_link || '',
|
||||
profil_sichtbarkeit: fd.profil_sichtbarkeit || 'public',
|
||||
billing_address: fd.billing_address || '',
|
||||
geburtstag: fd.geburtstag || '',
|
||||
});
|
||||
Object.assign(_appState.user, updated);
|
||||
UI.modal.close?.();
|
||||
|
|
|
|||
|
|
@ -1092,9 +1092,15 @@ window.Worlds = (() => {
|
|||
} else if (!dog) { _applyBgImage(null); }
|
||||
|
||||
const hour = new Date().getHours();
|
||||
const greet = hour < 5 ? 'Gute Nacht' : hour < 12 ? 'Guten Morgen' : hour < 18 ? 'Hallo' : 'Guten Abend';
|
||||
const firstName = user?.name?.split(' ')[0] || '';
|
||||
const dayStr = new Date().toLocaleDateString('de-DE', { weekday:'long', day:'numeric', month:'long' });
|
||||
|
||||
// User-Geburtstag heute?
|
||||
const _todayMmDd = (() => { const d = new Date(); return String(d.getMonth()+1).padStart(2,'0')+'-'+String(d.getDate()).padStart(2,'0'); })();
|
||||
const userBdayToday = user?.geburtstag && user.geburtstag === _todayMmDd;
|
||||
const greet = userBdayToday
|
||||
? `Herzlichen Glückwunsch`
|
||||
: (hour < 5 ? 'Gute Nacht' : hour < 12 ? 'Guten Morgen' : hour < 18 ? 'Hallo' : 'Guten Abend');
|
||||
const stale = isOffline && staleMin > 5
|
||||
? `<span style="font-size:9px;opacity:0.5;margin-left:6px">· Offline</span>` : '';
|
||||
|
||||
|
|
@ -1119,6 +1125,26 @@ window.Worlds = (() => {
|
|||
: (w.temp_c ?? 20) < 2 ? '🌨️'
|
||||
: '☀️';
|
||||
|
||||
// User-Geburtstag Reminder
|
||||
const userBdayHtml = userBdayToday ? `
|
||||
<div class="world-reminder" style="border-color:rgba(196,132,58,0.6);
|
||||
flex-direction:column;align-items:center;text-align:center;gap:6px;padding:12px 14px">
|
||||
<div style="display:flex;gap:8px;align-items:center;justify-content:center">
|
||||
<svg class="ph-icon bday-fw1" style="width:1.3rem;height:1.3rem;color:#f59e0b">
|
||||
<use href="/icons/phosphor.svg#confetti"></use></svg>
|
||||
<svg class="ph-icon bday-pop" style="width:1.8rem;height:1.8rem;color:#fff">
|
||||
<use href="/icons/phosphor.svg#cake"></use></svg>
|
||||
<svg class="ph-icon bday-fw2" style="width:1.3rem;height:1.3rem;color:#f59e0b">
|
||||
<use href="/icons/phosphor.svg#confetti"></use></svg>
|
||||
</div>
|
||||
<div style="font-weight:800;font-size:var(--text-sm);color:#fff">
|
||||
Alles Gute zum Geburtstag, ${_esc(firstName)}!
|
||||
</div>
|
||||
<div style="font-size:10px;color:rgba(255,255,255,0.55)">
|
||||
Wir wünschen dir und deinem Hund einen wunderschönen Tag 🐾
|
||||
</div>
|
||||
</div>` : '';
|
||||
|
||||
// Alert-Reminder
|
||||
const alertHtml = alertList.slice(0,1).map(a => `
|
||||
<div class="world-reminder" data-wnav="${a.page}" style="border-color:rgba(239,68,68,0.5)">
|
||||
|
|
@ -1165,6 +1191,7 @@ window.Worlds = (() => {
|
|||
${user ? userAvatarHtml : ''}
|
||||
</div>
|
||||
</div>
|
||||
${userBdayHtml}
|
||||
${alertHtml}
|
||||
${user && dog ? `
|
||||
<div class="wj-chip-row">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications + Tile-Cache
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v1027';
|
||||
const CACHE_VERSION = 'by-v1028';
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue