diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue
index 73c7bb3..7d711be 100644
--- a/src/components/TrainsView/TrainInfo.vue
+++ b/src/components/TrainsView/TrainInfo.vue
@@ -22,7 +22,7 @@
|
{{ train.timetableData.routeDistance }} km
|
- {{ confirmedPercentage(train.timetableData.followingStops) }}% trasy
+ {{ $t('trains.route-progress') }} {{ confirmedPercentage(train.timetableData.followingStops) }}%
|
@@ -47,14 +47,6 @@
>:
{{ `${~~(train[stat.name] * (stat.multiplier || 1))}${stat.unit}` }}
-
-
@@ -89,7 +81,7 @@
{{ train.timetableData.category }}
{{ train.trainNo }} |
- {{ train.timetableData.routeDistance }} km
+ {{ train.timetableData.routeDistance }} km
@@ -248,9 +240,9 @@ export default defineComponent({
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';
+ if (delay > 0) return `${this.$t('trains.delayed')} ${delay} min`;
+ else if (delay < 0) return `${this.$t('trains.preponed')} ${delay} min`;
+ else return this.$t('trains.on-time');
},
displayLocoInfo(locoType: string) {
diff --git a/src/components/TrainsView/TrainOptions.vue b/src/components/TrainsView/TrainOptions.vue
index a7d7de5..80fe960 100644
--- a/src/components/TrainsView/TrainOptions.vue
+++ b/src/components/TrainsView/TrainOptions.vue
@@ -49,6 +49,10 @@ export default defineComponent({
id: 'progress',
value: 'przebyta trasa',
},
+ {
+ id: 'delay',
+ value: 'opóźnienie',
+ },
{
id: 'mass',
value: 'masa',
@@ -61,10 +65,6 @@ export default defineComponent({
id: 'length',
value: 'długość',
},
- {
- id: 'timetable',
- value: 'numer pociągu',
- },
];
const translatedSorterOptions = computed(() =>
diff --git a/src/locales/en.json b/src/locales/en.json
index e3a7b85..e20289d 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -113,6 +113,7 @@
"trains": {
"no-trains": "No trains to show here!",
"loading": "Loading train data...",
+
"stats": "TRAFFIC STATISTICS",
"stats-speed": "TRAINS SPEED (MIN, AVG, MAX) [km/h]",
"stats-length": "TIMETABLES LENGTH (MIN, AVG, MAX) [km]",
@@ -120,15 +121,25 @@
"stats-special-twr": "HIGH RISK",
"stats-special-skr": "EXCEEDED STRUCT. GAUGE",
"stats-locos": "MOST COMMON UNITS",
+
"option-mass": "mass",
"option-speed": "speed",
"option-length": "length",
"option-distance": "distance",
"option-timetable": "train no.",
"option-progress": "route progress",
+ "option-delay": "current delay",
+
"sorter-prefix": "Sort: ",
"search-train": "Train no.",
"search-driver": "Driver name",
+
+ "delayed": "Delayed: ",
+ "preponed": "Ahead of schedule: ",
+ "on-time": "On time",
+
+ "route-progress": "Progress: ",
+
"detailed-timetable": "Detailed timetable for train no. ",
"via-title": "Via: ",
"no-timetable": "no current timetable",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 12a7858..e75172c 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -113,6 +113,7 @@
"trains": {
"no-trains": "Brak pociągów do wyświetlenia!",
"loading": "Pobieranie danych o pociągach...",
+
"stats": "STATYSTYKI RUCHU",
"stats-speed": "PRĘDKOŚCI POCIĄGÓW (MIN, ŚR, MAX) [km/h]",
"stats-length": "DŁUGOŚCI ROZKŁADÓW (MIN, ŚR, MAX) [km]",
@@ -120,15 +121,25 @@
"stats-special-twr": "WYSOKIEGO RYZYKA",
"stats-special-skr": "PRZEKROCZONA SKRAJNIA",
"stats-locos": "NAJCZĘSTSZE JEDNOSTKI",
+
"option-mass": "masa",
"option-speed": "prędkość",
"option-length": "długość",
"option-distance": "kilometraż",
"option-timetable": "nr pociągu",
"option-progress": "przebyta trasa",
+ "option-delay": "opóźnienie",
+
"sorter-prefix": "Sortuj: ",
"search-train": "Numer pociągu",
"search-driver": "Nick maszynisty",
+
+ "delayed": "Opóźniony: ",
+ "preponed": "Przed czasem: ",
+ "on-time": "Planowo",
+
+ "route-progress": "Postęp: ",
+
"detailed-timetable": "Szczegółowy rozkład jazdy pociągu ",
"via-title": "Przez: ",
"no-timetable": "brak rozkładu jazdy",
diff --git a/src/views/TrainsView.vue b/src/views/TrainsView.vue
index aa3dd1c..9764265 100644
--- a/src/views/TrainsView.vue
+++ b/src/views/TrainsView.vue
@@ -32,6 +32,16 @@ const confirmedPercentage = (stops: TrainStop[] | undefined) => {
return Number(((stops.filter((stop) => stop.confirmed).length / stops.length) * 100).toFixed(0));
};
+const currentDelay = (stops: TrainStop[] | undefined) => {
+ if (!stops) return -Infinity;
+
+ const delay =
+ stops.find((stop, i) => (i == 0 && !stop.confirmed) || (i > 0 && stops[i - 1].confirmed && !stop.confirmed))
+ ?.departureDelay || 0;
+
+ return delay;
+};
+
const filteredTrainList = (
trainList: Train[],
searchedTrain: string,
@@ -63,6 +73,12 @@ const filteredTrainList = (
return -sorterActive.dir;
+ case 'delay':
+ if (currentDelay(a.timetableData?.followingStops) > currentDelay(b.timetableData?.followingStops))
+ return sorterActive.dir;
+
+ return -sorterActive.dir;
+
case 'speed':
if (a.speed > b.speed) return sorterActive.dir;
return -sorterActive.dir;