Compare commits
6 commits
7b3041fc94
...
7a10db2da4
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a10db2da4 | |||
| b5b1510565 | |||
| fb9620fbcb | |||
| 2d43618dc8 | |||
| 0685f3b8ef | |||
| 9b0c286aa3 |
10 changed files with 114 additions and 24 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
1133
|
||||
1134
|
||||
|
|
@ -232,15 +232,42 @@ async def get_welcome_dashboard(dog_id: int, user=Depends(get_current_user)):
|
|||
ORDER BY d.datum DESC, d.id DESC, dm.id ASC""",
|
||||
(dog_id,)
|
||||
).fetchall()
|
||||
# Cross-Plattform-stabiles Tagesfoto: einmal pro Tag pro Hund festgelegt
|
||||
# und in daily_photo_cache persistiert. Sobald ein Client (PWA oder
|
||||
# iOS) zum ersten Mal heute zugreift, wird die Wahl gespeichert; alle
|
||||
# weiteren Clients liefern dasselbe Bild.
|
||||
import datetime as _dt2
|
||||
conn.execute("""
|
||||
CREATE TABLE IF NOT EXISTS daily_photo_cache (
|
||||
dog_id INTEGER NOT NULL,
|
||||
datum TEXT NOT NULL,
|
||||
photo_url TEXT NOT NULL,
|
||||
PRIMARY KEY (dog_id, datum)
|
||||
)
|
||||
""")
|
||||
today_iso = _dt2.date.today().isoformat()
|
||||
cached = conn.execute(
|
||||
"SELECT photo_url FROM daily_photo_cache WHERE dog_id=? AND datum=?",
|
||||
(dog_id, today_iso)
|
||||
).fetchone()
|
||||
|
||||
random_photo = None
|
||||
if photos:
|
||||
import datetime as _dt2
|
||||
if cached and cached["photo_url"]:
|
||||
random_photo = {
|
||||
"url": cached["photo_url"],
|
||||
"preview_url": preview_url_from(cached["photo_url"]),
|
||||
}
|
||||
elif photos:
|
||||
tick = (_dt2.date.today() - _dt2.date(2024, 1, 1)).days
|
||||
chosen_url = photos[tick % len(photos)]["url"]
|
||||
random_photo = {
|
||||
"url": chosen_url,
|
||||
"preview_url": preview_url_from(chosen_url),
|
||||
}
|
||||
conn.execute(
|
||||
"INSERT OR IGNORE INTO daily_photo_cache (dog_id, datum, photo_url) VALUES (?, ?, ?)",
|
||||
(dog_id, today_iso, chosen_url)
|
||||
)
|
||||
|
||||
# Neuester Tagebucheintrag
|
||||
last_diary_row = conn.execute(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,15 @@ from auth import get_current_user
|
|||
router = APIRouter()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
KATEGORIEN = {"tierarzt", "futter", "zubehoer", "versicherung", "sitter", "sonstiges"}
|
||||
KATEGORIE_META = {
|
||||
"futter": {"label": "Futter", "color": "#f59e0b"},
|
||||
"tierarzt": {"label": "Tierarzt", "color": "#ef4444"},
|
||||
"zubehoer": {"label": "Zubehör", "color": "#8b5cf6"},
|
||||
"versicherung": {"label": "Versicherung", "color": "#3b82f6"},
|
||||
"sitter": {"label": "Sitter", "color": "#10b981"},
|
||||
"sonstiges": {"label": "Sonstiges", "color": "#6b7280"},
|
||||
}
|
||||
KATEGORIEN = set(KATEGORIE_META.keys())
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
|
@ -75,6 +83,18 @@ def _serialize(row) -> dict:
|
|||
return dict(row)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# GET /api/expenses/categories — gültige Kategorien (id + label + color)
|
||||
# Single source of truth für PWA und mobile Clients.
|
||||
# ------------------------------------------------------------------
|
||||
@router.get("/categories")
|
||||
async def list_categories():
|
||||
return [
|
||||
{"id": key, **meta}
|
||||
for key, meta in KATEGORIE_META.items()
|
||||
]
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# GET /api/expenses/summary — Monats- und Jahressummen
|
||||
# WICHTIG: Diese Route muss VOR /{id} stehen!
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@
|
|||
<title>Ban Yaro</title>
|
||||
|
||||
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
||||
<script src="/js/boot-early.js?v=1133"></script>
|
||||
<script src="/js/boot-early.js?v=1134"></script>
|
||||
|
||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1133">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1133">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1133">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1133">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1133">
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1134">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1134">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1134">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1134">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1134">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
@ -617,11 +617,11 @@
|
|||
<div id="modal-container"></div>
|
||||
|
||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||
<script src="/js/api.js?v=1133"></script>
|
||||
<script src="/js/ui.js?v=1133"></script>
|
||||
<script src="/js/app.js?v=1133"></script>
|
||||
<script src="/js/worlds.js?v=1133"></script>
|
||||
<script src="/js/offline-indicator.js?v=1133"></script>
|
||||
<script src="/js/api.js?v=1134"></script>
|
||||
<script src="/js/ui.js?v=1134"></script>
|
||||
<script src="/js/app.js?v=1134"></script>
|
||||
<script src="/js/worlds.js?v=1134"></script>
|
||||
<script src="/js/offline-indicator.js?v=1134"></script>
|
||||
|
||||
<!-- Feature-Seiten werden lazy geladen -->
|
||||
|
||||
|
|
@ -631,7 +631,7 @@
|
|||
|
||||
|
||||
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
||||
<script src="/js/boot.js?v=1133"></script>
|
||||
<script src="/js/boot.js?v=1134"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1133'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1134'; // ← 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;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,28 @@ window.Page_onboarding = (() => {
|
|||
async function init(container, appState) {
|
||||
_container = container;
|
||||
_appState = appState;
|
||||
|
||||
// Hunde frisch laden — der appState kann veraltet sein (z.B. nach
|
||||
// Anlage in mobiler App). Wenn schon ein Hund da ist, Wizard
|
||||
// komplett überspringen.
|
||||
try {
|
||||
const dogs = await API.dogs.list();
|
||||
_appState.dogs = dogs;
|
||||
if (dogs.length > 0) {
|
||||
_appState.activeDog = dogs[0];
|
||||
localStorage.setItem('by_active_dog', String(dogs[0].id));
|
||||
localStorage.setItem('by_onboarding_done', '1');
|
||||
App.renderDogSwitcher?.();
|
||||
if (window.Worlds) window.Worlds.init(_appState);
|
||||
else App.navigate('diary');
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
// Lieber Wizard zeigen als komplett blockieren — wenn API down ist,
|
||||
// landet der User halt im Standard-Flow.
|
||||
console.warn('Onboarding: dog-list refresh failed', e);
|
||||
}
|
||||
|
||||
_step = 1;
|
||||
_render();
|
||||
}
|
||||
|
|
@ -315,10 +337,12 @@ window.Page_onboarding = (() => {
|
|||
// EVENTS
|
||||
// ----------------------------------------------------------
|
||||
function _bindEvents() {
|
||||
// Weiter-Button (Schritt 1)
|
||||
// Weiter-Button (Schritt 1) — direkt ins richtige Hunde-Profil,
|
||||
// statt eines doppelten Mini-Formulars im Wizard. Onboarding gilt
|
||||
// damit als erledigt, sobald der User dort angekommen ist.
|
||||
_container.querySelector('#ob-next-btn')?.addEventListener('click', () => {
|
||||
_step = 2;
|
||||
_render();
|
||||
localStorage.setItem('by_onboarding_done', '1');
|
||||
App.navigate('dog-profile');
|
||||
});
|
||||
|
||||
// Zurück-Button (Schritt 2)
|
||||
|
|
@ -422,6 +446,24 @@ window.Page_onboarding = (() => {
|
|||
_render();
|
||||
|
||||
} catch (err) {
|
||||
// 403 „schon einen Hund" → kein Stuck-State, weiter zu Schritt 3
|
||||
const isAlreadyHas = err?.status === 403
|
||||
|| /Pro-Feature|schon|already|maximal/i.test(err?.message || '');
|
||||
if (isAlreadyHas) {
|
||||
try {
|
||||
const dogs = await API.dogs.list();
|
||||
_appState.dogs = dogs;
|
||||
if (dogs.length > 0) {
|
||||
_appState.activeDog = dogs[0];
|
||||
localStorage.setItem('by_active_dog', String(dogs[0].id));
|
||||
App.renderDogSwitcher?.();
|
||||
}
|
||||
} catch {}
|
||||
UI.toast.info?.('Du hast bereits einen Hund — geht direkt weiter.');
|
||||
_step = 3;
|
||||
_render();
|
||||
return;
|
||||
}
|
||||
UI.toast.error(err.message || 'Hund konnte nicht angelegt werden.');
|
||||
} finally {
|
||||
if (saveBtn) {
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,7 @@ window.Worlds = (() => {
|
|||
<div class="world-info-sub" style="margin-bottom:16px">
|
||||
Lege ein Profil an und schalte alle Features frei
|
||||
</div>
|
||||
<button class="btn btn-primary" style="width:100%" onclick="Worlds.navigateTo('dog-profile')">
|
||||
<button class="btn btn-primary" id="welcome-add-dog-btn" style="width:100%">
|
||||
Hund anlegen
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -1444,6 +1444,7 @@ window.Worlds = (() => {
|
|||
</div>
|
||||
</div>`;
|
||||
el.querySelectorAll('[data-wnav]').forEach(e => e.addEventListener('click', () => navigateTo(e.dataset.wnav)));
|
||||
el.querySelector('#welcome-add-dog-btn')?.addEventListener('click', () => navigateTo('dog-profile'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<script src="/js/landing-init.js?v=1133"></script>
|
||||
<script src="/js/landing-init.js?v=1134"></script>
|
||||
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
||||
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
|
||||
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "/",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"name": "Ban Yaro — Die Hunde-Plattform",
|
||||
"short_name": "Ban Yaro",
|
||||
"description": "Alles rund um deinen Hund. Von Welpe bis Opa.",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
============================================================ */
|
||||
|
||||
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
||||
const VER = '1133';
|
||||
const VER = '1134';
|
||||
const CACHE_VERSION = `by-v${VER}`;
|
||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue