From 435cfb3b3fbee5eef2d5f1129b5f6a321fdf362f Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 15 Jan 2025 16:23:26 +0100 Subject: [PATCH 1/5] chore: added offline players indicators in the scenery view --- .../SceneryInfo/SceneryInfoUserList.vue | 28 +++++++++++++++++-- src/locales/en.json | 4 ++- src/locales/pl.json | 4 ++- src/store/mainStore.ts | 14 +++++----- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue index c67f1b5..866abeb 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue @@ -19,8 +19,25 @@ :data-status="status" > - {{ train.trainNo }} - {{ train.driverName }} + {{ train.trainNo }} + + {{ train.driverName }} + + + + @@ -66,8 +83,13 @@ export default defineComponent({ this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW) ); + const sceneryName = + train.currentStationName.indexOf('.sc') != -1 + ? train.currentStationName.split(' ').slice(0, -1).join(' ') + : train.currentStationName; + const status = stop - ? getTrainStopStatus(stop, train.currentStationName, this.onlineScenery!.name) + ? getTrainStopStatus(stop, sceneryName, this.onlineScenery!.name) : 'no-timetable'; return { diff --git a/src/locales/en.json b/src/locales/en.json index 6db9416..bdb3c22 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -48,7 +48,9 @@ "no-result": "No results for current search!", "migration-warning": "Stacjownik services will be unavailable 2/06/2022 between 1-3am (CEST time) due to the migration of API hostings!", "migration-confirm": "Roger that!", - "offline": "App is in the offline mode!" + "offline": "App is in the offline mode!", + "tooltip-driver-offline": "Driver is offline", + "tooltip-scenery-offline": "Offline ride through the scenery" }, "footer": { "discord": "Stacjownik Discord server" diff --git a/src/locales/pl.json b/src/locales/pl.json index ef7c914..3c40037 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -45,7 +45,9 @@ "loading": "Pobieranie danych...", "error": "Wystąpił problem z załadowaniem danych!", "no-result": "Brak wyników o podanych kryteriach!", - "offline": "Aplikacja w trybie offline!" + "offline": "Aplikacja w trybie offline!", + "tooltip-driver-offline": "Maszynista offline", + "tooltip-scenery-offline": "Jazda offline przez scenerię" }, "footer": { "discord": "Serwer Discord Stacjownika" diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts index 3e75f2d..deb899c 100644 --- a/src/store/mainStore.ts +++ b/src/store/mainStore.ts @@ -43,7 +43,7 @@ export const useMainStore = defineStore('mainStore', { sceneriesTrains.clear(); return (apiStore.activeData?.trains ?? []) - .filter((train) => train.timetable || train.online) + .filter((train) => train.timetable || train.lastSeen >= Date.now() - 60000) .map((train) => { const stock = train.stockString.split(';'); const locoType = stock ? stock[0] : train.stockString; @@ -112,13 +112,15 @@ export const useMainStore = defineStore('mainStore', { : undefined } as Train; + const stationNameKey = train.currentStationName.indexOf('.sc') != -1 ? train.currentStationName.split(' ').slice(0, -1).join(' ') : train.currentStationName; + // Sceneries trains map - if (sceneriesTrains.has(train.currentStationName)) { - sceneriesTrains.set(train.currentStationName, [ - ...sceneriesTrains.get(train.currentStationName)!, + if (sceneriesTrains.has(stationNameKey)) { + sceneriesTrains.set(stationNameKey, [ + ...sceneriesTrains.get(stationNameKey)!, trainObj ]); - } else sceneriesTrains.set(train.currentStationName, [trainObj]); + } else sceneriesTrains.set(stationNameKey, [trainObj]); // Checkpoints trains map if (trainObj.timetableData) { @@ -216,7 +218,6 @@ export const useMainStore = defineStore('mainStore', { return acc; }, [] as ActiveScenery[]); - const referenceTimestamp = Date.now(); const onlineActiveSceneries = apiStore.activeData?.activeSceneries.reduce((list, scenery) => { @@ -229,7 +230,6 @@ export const useMainStore = defineStore('mainStore', { : scenery.dispatcherStatus > 5 ? scenery.dispatcherStatus : null; - list.push({ name: scenery.stationName, From 027cdee25ad7807f074a5a1402f1bf5777f31d11 Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 15 Jan 2025 16:24:56 +0100 Subject: [PATCH 2/5] fix: twr polish locale --- src/locales/pl.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/pl.json b/src/locales/pl.json index 3c40037..2dc36f4 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -21,7 +21,7 @@ "driver-message": "Maszynista wspierający projekt Stacjownika!" }, "warnings": { - "TWR": "Pociąg z towarami niebezpiecznie wysokiego ryzyka", + "TWR": "Pociąg z towarami niebezpiecznymi wysokiego ryzyka", "SKR": "Pociąg z przekroczoną skrajnią", "PN": "Pociąg z przesyłkami nadzwyczajnymi", "TN": "Pociąg z towarami niebezpiecznymi", From c66ff8feed44cc0b41977f6adf5132a4a910041c Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 15 Jan 2025 16:26:02 +0100 Subject: [PATCH 3/5] bump: v1.28.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c25b3b..6c515aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stacjownik", - "version": "1.28.6", + "version": "1.28.7", "private": true, "type": "module", "scripts": { From 17bda9e6e73bdd2c116858013b57894936f78947 Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 28 Jan 2025 14:23:57 +0100 Subject: [PATCH 4/5] chore: added scenery offline icon in active train schedule; icon improvements --- .../SceneryInfo/SceneryInfoUserList.vue | 6 +++--- src/components/TrainsView/StopLabel.vue | 15 ++++++++++----- src/components/TrainsView/TrainInfo.vue | 2 +- src/components/TrainsView/TrainSchedule.vue | 10 ++++++++-- src/components/TrainsView/typings.ts | 2 ++ src/locales/en.json | 2 +- src/locales/pl.json | 2 +- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue index 866abeb..b1a0b69 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue @@ -29,11 +29,11 @@ data-tooltip-type="BaseTooltip" :data-tooltip-content="$t('app.tooltip-driver-offline')" > - + diff --git a/src/components/TrainsView/StopLabel.vue b/src/components/TrainsView/StopLabel.vue index edd7da5..9402e83 100644 --- a/src/components/TrainsView/StopLabel.vue +++ b/src/components/TrainsView/StopLabel.vue @@ -4,7 +4,16 @@ :data-minor="stop.isSBL || (stop.nameRaw.endsWith(', po') && !stop.duration)" > - {{ stop.nameRaw }} + + {{ stop.nameRaw }} + {{ stop.nameRaw }} @@ -118,10 +127,6 @@ s { &.misc { background: gray; } - - i { - display: none; - } } .date { diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index d6d7f9b..f61badb 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -106,7 +106,7 @@
- + {{ $t('trains.scenery-offline') }}
diff --git a/src/components/TrainsView/TrainSchedule.vue b/src/components/TrainsView/TrainSchedule.vue index 01f5307..568cc56 100644 --- a/src/components/TrainsView/TrainSchedule.vue +++ b/src/components/TrainsView/TrainSchedule.vue @@ -134,7 +134,7 @@ import StopLabel from './StopLabel.vue'; import StockList from '../Global/StockList.vue'; import { useMainStore } from '../../store/mainStore'; import { useApiStore } from '../../store/apiStore'; -import { StationRoutesInfo, Train } from '../../typings/common'; +import { Train } from '../../typings/common'; import { TrainScheduleStop } from './typings'; export default defineComponent({ @@ -173,6 +173,10 @@ export default defineComponent({ const sceneryName = timetablePath[currentPathIndex].stationName; const sceneryInfo = this.apiStore.sceneryData.find((st) => st.name == sceneryName); + const isSceneryOnline = + (this.apiStore.activeData?.activeSceneries?.find((sc) => sc.stationName == sceneryName) + ?.isOnline ?? 0) == 1; + const arrivalLineInfo = sceneryInfo?.routesInfo.find( (r) => r.routeName == stop.arrivalLine ); @@ -214,8 +218,10 @@ export default defineComponent({ isLastConfirmed: this.lastConfirmed === i && !stop.terminatesHere, isSBL: /sbl/gi.test(stop.stopName), position: stop.beginsHere ? 'begin' : stop.terminatesHere ? 'end' : 'en-route', + status: stop.confirmed ? 'confirmed' : stop.stopped ? 'stopped' : 'unconfirmed', + sceneryName, - status: stop.confirmed ? 'confirmed' : stop.stopped ? 'stopped' : 'unconfirmed' + isSceneryOnline }; }) ?? [] ); diff --git a/src/components/TrainsView/typings.ts b/src/components/TrainsView/typings.ts index 30de2b4..62c86f0 100644 --- a/src/components/TrainsView/typings.ts +++ b/src/components/TrainsView/typings.ts @@ -151,6 +151,8 @@ export interface TrainScheduleStop { isSBL: boolean; sceneryName: string | null; + isSceneryOnline: boolean; + distance: number; arrivalLine: string | null; diff --git a/src/locales/en.json b/src/locales/en.json index bdb3c22..db6c521 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -50,7 +50,7 @@ "migration-confirm": "Roger that!", "offline": "App is in the offline mode!", "tooltip-driver-offline": "Driver is offline", - "tooltip-scenery-offline": "Offline ride through the scenery" + "tooltip-scenery-offline": "Scenery is offline" }, "footer": { "discord": "Stacjownik Discord server" diff --git a/src/locales/pl.json b/src/locales/pl.json index 2dc36f4..4dd5aa3 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -47,7 +47,7 @@ "no-result": "Brak wyników o podanych kryteriach!", "offline": "Aplikacja w trybie offline!", "tooltip-driver-offline": "Maszynista offline", - "tooltip-scenery-offline": "Jazda offline przez scenerię" + "tooltip-scenery-offline": "Sceneria offline" }, "footer": { "discord": "Serwer Discord Stacjownika" From 1b2cd34e86eb8c8ad8bf65052b4d77d1f1ce11ae Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 28 Jan 2025 14:32:48 +0100 Subject: [PATCH 5/5] fix: responsive text center --- .../JournalView/JournalTimetables/EntryStatus.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/JournalView/JournalTimetables/EntryStatus.vue b/src/components/JournalView/JournalTimetables/EntryStatus.vue index feebdd7..6c72b86 100644 --- a/src/components/JournalView/JournalTimetables/EntryStatus.vue +++ b/src/components/JournalView/JournalTimetables/EntryStatus.vue @@ -21,7 +21,7 @@ > - + {{ $t(`journal.${timetable.terminated ? 'last-seen-at' : 'currently-at'}`) }} {{ timetable.currentSceneryName.replace(/.[a-zA-Z0-9]+.sc/, '') }} @@ -71,4 +71,9 @@ export default defineComponent({ justify-content: center; } } + +.entry-location { + text-align: center; + color: #ccc; +}