mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
chore: added offline players indicators in the scenery view
This commit is contained in:
@@ -20,7 +20,24 @@
|
|||||||
>
|
>
|
||||||
<router-link :to="train.driverRouteLocation" class="a-block">
|
<router-link :to="train.driverRouteLocation" class="a-block">
|
||||||
<span class="user_train"> {{ train.trainNo }}</span>
|
<span class="user_train"> {{ train.trainNo }}</span>
|
||||||
<span class="user_name">{{ train.driverName }}</span>
|
<span class="user_name">
|
||||||
|
{{ train.driverName }}
|
||||||
|
<i
|
||||||
|
v-if="train.timetableData != undefined && train.lastSeen <= Date.now() - 120000"
|
||||||
|
class="fa-solid fa-user-slash"
|
||||||
|
style="color: lightcoral"
|
||||||
|
data-tooltip-type="BaseTooltip"
|
||||||
|
:data-tooltip-content="$t('app.tooltip-driver-offline')"
|
||||||
|
></i>
|
||||||
|
|
||||||
|
<i
|
||||||
|
v-if="train.currentStationName.indexOf('.sc') != -1"
|
||||||
|
class="fa-solid fa-user-slash"
|
||||||
|
style="color: salmon"
|
||||||
|
data-tooltip-type="BaseTooltip"
|
||||||
|
:data-tooltip-content="$t('app.tooltip-scenery-offline')"
|
||||||
|
></i>
|
||||||
|
</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
@@ -66,8 +83,13 @@ export default defineComponent({
|
|||||||
this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW)
|
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
|
const status = stop
|
||||||
? getTrainStopStatus(stop, train.currentStationName, this.onlineScenery!.name)
|
? getTrainStopStatus(stop, sceneryName, this.onlineScenery!.name)
|
||||||
: 'no-timetable';
|
: 'no-timetable';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
+3
-1
@@ -48,7 +48,9 @@
|
|||||||
"no-result": "No results for current search!",
|
"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-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!",
|
"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": {
|
"footer": {
|
||||||
"discord": "Stacjownik Discord server"
|
"discord": "Stacjownik Discord server"
|
||||||
|
|||||||
+3
-1
@@ -45,7 +45,9 @@
|
|||||||
"loading": "Pobieranie danych...",
|
"loading": "Pobieranie danych...",
|
||||||
"error": "Wystąpił problem z załadowaniem danych!",
|
"error": "Wystąpił problem z załadowaniem danych!",
|
||||||
"no-result": "Brak wyników o podanych kryteriach!",
|
"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": {
|
"footer": {
|
||||||
"discord": "Serwer Discord Stacjownika"
|
"discord": "Serwer Discord Stacjownika"
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const useMainStore = defineStore('mainStore', {
|
|||||||
sceneriesTrains.clear();
|
sceneriesTrains.clear();
|
||||||
|
|
||||||
return (apiStore.activeData?.trains ?? [])
|
return (apiStore.activeData?.trains ?? [])
|
||||||
.filter((train) => train.timetable || train.online)
|
.filter((train) => train.timetable || train.lastSeen >= Date.now() - 60000)
|
||||||
.map((train) => {
|
.map((train) => {
|
||||||
const stock = train.stockString.split(';');
|
const stock = train.stockString.split(';');
|
||||||
const locoType = stock ? stock[0] : train.stockString;
|
const locoType = stock ? stock[0] : train.stockString;
|
||||||
@@ -112,13 +112,15 @@ export const useMainStore = defineStore('mainStore', {
|
|||||||
: undefined
|
: undefined
|
||||||
} as Train;
|
} as Train;
|
||||||
|
|
||||||
|
const stationNameKey = train.currentStationName.indexOf('.sc') != -1 ? train.currentStationName.split(' ').slice(0, -1).join(' ') : train.currentStationName;
|
||||||
|
|
||||||
// Sceneries trains map
|
// Sceneries trains map
|
||||||
if (sceneriesTrains.has(train.currentStationName)) {
|
if (sceneriesTrains.has(stationNameKey)) {
|
||||||
sceneriesTrains.set(train.currentStationName, [
|
sceneriesTrains.set(stationNameKey, [
|
||||||
...sceneriesTrains.get(train.currentStationName)!,
|
...sceneriesTrains.get(stationNameKey)!,
|
||||||
trainObj
|
trainObj
|
||||||
]);
|
]);
|
||||||
} else sceneriesTrains.set(train.currentStationName, [trainObj]);
|
} else sceneriesTrains.set(stationNameKey, [trainObj]);
|
||||||
|
|
||||||
// Checkpoints trains map
|
// Checkpoints trains map
|
||||||
if (trainObj.timetableData) {
|
if (trainObj.timetableData) {
|
||||||
@@ -216,7 +218,6 @@ export const useMainStore = defineStore('mainStore', {
|
|||||||
return acc;
|
return acc;
|
||||||
}, [] as ActiveScenery[]);
|
}, [] as ActiveScenery[]);
|
||||||
|
|
||||||
|
|
||||||
const referenceTimestamp = Date.now();
|
const referenceTimestamp = Date.now();
|
||||||
|
|
||||||
const onlineActiveSceneries = apiStore.activeData?.activeSceneries.reduce((list, scenery) => {
|
const onlineActiveSceneries = apiStore.activeData?.activeSceneries.reduce((list, scenery) => {
|
||||||
@@ -230,7 +231,6 @@ export const useMainStore = defineStore('mainStore', {
|
|||||||
? scenery.dispatcherStatus
|
? scenery.dispatcherStatus
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
||||||
list.push({
|
list.push({
|
||||||
name: scenery.stationName,
|
name: scenery.stationName,
|
||||||
hash: scenery.stationHash,
|
hash: scenery.stationHash,
|
||||||
|
|||||||
Reference in New Issue
Block a user