commit 1475ec684e3465fc9f5f81b78c5f5f1cdc87055b
parent f8cec391709adfd94f66342412318a047b75ebd1
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Sat, 8 Nov 2025 18:56:32 +0100
parent f8cec391709adfd94f66342412318a047b75ebd1
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Sat, 8 Nov 2025 18:56:32 +0100
journeyView: add option to export as ics Co-authored-by: networkException <git@nwex.de>
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/journeyView.js b/src/journeyView.js @@ -331,10 +331,9 @@ class JourneyView extends BaseView { moreModal = async () => { const options = [ { 'label': !navigator.canShare ? 'copyURL' : 'shareURL', 'action': async () => await this.shareAction() }, + { 'label': 'addCalendar', 'action': async () => await this.calendarAction() }, ]; - if (isDevServer) options.push({ 'label': 'addCalendar', 'action': async () => await this.calendarAction() }); - if (this.profile === 'db') options.push({ 'label': 'tickets', 'action': async () => await this.ticketsAction() }); this.showSelectOverlay(options); @@ -401,18 +400,23 @@ class JourneyView extends BaseView { this.viewState.legs.forEach(leg => { if (!leg.line) return; - const departureStop = leg.origin.location + const departure = leg.origin + const arrival = leg.destination events.push({ productId: APP_NAME, created: (new Date).getTime(), start: leg.plannedDeparture.getTime(), end: leg.plannedArrival.getTime(), - title: `${leg.line.name} → ${formatPoint(leg.destination)}`, + title: `${leg.line.name} -> ${formatPoint(leg.destination)}`, url: window.location.href, - geo: { lat: departureStop.latitude , lon: departureStop.longitude }, - description: `${leg.line.name} → ${leg.direction}\n - dep ${timeTemplate(departureStop, 'departure')} ${formatPoint(departureStop)}`, + location: leg.origin.name, + geo: { lat: departure.location.latitude , lon: departure.location.longitude }, + description: [ + `${leg.line.name} -> ${leg.direction}`, + leg.stopovers.map(stopover => `${stopover.arrival ? stopover.arrival.formatTime() : '~~:~~'} - ${stopover.departure ? stopover.departure.formatTime() : '~~:~~'}: ${stopover.stop.name} ${stopover.departurePlatform ? `(${stopover.departurePlatform})` : '' }`), + `\n ${window.location.href}` + ].flat().join('\n'), }); });
diff --git a/src/languages.js b/src/languages.js @@ -86,6 +86,7 @@ export const languages = { 'minTransferTime': 'Transfer time (Minutes)', 'trainType': 'Train type', 'close': 'Close', + 'addCalendar': 'Export as ICS' }, 'de': { @@ -176,6 +177,7 @@ export const languages = { 'price': 'Preis', 'refresh': 'Aktualisieren', 'back': 'Zurück', + 'addCalendar': 'Als ICS exportieren' }, 'nl': {