Feature: Trauer-Feature, Futter-Verträglichkeit, Multi-Hund-Fixes, Wetter-Ort (Sprint 47)
- dog-profile.js: Verstorben-Button, Gedenkseite, KI-Abschiedstext - database.py: futter_eintraege/reaktionen, route_dogs, exercise_progress.dog_id - routes/ernaehrung.py: Futter-Verträglichkeit mit 20 Reaktionstypen + Analyse - routes/routen.py: route_dogs Many-to-Many, Routen editierbar - routes/training.py: exercise_progress per dog_id - routes/ki.py: /ki/abschied Trauer-KI - weather.py: Nominatim Ortsname parallel geladen - ui.js: dogChip/bindDogChip, visualViewport-Modal - api.js: gedenken, gedenkseite, futter-Methoden, route_dogs - worlds.js: Ortsname im Wetter-Chip - uebungen.js: _progressLoaded-Flag, dog-spezifischer Fortschritt - trainingsplaene.js: dog_id Unterstützung - diary.js/health.js: P-Badge Cleanup - map.js: Wetter-Ort-Anzeige entfernt - wetter.js: Ort in Wetter-Detail
This commit is contained in:
parent
1ce802c8dc
commit
bda61a0e40
16 changed files with 713 additions and 181 deletions
|
|
@ -995,6 +995,30 @@ const UI = (() => {
|
|||
_load();
|
||||
}
|
||||
|
||||
function dogChip(appState) {
|
||||
const dog = appState?.activeDog;
|
||||
const dogs = appState?.dogs || [];
|
||||
if (!dog) return '';
|
||||
const av = dog.foto_url
|
||||
? `<img src="${escape(dog.foto_url)}" style="width:22px;height:22px;border-radius:50%;object-fit:cover;flex-shrink:0">`
|
||||
: `<svg class="ph-icon" style="width:16px;height:16px;color:var(--c-primary);flex-shrink:0"><use href="/icons/phosphor.svg#dog"></use></svg>`;
|
||||
const sw = dogs.length > 1
|
||||
? `<svg class="ph-icon" style="width:13px;height:13px;color:var(--c-text-muted);margin-left:2px"><use href="/icons/phosphor.svg#arrows-left-right"></use></svg>` : '';
|
||||
return `<div class="by-dog-chip" data-dog-chip style="display:inline-flex;align-items:center;gap:6px;
|
||||
padding:4px 10px 4px 6px;background:var(--c-surface-2);border:1px solid var(--c-border);
|
||||
border-radius:100px;font-size:var(--text-xs);font-weight:600;color:var(--c-text);
|
||||
${dogs.length > 1 ? 'cursor:pointer' : ''};max-width:fit-content">${av}<span>${escape(dog.name)}</span>${sw}</div>`;
|
||||
}
|
||||
|
||||
function bindDogChip(container, appState) {
|
||||
if ((appState?.dogs?.length || 0) < 2) return;
|
||||
container.querySelector('[data-dog-chip]')?.addEventListener('click', () => {
|
||||
const dogs = appState.dogs;
|
||||
const next = dogs.find(d => d.id !== appState.activeDog?.id) || dogs[0];
|
||||
if (next) App.setActiveDog(next.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Öffentliche API
|
||||
return {
|
||||
toast, modal,
|
||||
|
|
@ -1009,6 +1033,10 @@ const UI = (() => {
|
|||
leafletMarker,
|
||||
locationPicker,
|
||||
ratingStars,
|
||||
dogChip,
|
||||
bindDogChip,
|
||||
dogChip,
|
||||
bindDogChip,
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue