diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 46d9a913..91f56cff 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -9,6 +9,7 @@ "no_results": "No results.", "train": "Train", "train_details": "Train details", + "from": "From", "destination": "Destination", "departure": "Departure", "departures": "Departures", diff --git a/public/locales/fi/translation.json b/public/locales/fi/translation.json index 78cecee9..aece93ff 100644 --- a/public/locales/fi/translation.json +++ b/public/locales/fi/translation.json @@ -9,6 +9,7 @@ "no_results": "Ei tuloksia.", "train": "Juna", "train_details": "Junan tiedot", + "from": "Lähtöasema", "destination": "Määränpää", "departure": "Lähtee", "departures": "Lähtevät", diff --git a/src/components/StationTimeTable.tsx b/src/components/StationTimeTable.tsx index d8eb55c1..2ed7c49c 100644 --- a/src/components/StationTimeTable.tsx +++ b/src/components/StationTimeTable.tsx @@ -55,7 +55,11 @@ function StationTimeTable({ {t('train')} - {t('destination')} + + {timeTableType === TimeTableRowType.Departure + ? t('destination') + : t('from')} + {timeTableType === TimeTableRowType.Departure ? t('departure') diff --git a/src/components/StationTimeTableRow.tsx b/src/components/StationTimeTableRow.tsx index 3d82a356..ca5c28f7 100644 --- a/src/components/StationTimeTableRow.tsx +++ b/src/components/StationTimeTableRow.tsx @@ -16,7 +16,11 @@ import { TrainByStationFragment, } from '../graphql/generated/digitraffic'; import getTimeTableRowForStation from '../utils/getTimeTableRowForStation'; -import { getTrainDestinationStationName } from '../utils/train'; +import { + getTrainDepartureStation, + getTrainDestinationStation, + getTrainStationName, +} from '../utils/train'; import TimeTableRowTime from './TimeTableRowTime'; import VehicleTrackingIcon from './VehicleTrackingIcon'; @@ -41,7 +45,14 @@ function StationTimeTableRow({ const trainName = train.commuterLineid ? train.commuterLineid : train.trainType.name + train.trainNumber; - const destinationStationName = getTrainDestinationStationName(train); + const deptOrDestStation = + timeTableType === TimeTableRowType.Departure + ? getTrainDestinationStation(train) + : getTrainDepartureStation(train); + const deptOrDestStationName = deptOrDestStation + ? getTrainStationName(deptOrDestStation) + : null; + const stationRow = getTimeTableRowForStation( stationCode, train, @@ -94,12 +105,12 @@ function StationTimeTableRow({ - {destinationStationName} + {deptOrDestStationName}