diff --git a/src/components/SceneryView/ScheduledTrainStatus.vue b/src/components/SceneryView/ScheduledTrainStatus.vue index d35a9be..73a8ba3 100644 --- a/src/components/SceneryView/ScheduledTrainStatus.vue +++ b/src/components/SceneryView/ScheduledTrainStatus.vue @@ -1,47 +1,19 @@ @@ -86,3 +110,4 @@ export default defineComponent({ } } + diff --git a/src/locales/en.json b/src/locales/en.json index 3392333..309ca40 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -215,7 +215,7 @@ "no-stations": "No stations to show here!", "scenery-search": "Search for scenery..." }, - "trains": { + "trains": { "no-trains": "No trains to show here!", "loading": "Loading train data...", "offline": "Offline ride", @@ -369,7 +369,18 @@ "end": "Timetable terminates here", "terminated": "Timetable terminated", "begins": "BEGINS HERE", - "terminates": "TERMINATES\nHERE" + "terminates": "TERMINATES\nHERE", + + "from": "FROM", + "to": "TO", + + "desc-arriving": "The train is not here yet. It's going to come from: {prevStationName} (szlak {prevDepartureLine})", + "desc-online": "The train is at the station. It's going to leave to: {nextStationName} (szlak {nextArrivalLine})", + "desc-stopped": "The train is at the station and is stopped. It's going to leave towards: {nextStationName} (szlak {nextArrivalLine})", + "desc-next-arrival": "Leaves towards: {nextStationName} (szlak {nextArrivalLine})", + "desc-departed": "The train is at the station and it's been departed. Leaves towards: {nextStationName} (szlak {nextArrivalLine})", + "desc-departed-away": "The train has been departed to: {nextStationName} (szlak {nextArrivalLine})", + "desc-end": "The train terminates here" }, "history": { "title": "TIMETABLE JOURNAL", diff --git a/src/locales/pl.json b/src/locales/pl.json index d7d78c0..c146192 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -136,7 +136,7 @@ }, "filters": { "desc": " • Kliknięcie: zaznaczenie / odznaczenie filtru
• Podwójne kliknięcie: odznaczenie reszty filtrów z grupy
RESET: zresetowanie filtrów z grupy", - + "sections": { "reality": "FIKCYJNOŚĆ SCENERII", "package-access": "DOSTĘPNOŚĆ W PACZCE", @@ -375,7 +375,18 @@ "end": "Koniec rozkładu jazdy", "terminated": "Rozkład jazdy zakończony", "begins": "ROZPOCZYNA\nBIEG", - "terminates": "KOŃCZY BIEG" + "terminates": "KOŃCZY BIEG", + + "from": "Z", + "to": "DO", + + "desc-arriving": "Pociągu nie ma jeszcze na tej scenerii. Przyjedzie z: {prevStationName} (szlak {prevDepartureLine})", + "desc-online": "Pociąg jest na tej scenerii. Odjedzie do: {nextStationName} (szlak {nextArrivalLine})", + "desc-stopped": "Pociąg jest na tej scenerii i odbywa postój. Odjedzie do: {nextStationName} (szlak {nextArrivalLine})", + "desc-next-arrival": "Odjeżdża do: {nextStationName} (szlak {nextArrivalLine})", + "desc-departed": "Pociąg jest na tej scenerii i został odprawiony. Odjeżdża do: {nextStationName} (szlak {nextArrivalLine})", + "desc-departed-away": "Pociąg został odprawiony i odjechał do: {nextStationName} (szlak {nextArrivalLine})", + "desc-end": "Pociąg kończy bieg" }, "history": { "title": "DZIENNIK ROZKŁADÓW JAZDY" diff --git a/src/scripts/interfaces/ScheduledTrain.ts b/src/scripts/interfaces/ScheduledTrain.ts index e03a44f..3c537e8 100644 --- a/src/scripts/interfaces/ScheduledTrain.ts +++ b/src/scripts/interfaces/ScheduledTrain.ts @@ -1,32 +1,41 @@ -import TrainStop from "./TrainStop"; +import TrainStop from './TrainStop'; -export default interface ScheduledTrain { - trainId: string; - trainNo: number; - - driverName: string; - driverId: number; - currentStationName: string; - currentStationHash: string; - category: string; - stopInfo: TrainStop; +export enum StopStatus { + 'arriving' = 'arriving', + 'departed' = 'departed', + 'departed-away' = 'departed-away', + 'online' = 'online', + 'stopped' = 'stopped', + 'terminated' = 'terminated', +} - terminatesAt: string; - beginsAt: string; +export interface ScheduledTrain { + trainId: string; + trainNo: number; - prevStationName: string; - nextStationName: string; + driverName: string; + driverId: number; + currentStationName: string; + currentStationHash: string; + category: string; + stopInfo: TrainStop; - arrivingLine: string | null; - departureLine: string | null; + terminatesAt: string; + beginsAt: string; - prevDepartureLine: string | null; - nextArrivalLine: string | null; + prevStationName: string; + nextStationName: string; - signal: string; - connectedTrack: string; + arrivingLine: string | null; + departureLine: string | null; - stopLabel: string; - stopStatus: string; - stopStatusID: number; -} \ No newline at end of file + prevDepartureLine: string | null; + nextArrivalLine: string | null; + + signal: string; + connectedTrack: string; + + stopLabel: string; + stopStatus: StopStatus; + stopStatusID: number; +} diff --git a/src/scripts/interfaces/Station.ts b/src/scripts/interfaces/Station.ts index 4f39b89..e3eac88 100644 --- a/src/scripts/interfaces/Station.ts +++ b/src/scripts/interfaces/Station.ts @@ -1,5 +1,5 @@ import { Availability } from './store/storeTypes'; -import ScheduledTrain from './ScheduledTrain'; +import {ScheduledTrain} from './ScheduledTrain'; import StationRoutes from './StationRoutes'; export default interface Station { diff --git a/src/scripts/utils/storeUtils.ts b/src/scripts/utils/storeUtils.ts index 57d0062..06b2ca7 100644 --- a/src/scripts/utils/storeUtils.ts +++ b/src/scripts/utils/storeUtils.ts @@ -1,4 +1,4 @@ -import ScheduledTrain from '../interfaces/ScheduledTrain'; +import { ScheduledTrain, StopStatus } from '../interfaces/ScheduledTrain'; import Train from '../interfaces/Train'; import TrainStop from '../interfaces/TrainStop'; @@ -74,32 +74,32 @@ export const parseSpawns = (spawnString: string) => { export const getTimestamp = (date: string | null): number => (date ? new Date(date).getTime() : 0); export const getTrainStopStatus = (stopInfo: TrainStop, currentStationName: string, stationName: string) => { - let stopStatus = '', + let stopStatus = StopStatus['arriving'], stopLabel = '', stopStatusID = -1; if (stopInfo.terminatesHere && stopInfo.confirmed) { - stopStatus = 'terminated'; + stopStatus = StopStatus['terminated']; stopLabel = 'Skończył bieg'; stopStatusID = 5; } else if (!stopInfo.terminatesHere && stopInfo.confirmed && currentStationName == stationName) { - stopStatus = 'departed'; + stopStatus = StopStatus['departed']; stopLabel = 'Odprawiony'; stopStatusID = 2; } else if (!stopInfo.terminatesHere && stopInfo.confirmed && currentStationName != stationName) { - stopStatus = 'departed-away'; + stopStatus = StopStatus['departed-away']; stopLabel = 'Odjechał'; stopStatusID = 4; } else if (currentStationName == stationName && !stopInfo.stopped) { - stopStatus = 'online'; + stopStatus = StopStatus['online']; stopLabel = 'Na stacji'; stopStatusID = 0; } else if (currentStationName == stationName && stopInfo.stopped) { - stopStatus = 'stopped'; + stopStatus = StopStatus['stopped']; stopLabel = 'Postój'; stopStatusID = 1; } else if (currentStationName != stationName) { - stopStatus = 'arriving'; + stopStatus = StopStatus['arriving']; stopLabel = 'W drodze'; stopStatusID = 3; } @@ -122,7 +122,7 @@ export function getScheduledTrain(train: Train, trainStopIndex: number, stationN for (let i = trainStopIndex - 1; i >= 0; i--) { if (/strong|podg/g.test(followingStops[i].stopName)) { - prevStationName = followingStops[i].stopNameRAW.replace(/,.*/g,""); + prevStationName = followingStops[i].stopNameRAW.replace(/,.*/g, ''); break; } @@ -130,7 +130,7 @@ export function getScheduledTrain(train: Train, trainStopIndex: number, stationN for (let i = trainStopIndex + 1; i < followingStops.length; i++) { if (/strong|podg/g.test(followingStops[i].stopName)) { - nextStationName = followingStops[i].stopNameRAW.replace(/,.*/g,""); + nextStationName = followingStops[i].stopNameRAW.replace(/,.*/g, ''); break; } @@ -172,7 +172,6 @@ export function getScheduledTrain(train: Train, trainStopIndex: number, stationN signal: train.signal, connectedTrack: train.connectedTrack, - driverName: train.driverName, driverId: train.driverId, currentStationName: train.currentStationName, diff --git a/src/store/store.ts b/src/store/store.ts index b43e0cd..96a4ef8 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -3,7 +3,7 @@ import { defineStore } from 'pinia'; import { io } from 'socket.io-client'; import { DataStatus } from '../scripts/enums/DataStatus'; import StationAPIData from '../scripts/interfaces/api/StationAPIData'; -import ScheduledTrain from '../scripts/interfaces/ScheduledTrain'; +import {ScheduledTrain} from '../scripts/interfaces/ScheduledTrain'; import Station from '../scripts/interfaces/Station'; import StationRoutes from '../scripts/interfaces/StationRoutes'; import Train from '../scripts/interfaces/Train';