mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Dodano informację o opóźnieniach w skróconym widoku listy pociągów
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
<span style="color: gold"> {{ train.timetableData.routeDistance }} km </span>
|
||||
|
|
||||
<span> {{ confirmedPercentage(train.timetableData.followingStops) }}% trasy </span>
|
||||
|
|
||||
<span v-html="currentDelay(train.timetableData.followingStops)"></span>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -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 `<span style='color: salmon'>Opóźniony: ${delay} min</span>`;
|
||||
else if (delay < 0) return `<span style='color: lightgreen'>Przed czasem: ${delay} min</span>`;
|
||||
else return 'Planowo';
|
||||
},
|
||||
|
||||
displayLocoInfo(locoType: string) {
|
||||
if (locoType.includes('EN')) return `${this.$t('trains.EZT')}`;
|
||||
if (locoType.includes('SN')) return `${this.$t('trains.SZT')}`;
|
||||
|
||||
Reference in New Issue
Block a user