Fix: Offline-UX — 📡 statt 🚧 bei offline-Seiten, schnellerer Warm-up, mehr Endpoints gecacht (SW by-v989)
This commit is contained in:
parent
8ad3ca8a74
commit
f0c1ee3386
4 changed files with 26 additions and 16 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '988'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '989'; // ← 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
|
||||
|
|
@ -266,10 +266,13 @@ const App = (() => {
|
|||
page.module = {}; // verhindert erneutes Laden
|
||||
}
|
||||
} catch {
|
||||
const _offline = !navigator.onLine;
|
||||
container.innerHTML = UI.emptyState({
|
||||
icon: '🚧',
|
||||
icon: _offline ? '📡' : '🚧',
|
||||
title: pages[pageId].title,
|
||||
text: 'Diese Seite ist noch in Entwicklung.',
|
||||
text: _offline
|
||||
? 'Diese Seite ist offline nicht verfügbar. Bitte öffne sie einmal mit Internetverbindung, damit sie gecacht wird.'
|
||||
: 'Diese Seite ist noch in Entwicklung.',
|
||||
});
|
||||
page.module = {};
|
||||
} finally {
|
||||
|
|
@ -1141,17 +1144,19 @@ const App = (() => {
|
|||
window.App = App; // Worlds kann App.navigate() aufrufen
|
||||
|
||||
// App starten
|
||||
// Prioritäts-Seiten im Hintergrund vorladen (3s nach Start, damit Hauptinhalt nicht blockiert)
|
||||
// Prioritäts-Seiten im Hintergrund vorladen (1s nach Start)
|
||||
window.addEventListener('load', () => {
|
||||
setTimeout(() => {
|
||||
if (!('caches' in window)) return;
|
||||
['admin','erste-hilfe','diary','map','walks','routes','poison','lost'].forEach(page => {
|
||||
if (!navigator.onLine) return;
|
||||
// Page-Scripts cachen
|
||||
[
|
||||
'admin','erste-hilfe','diary','map','walks','routes','poison','lost',
|
||||
'expenses','wetter','forum','health','uebungen','trainingsplaene','notes',
|
||||
].forEach(page => {
|
||||
const key = `Page_${page.replace(/-/g,'_')}`;
|
||||
if (!window[key]) {
|
||||
fetch(`/js/pages/${page}.js?v=${APP_VER}`).catch(() => {});
|
||||
}
|
||||
if (!window[key]) fetch(`/js/pages/${page}.js?v=${APP_VER}`).catch(() => {});
|
||||
});
|
||||
}, 3000);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue