Fix: Übungen-Tab kaputt nach Exercise-Chip-Navigation — DB-Kat-Mapping + refresh()-Fix — SW by-v490, APP_VER 467

This commit is contained in:
rene 2026-04-29 11:13:22 +02:00
parent e22dcc3c3d
commit 69cbf3c599
3 changed files with 23 additions and 6 deletions

View file

@ -3,7 +3,7 @@
Router, State-Management, Navigation, Initialisierung. Router, State-Management, Navigation, Initialisierung.
============================================================ */ ============================================================ */
const APP_VER = '466'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VER = '467'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
const App = (() => { const App = (() => {

View file

@ -433,17 +433,31 @@ window.Page_uebungen = (() => {
// ---------------------------------------------------------- // ----------------------------------------------------------
// INIT // INIT
// ---------------------------------------------------------- // ----------------------------------------------------------
// DB-Kategorien → Tab-IDs
const _KAT_TO_TAB = {
'grundkommando': 'grundkommandos',
'grundkommandos': 'grundkommandos',
'trick': 'tricks',
'tricks': 'tricks',
'problemverhalten':'problemverhalten',
'grundlagen': 'grundlagen',
'ki-trainer': 'ki-trainer',
};
const _VALID_TABS = new Set(TABS.map(t => t.id));
async function init(container, appState, params = {}) { async function init(container, appState, params = {}) {
_container = container; _container = container;
_appState = appState; _appState = appState;
if (params.kategorie) _activeTab = params.kategorie; if (params.kategorie) {
const mapped = _KAT_TO_TAB[params.kategorie.toLowerCase()] || params.kategorie;
if (_VALID_TABS.has(mapped)) _activeTab = mapped;
}
_render(); _render();
if (params.name) { if (params.name) {
// Nach Render + Progress-Load zur Übung scrollen
setTimeout(() => { setTimeout(() => {
const card = _container.querySelector(`[data-exercise-name="${CSS.escape(params.name)}"]`); const card = _container.querySelector(`[data-exercise-name="${CSS.escape(params.name)}"]`);
if (card) card.scrollIntoView({ behavior: 'smooth', block: 'center' }); if (card) card.scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 600); }, 700);
} }
// Progress vom Server laden // Progress vom Server laden
@ -490,7 +504,10 @@ window.Page_uebungen = (() => {
_renderStatsBanner(); _renderStatsBanner();
} }
function refresh() {} function refresh() {
if (!_VALID_TABS.has(_activeTab)) _activeTab = 'grundkommandos';
_renderContent();
}
function onDogChange() { function onDogChange() {
_statsData = null; _statsData = null;
_badgesData = null; _badgesData = null;

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications + Tile-Cache Offline-Cache + Push Notifications + Tile-Cache
============================================================ */ ============================================================ */
const CACHE_VERSION = 'by-v489'; const CACHE_VERSION = 'by-v490';
const CACHE_STATIC = `${CACHE_VERSION}-static`; const CACHE_STATIC = `${CACHE_VERSION}-static`;
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten