diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 278111d..73c7bb3 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -23,6 +23,8 @@ {{ train.timetableData.routeDistance }} km | {{ confirmedPercentage(train.timetableData.followingStops) }}% trasy + | + @@ -241,6 +243,16 @@ export default defineComponent({ return ((stops.filter((stop) => stop.confirmed).length / stops.length) * 100).toFixed(0); }, + currentDelay(stops: TrainStop[]) { + const delay = + stops.find((stop, i) => (i == 0 && !stop.confirmed) || (i > 0 && stops[i - 1].confirmed && !stop.confirmed)) + ?.departureDelay || 0; + + if (delay > 0) return `Opóźniony: ${delay} min`; + else if (delay < 0) return `Przed czasem: ${delay} min`; + else return 'Planowo'; + }, + displayLocoInfo(locoType: string) { if (locoType.includes('EN')) return `${this.$t('trains.EZT')}`; if (locoType.includes('SN')) return `${this.$t('trains.SZT')}`;