Dodano brakujące tłumaczenia

This commit is contained in:
2022-01-27 15:55:47 +01:00
parent 90973067f4
commit f064a587bd
5 changed files with 47 additions and 17 deletions
+16
View File
@@ -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;