From 8909a0cd40ee4e36777d1df98117b519b6343b97 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 4 Jul 2025 18:22:41 +0200 Subject: [PATCH] fix: added timetable status for beginning offline --- .../SceneryView/ScheduledTrainStatus.vue | 27 +++++++------------ src/locales/en.json | 1 + src/locales/pl.json | 1 + 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/components/SceneryView/ScheduledTrainStatus.vue b/src/components/SceneryView/ScheduledTrainStatus.vue index 4610e6c..5faa761 100644 --- a/src/components/SceneryView/ScheduledTrainStatus.vue +++ b/src/components/SceneryView/ScheduledTrainStatus.vue @@ -26,23 +26,18 @@ export default defineComponent({ computedScheduledTrain() { const { status, prevElement, currentElement, nextElement } = this.sceneryTimetableRow; - const prevDepartureIndicator = prevElement?.departureRouteExt - ? `(${prevElement.departureRouteExt}) ${prevElement.stationName}` - : '---'; - - const nextArrivalIndicator = nextElement?.arrivalRouteExt - ? `(${nextElement.arrivalRouteExt}) ${nextElement.stationName}` - : `${currentElement.stationName}`; - - let stopStatusDescription = '', - stopStatusIndicator = ''; + let stopStatusIndicator = ''; switch (status) { case StopStatus.ARRIVING: - stopStatusIndicator = this.$t('timetables.desc-arriving', { - prevStationName: prevElement?.stationName ?? '', - prevDepartureLine: prevElement?.departureRouteExt ?? '' - }); + if (prevElement) { + stopStatusIndicator = this.$t('timetables.desc-arriving', { + prevStationName: prevElement?.stationName ?? '', + prevDepartureLine: prevElement?.departureRouteExt ?? '' + }); + } else { + stopStatusIndicator = this.$t('timetables.desc-beginning'); + } break; case StopStatus.ONLINE: @@ -56,8 +51,6 @@ export default defineComponent({ break; case StopStatus.DEPARTED: - // stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`; - if (!nextElement?.stationName) { stopStatusIndicator = this.$t('timetables.desc-departed-ends', { nextStationName: currentElement.stationName @@ -72,7 +65,6 @@ export default defineComponent({ break; case StopStatus.DEPARTED_AWAY: - // stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`; stopStatusIndicator = this.$t('timetables.desc-departed-away', { nextStationName: nextElement?.stationName, nextArrivalLine: nextElement?.arrivalRouteExt @@ -80,7 +72,6 @@ export default defineComponent({ break; case StopStatus.TERMINATED: - // stopStatusIndicator = `X ${this.$t('timetables.desc-terminated')}`; stopStatusIndicator = this.$t('timetables.desc-terminated'); break; diff --git a/src/locales/en.json b/src/locales/en.json index 0c8f1d2..dd9e8f9 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -591,6 +591,7 @@ "terminates": "TERMINATES\nHERE", "from": "Arrives from", "to": "Departs to", + "desc-beginning": "The train begins here", "desc-arriving": "Arrives from: {prevStationName} ({prevDepartureLine})", "desc-online": "On scenery / direction: {nextStationName} ({nextArrivalLine})", "desc-stopped": "On scenery - stopped / direction: {nextStationName} ({nextArrivalLine})", diff --git a/src/locales/pl.json b/src/locales/pl.json index 350a6bf..b0ba93a 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -577,6 +577,7 @@ "terminates": "KOŃCZY BIEG", "from": "Przyjedzie z", "to": "Odjeżdża do", + "desc-beginning": "Pociąg rozpoczyna bieg", "desc-arriving": "Przyjedzie z: {prevStationName} ({prevDepartureLine})", "desc-online": "Na scenerii / kierunek: {nextStationName} ({nextArrivalLine})", "desc-stopped": "Na scenerii - postój / kierunek: {nextStationName} ({nextArrivalLine})",