katja's git: oeffisearch

fast and simple tripplanner

commit 18be57cd691dda9574f5a4b6997c69d991470587
parent 4be9355a0004b8875db19a30dc6bdf79b08b7762
Author: Katja (ctucx) <git@ctu.cx>
Date: Thu, 17 Apr 2025 14:11:58 +0200

journeysView: better offline support
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/journeysCanvas.js b/src/journeysCanvas.js
@@ -226,7 +226,7 @@ export class JourneysCanvas extends BaseView {
 	};
 
 	getCoachSequences = async () => {
-		if (this.viewState.profile !== 'db') return;
+		if (this.isOffline !== false) return;
 
 		this.isUpdating = true;
 		for (const journey of this.viewState.journeys) {
diff --git a/src/journeysView.js b/src/journeysView.js
@@ -108,7 +108,7 @@ export class JourneysView extends JourneysCanvas {
 							</a>
 						</div>
 					</div>
-					<a class="icon-reload ${this.isUpdating ? 'spinning' : ''}" title="${t("reload")}" @click=${this.refreshJourneys}></a>
+					<a class="icon-reload ${this.isUpdating ? 'spinning' : ''} ${!this.isOffline ? '' : 'invisible'}" title="${t("reload")}" @click=${this.refreshJourneys}></a>
 				</header>
 			</div>
 

@@ -224,6 +224,7 @@ export class JourneysView extends JourneysCanvas {
 	}
 
 	async refreshJourneys () {
+		if (this.isOffline !== false) return;
 		if (this.isUpdating !== false) return false;
 
 		try {

@@ -240,6 +241,11 @@ export class JourneysView extends JourneysCanvas {
 	}
 
 	async moreJourneys (mode) {
+		if (this.isOffline !== false) {
+			this.showAlertOverlay(t('offline'));
+			return;
+		}
+
 		this.showLoaderOverlay();
 		try {
 			this.isUpdating = true;