mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Optymalizacja i cleanup kodu
This commit is contained in:
@@ -2,125 +2,128 @@
|
||||
<div class="scenery-info">
|
||||
<div class="info-header">
|
||||
<div class="scenery-name">
|
||||
<div v-if="stationInfo.stationProject" style="color: salmon; font-size: 0.6em; line-height: 0.7em;">
|
||||
{{ stationInfo.stationProject }}
|
||||
<div v-if="station.generalInfo?.project" style="color: salmon; font-size: 0.6em; line-height: 0.7em;">
|
||||
{{ station.generalInfo.project }}
|
||||
</div>
|
||||
|
||||
<a v-if="stationInfo.stationURL" :href="stationInfo.stationURL" target="_blank" rel="noopener noreferrer">{{
|
||||
stationInfo.stationName
|
||||
<a v-if="station.generalInfo?.url" :href="station.generalInfo.url" target="_blank" rel="noopener noreferrer">{{
|
||||
station.name
|
||||
}}</a>
|
||||
|
||||
<span v-else>{{ stationInfo.stationName }}</span>
|
||||
<span v-else>{{ station.name }}</span>
|
||||
</div>
|
||||
<div class="scenery-hash" v-if="stationInfo.stationHash">#{{ stationInfo.stationHash }}</div>
|
||||
<div class="scenery-hash" v-if="station.onlineInfo?.hash">#{{ station.onlineInfo.hash }}</div>
|
||||
</div>
|
||||
|
||||
<section v-if="!timetableOnly">
|
||||
<div class="info-stats" :class="!stationInfo.stationHash ? 'no-stats' : ''">
|
||||
<div class="info-stats" :class="!station.onlineInfo ? 'no-stats' : ''">
|
||||
<span class="likes">
|
||||
<img :src="likeIcon" alt="icon-like" />
|
||||
<span>{{ stationInfo.dispatcherRate }}</span>
|
||||
<span>{{ station.onlineInfo?.dispatcherRate || '0' }}</span>
|
||||
</span>
|
||||
|
||||
<span class="users">
|
||||
<img :src="userIcon" alt="icon-user" />
|
||||
<span>{{ stationInfo.currentUsers }}</span>
|
||||
<span>{{ station.onlineInfo?.currentUsers || '0' }}</span>
|
||||
/
|
||||
<span>{{ stationInfo.maxUsers }}</span>
|
||||
<span>{{ station.onlineInfo?.maxUsers || '0' }}</span>
|
||||
</span>
|
||||
|
||||
<span class="spawns">
|
||||
<img :src="spawnIcon" alt="icon-spawn" />
|
||||
<span>{{ stationInfo.spawns.length }}</span>
|
||||
<span>{{ station.onlineInfo?.spawns.length || '0' }}</span>
|
||||
</span>
|
||||
|
||||
<span class="schedules">
|
||||
<img :src="timetableIcon" alt="icon-timetable" />
|
||||
<span>
|
||||
<span style="color: #eee">{{ stationInfo.scheduledTrains.length }}</span>
|
||||
<span style="color: #eee">{{ station.onlineInfo?.scheduledTrains?.length || '0' }}</span>
|
||||
/
|
||||
<span style="color: #bbb">{{
|
||||
stationInfo.scheduledTrains.filter((train) => train.stopInfo.confirmed).length
|
||||
}}</span>
|
||||
<span style="color: #bbb"
|
||||
>{{ station.onlineInfo?.scheduledTrains?.filter((train) => train.stopInfo.confirmed).length || '0' }}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="info-brief">
|
||||
<img
|
||||
v-if="stationInfo.controlType"
|
||||
:src="require(`@/assets/icon-${stationInfo.controlType}.svg`)"
|
||||
:alt="stationInfo.controlType"
|
||||
:title="$t('desc.control-type') + $t(`controls.${stationInfo.controlType}`)"
|
||||
v-if="station.generalInfo?.controlType"
|
||||
:src="require(`@/assets/icon-${station.generalInfo.controlType}.svg`)"
|
||||
:alt="station.generalInfo.controlType"
|
||||
:title="$t('desc.control-type') + $t(`controls.${station.generalInfo.controlType}`)"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.signalType"
|
||||
:src="require(`@/assets/icon-${stationInfo.signalType}.svg`)"
|
||||
:alt="stationInfo.signalType"
|
||||
:title="$t('desc.signals-type') + $t(`signals.${stationInfo.signalType}`)"
|
||||
v-if="station.generalInfo?.signalType"
|
||||
:src="require(`@/assets/icon-${station.generalInfo.signalType}.svg`)"
|
||||
:alt="station.generalInfo.signalType"
|
||||
:title="$t('desc.signals-type') + $t(`signals.${station.generalInfo.signalType}`)"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.SBL && stationInfo.SBL !== ''"
|
||||
v-if="station.generalInfo && station.generalInfo.SBL !== ''"
|
||||
:src="SBLIcon"
|
||||
:alt="$t('desc.SBL') + `${stationInfo.SBL}`"
|
||||
:title="$t('desc.SBL') + `${stationInfo.SBL}`"
|
||||
:alt="$t('desc.SBL') + `${station.generalInfo.SBL}`"
|
||||
:title="$t('desc.SBL') + `${station.generalInfo.SBL}`"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.TWB && stationInfo.TWB !== ''"
|
||||
v-if="station.generalInfo && station.generalInfo.TWB !== ''"
|
||||
:src="TWBIcon"
|
||||
alt="two way route blockade"
|
||||
:title="`${stationInfo.TWB === 'TAK' ? $t('desc.TWB-all') : $t('desc.TWB-routes') + stationInfo.TWB}`"
|
||||
:title="
|
||||
`${
|
||||
station.generalInfo.TWB === 'TAK' ? $t('desc.TWB-all') : $t('desc.TWB-routes') + station.generalInfo.TWB
|
||||
}`
|
||||
"
|
||||
/>
|
||||
|
||||
<img v-if="stationInfo.default" :src="td2Icon" alt="default scenery" :title="$t('desc.default')" />
|
||||
<img v-if="station.generalInfo?.default" :src="td2Icon" alt="default scenery" :title="$t('desc.default')" />
|
||||
|
||||
<img
|
||||
v-if="stationInfo.nonPublic || !stationInfo.reqLevel"
|
||||
v-if="station.generalInfo?.nonPublic || !station.generalInfo?.reqLevel"
|
||||
:src="lockIcon"
|
||||
alt="non public scenery"
|
||||
:title="$t('desc.non-public')"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.unavailable"
|
||||
v-if="station.generalInfo?.unavailable"
|
||||
:src="unavailableIcon"
|
||||
alt="icon unavailable"
|
||||
:title="$t('desc.unavailable')"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.stationLines && stationInfo.stationLines != ''"
|
||||
v-if="station.generalInfo && station.generalInfo.lines != ''"
|
||||
:src="realIcon"
|
||||
alt="real scenery"
|
||||
:title="`${$t('desc.real')} ${stationInfo.stationLines}`"
|
||||
:title="`${$t('desc.real')} ${station.generalInfo.lines}`"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="stationInfo.reqLevel < 0"
|
||||
:src="unknownIcon"
|
||||
alt="icon-unknown"
|
||||
:title="$t('desc.unknown')"
|
||||
/>
|
||||
<img v-if="!station.generalInfo" :src="unknownIcon" alt="icon-unknown" :title="$t('desc.unknown')" />
|
||||
</div>
|
||||
|
||||
<div class="info-dispatcher">
|
||||
<div class="dispatcher" v-if="stationInfo.stationHash">
|
||||
<div class="dispatcher" v-if="station.onlineInfo">
|
||||
<span
|
||||
class="dispatcher_level"
|
||||
:style="calculateExpStyle(stationInfo.dispatcherExp, stationInfo.dispatcherIsSupporter)"
|
||||
:style="calculateExpStyle(station.onlineInfo.dispatcherExp, station.onlineInfo.dispatcherIsSupporter)"
|
||||
>
|
||||
{{ stationInfo.dispatcherExp > 1 ? stationInfo.dispatcherExp : 'L' }}
|
||||
{{ station.onlineInfo.dispatcherExp > 1 ? station.onlineInfo.dispatcherExp : 'L' }}
|
||||
</span>
|
||||
|
||||
<span class="dispatcher_name">{{ stationInfo.dispatcherName }}</span>
|
||||
<span class="dispatcher_name">{{ station.onlineInfo.dispatcherName }}</span>
|
||||
</div>
|
||||
|
||||
<span class="status-badge" :class="stationInfo.statusID">
|
||||
{{ $t(`status.${stationInfo.statusID}`) }}
|
||||
{{ stationInfo.statusID == 'online' ? stationInfo.statusTimeString : '' }}
|
||||
<span class="status-badge" v-if="station.onlineInfo" :class="station.onlineInfo.statusID">
|
||||
{{ $t(`status.${station.onlineInfo.statusID}`) }}
|
||||
{{ station.onlineInfo.statusID == 'online' ? station.onlineInfo.statusTimeString : '' }}
|
||||
</span>
|
||||
|
||||
<span class="status-badge free" v-else>
|
||||
{{ $t('status.free') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -153,16 +156,18 @@
|
||||
<img :src="spawnIcon" alt="icon-spawn" />
|
||||
</h3>
|
||||
|
||||
<span
|
||||
class="spawn"
|
||||
v-for="(spawn, i) in stationInfo.spawns"
|
||||
:key="spawn.spawnName + stationInfo.dispatcherName + i"
|
||||
>
|
||||
<span class="spawn_name">{{ spawn.spawnName }}</span>
|
||||
<span class="spawn_length">{{ spawn.spawnLength }}m</span>
|
||||
<span v-if="station.onlineInfo">
|
||||
<span
|
||||
class="spawn"
|
||||
v-for="(spawn, i) in station.onlineInfo.spawns"
|
||||
:key="spawn.spawnName + station.onlineInfo?.dispatcherName + i"
|
||||
>
|
||||
<span class="spawn_name">{{ spawn.spawnName }}</span>
|
||||
<span class="spawn_length">{{ spawn.spawnLength }}m</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="spawn none" v-if="!stationInfo.spawns || stationInfo.spawns.length == 0"
|
||||
<span class="spawn none" v-if="!station.onlineInfo || station.onlineInfo.spawns.length == 0"
|
||||
>{{ $t('scenery.no-spawns') }}
|
||||
</span>
|
||||
</div>
|
||||
@@ -178,7 +183,7 @@ import { computed, defineComponent } from '@vue/runtime-core';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
stationInfo: {
|
||||
station: {
|
||||
type: Object as () => Station,
|
||||
default: {},
|
||||
},
|
||||
@@ -206,10 +211,14 @@ export default defineComponent({
|
||||
|
||||
setup(props) {
|
||||
const computedStationTrains = computed(() => {
|
||||
if (!props.stationInfo) return [];
|
||||
if (!props.station) return [];
|
||||
if (!props.station.onlineInfo) return [];
|
||||
if (!props.station.onlineInfo.stationTrains) return [];
|
||||
|
||||
return props.stationInfo.stationTrains.map((train) => {
|
||||
const scheduledTrainStatus = props.stationInfo?.scheduledTrains.find((st) => st.trainNo === train.trainNo);
|
||||
return props.station.onlineInfo.stationTrains.map((train) => {
|
||||
const scheduledTrainStatus = props.station.onlineInfo?.scheduledTrains?.find(
|
||||
(st) => st.trainNo === train.trainNo
|
||||
);
|
||||
|
||||
return {
|
||||
...train,
|
||||
|
||||
@@ -19,16 +19,15 @@
|
||||
<div
|
||||
class="checkpoints"
|
||||
v-if="
|
||||
stationInfo &&
|
||||
stationInfo.scheduledTrains.length > 0 &&
|
||||
stationInfo.checkpoints
|
||||
station &&
|
||||
station.generalInfo?.checkpoints
|
||||
"
|
||||
>
|
||||
<button
|
||||
v-for="cp in station.generalInfo.checkpoints"
|
||||
:key="cp.checkpointName"
|
||||
class="checkpoint_item btn--text"
|
||||
:class="{ current: selectedCheckpoint === cp.checkpointName }"
|
||||
v-for="cp in stationInfo.checkpoints"
|
||||
:key="cp.checkpointName"
|
||||
@click="selectCheckpoint(cp)"
|
||||
>
|
||||
{{ cp.checkpointName }}
|
||||
@@ -144,7 +143,7 @@ export default defineComponent({
|
||||
components: { SelectBox },
|
||||
|
||||
props: {
|
||||
stationInfo: {
|
||||
station: {
|
||||
type: Object as () => Station,
|
||||
},
|
||||
timetableOnly: {
|
||||
@@ -167,18 +166,18 @@ export default defineComponent({
|
||||
const selectedCheckpoint = ref("");
|
||||
|
||||
const computedScheduledTrains = computed(() => {
|
||||
if (!props.stationInfo) return [];
|
||||
if (!props.station) return [];
|
||||
|
||||
let scheduledTrains =
|
||||
props.stationInfo.checkpoints?.find(
|
||||
props.station.generalInfo?.checkpoints.find(
|
||||
(cp) => cp.checkpointName === selectedCheckpoint.value
|
||||
)?.scheduledTrains || props.stationInfo.scheduledTrains;
|
||||
)?.scheduledTrains || props.station.onlineInfo?.scheduledTrains || [];
|
||||
|
||||
// if (props.stationInfo.checkpoints)
|
||||
// scheduledTrains = props.stationInfo.checkpoints.find(
|
||||
// if (props.station.checkpoints)
|
||||
// scheduledTrains = props.station.checkpoints.find(
|
||||
// (cp) => cp.checkpointName === selectedCheckpoint.value
|
||||
// )?.scheduledTrains;
|
||||
// else scheduledTrains = props.stationInfo.scheduledTrains;
|
||||
// else scheduledTrains = props.station.scheduledTrains;
|
||||
|
||||
return (
|
||||
scheduledTrains?.sort((a, b) => {
|
||||
@@ -206,11 +205,14 @@ export default defineComponent({
|
||||
|
||||
methods: {
|
||||
loadSelectedOption() {
|
||||
if (!this.stationInfo) return;
|
||||
if (this.stationInfo.checkpoints.length == 0) return;
|
||||
if (!this.station) return;
|
||||
if(!this.station.generalInfo) return;
|
||||
if(!this.station.generalInfo.checkpoints) return;
|
||||
if (this.station.generalInfo.checkpoints.length == 0) return;
|
||||
|
||||
if (this.selectedCheckpoint != "") return;
|
||||
|
||||
this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName;
|
||||
this.selectedCheckpoint = this.station.generalInfo.checkpoints[0].checkpointName;
|
||||
},
|
||||
|
||||
selectCheckpoint(cp: { checkpointName: string }) {
|
||||
|
||||
@@ -36,149 +36,157 @@
|
||||
<tr
|
||||
class="station"
|
||||
v-for="(station, i) in stations"
|
||||
:key="i + station.stationHash"
|
||||
@click="() => setScenery(station.stationName)"
|
||||
:key="i + station.name"
|
||||
@click="() => setScenery(station.name)"
|
||||
>
|
||||
<td
|
||||
class="station_name"
|
||||
:class="{
|
||||
'default-station': station.default,
|
||||
online: station.online,
|
||||
'station-unavailable': station.unavailable,
|
||||
'default-station': station.generalInfo?.default,
|
||||
online: station.onlineInfo,
|
||||
'station-unavailable': station.generalInfo?.unavailable,
|
||||
}"
|
||||
>
|
||||
<b v-if="station.stationProject" style="color: salmon;">{{ station.stationProject }}</b>
|
||||
{{ station.stationName }}
|
||||
<b v-if="station.generalInfo?.project" style="color: salmon;">{{ station.generalInfo.project }}</b>
|
||||
{{ station.name }}
|
||||
</td>
|
||||
|
||||
<td class="station_level">
|
||||
<span :style="calculateExpStyle(station.reqLevel, station.supportersOnly)">
|
||||
{{ station.reqLevel > -1 ? (station.reqLevel >= 2 ? station.reqLevel : 'L') : '?' }}
|
||||
<td class="station_level" >
|
||||
<span v-if="station.generalInfo">
|
||||
<span :style="calculateExpStyle(station.generalInfo.reqLevel, station.generalInfo.supportersOnly)">
|
||||
{{ station.generalInfo.reqLevel > -1 ? (station.generalInfo.reqLevel >= 2 ? station.generalInfo.reqLevel : 'L') : '?' }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span v-else>?</span>
|
||||
</td>
|
||||
|
||||
<td class="station_status">
|
||||
<span class="status-badge" :class="station.statusID">
|
||||
{{ $t(`status.${station.statusID}`) }}
|
||||
{{ station.statusID == 'online' ? station.statusTimeString : '' }}
|
||||
<td class="station_status" >
|
||||
<span class="status-badge" :class="station.onlineInfo.statusID" v-if="station.onlineInfo">
|
||||
{{ $t(`status.${station.onlineInfo.statusID}`) }}
|
||||
{{ station.onlineInfo.statusID == 'online' ? station.onlineInfo.statusTimeString : '' }}
|
||||
</span>
|
||||
|
||||
<span class="status-badge free" v-else>
|
||||
{{ $t('status.free') }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="station_dispatcher-name">
|
||||
{{ station.online ? station.dispatcherName : '' }}
|
||||
{{ station.onlineInfo ? station.onlineInfo.dispatcherName : '' }}
|
||||
</td>
|
||||
|
||||
<td class="station_dispatcher-exp">
|
||||
<span
|
||||
v-if="station.online"
|
||||
:style="calculateExpStyle(station.dispatcherExp, station.dispatcherIsSupporter)"
|
||||
v-if="station.onlineInfo"
|
||||
:style="calculateExpStyle(station.onlineInfo.dispatcherExp, station.onlineInfo.dispatcherIsSupporter)"
|
||||
>
|
||||
{{ 2 > station.dispatcherExp ? 'L' : station.dispatcherExp }}
|
||||
{{ 2 > station.onlineInfo.dispatcherExp ? 'L' : station.onlineInfo.dispatcherExp }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="station_tracks twoway">
|
||||
<span
|
||||
v-if="station.routes && station.routes.twoWay.catenary > 0"
|
||||
v-if="station.generalInfo && station.generalInfo.routes.twoWay.catenary > 0"
|
||||
class="track catenary"
|
||||
:title="`Liczba zelektryfikowanych szlaków dwutorowych: ${station.routes.twoWay.catenary}`"
|
||||
:title="`Liczba zelektryfikowanych szlaków dwutorowych: ${station.generalInfo.routes.twoWay.catenary}`"
|
||||
>
|
||||
{{ station.routes.twoWay.catenary }}
|
||||
{{ station.generalInfo.routes.twoWay.catenary }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
v-if="station.routes && station.routes.twoWay.noCatenary > 0"
|
||||
v-if="station.generalInfo && station.generalInfo.routes.twoWay.noCatenary > 0"
|
||||
class="track no-catenary"
|
||||
:title="`Liczba niezelektryfikowanych szlaków dwutorowych: ${station.routes.twoWay.noCatenary}`"
|
||||
:title="`Liczba niezelektryfikowanych szlaków dwutorowych: ${station.generalInfo.routes.twoWay.noCatenary}`"
|
||||
>
|
||||
{{ station.routes.twoWay.noCatenary }}
|
||||
{{ station.generalInfo.routes.twoWay.noCatenary }}
|
||||
</span>
|
||||
|
||||
<span class="separator"></span>
|
||||
|
||||
<span
|
||||
v-if="station.routes && station.routes.oneWay.catenary > 0"
|
||||
v-if="station.generalInfo && station.generalInfo.routes.oneWay.catenary > 0"
|
||||
class="track catenary"
|
||||
:title="`Liczba zelektryfikowanych szlaków jednotorowych: ${station.routes.oneWay.catenary}`"
|
||||
:title="`Liczba zelektryfikowanych szlaków jednotorowych: ${station.generalInfo.routes.oneWay.catenary}`"
|
||||
>
|
||||
{{ station.routes.oneWay.catenary }}
|
||||
{{ station.generalInfo.routes.oneWay.catenary }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
v-if="station.routes && station.routes.oneWay.noCatenary > 0"
|
||||
v-if="station.generalInfo && station.generalInfo.routes.oneWay.noCatenary > 0"
|
||||
class="track no-catenary"
|
||||
:title="`Liczba niezelektryfikowanych szlaków jednotorowych: ${station.routes.oneWay.noCatenary}`"
|
||||
:title="`Liczba niezelektryfikowanych szlaków jednotorowych: ${station.generalInfo.routes.oneWay.noCatenary}`"
|
||||
>
|
||||
{{ station.routes.oneWay.noCatenary }}
|
||||
{{ station.generalInfo.routes.oneWay.noCatenary }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="station_info">
|
||||
<img
|
||||
class="icon-info"
|
||||
v-if="station.controlType"
|
||||
:src="require(`@/assets/icon-${station.controlType}.svg`)"
|
||||
:alt="station.controlType"
|
||||
:title="$t('desc.control-type') + $t(`controls.${station.controlType}`)"
|
||||
v-if="station.generalInfo?.controlType"
|
||||
:src="require(`@/assets/icon-${station.generalInfo.controlType}.svg`)"
|
||||
:alt="station.generalInfo.controlType"
|
||||
:title="$t('desc.control-type') + $t(`controls.${station.generalInfo.controlType}`)"
|
||||
/>
|
||||
|
||||
<img
|
||||
class="icon-info"
|
||||
v-if="station.signalType"
|
||||
:src="require(`@/assets/icon-${station.signalType}.svg`)"
|
||||
:alt="station.signalType"
|
||||
:title="$t('desc.signals-type') + $t(`signals.${station.signalType}`)"
|
||||
v-if="station.generalInfo?.signalType"
|
||||
:src="require(`@/assets/icon-${station.generalInfo.signalType}.svg`)"
|
||||
:alt="station.generalInfo.signalType"
|
||||
:title="$t('desc.signals-type') + $t(`signals.${station.generalInfo.signalType}`)"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="station.SBL && station.SBL !== ''"
|
||||
v-if="station.generalInfo?.SBL && station.generalInfo?.SBL !== ''"
|
||||
:src="SBLIcon"
|
||||
alt="SBL"
|
||||
:title="$t('desc.SBL') + `${station.SBL}`"
|
||||
:title="$t('desc.SBL') + `${station.generalInfo.SBL}`"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="station.nonPublic && station.reqLevel > -1"
|
||||
v-if="station.generalInfo?.nonPublic && station.generalInfo?.reqLevel > -1"
|
||||
:src="lockIcon"
|
||||
alt="non-public"
|
||||
:title="$t('desc.non-public')"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="station.unavailable"
|
||||
v-if="station.generalInfo?.unavailable"
|
||||
:src="unavailableIcon"
|
||||
alt="icon-unavailable"
|
||||
:title="$t('desc.unavailable')"
|
||||
/>
|
||||
|
||||
<img
|
||||
v-if="station.reqLevel < 0"
|
||||
v-if="!station.generalInfo"
|
||||
:src="unknownIcon"
|
||||
alt="icon-unknown"
|
||||
:title="$t('desc.unknown')"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td class="station_users" :class="{ inactive: !station.online }">
|
||||
<td class="station_users" :class="{ inactive: !station.onlineInfo }">
|
||||
<span>
|
||||
<span class="highlight">{{ station.currentUsers }}</span>
|
||||
<span class="highlight">{{ station.onlineInfo?.currentUsers || "0" }}</span>
|
||||
/
|
||||
<span>{{ station.maxUsers }}</span>
|
||||
<span>{{ station.onlineInfo?.maxUsers || "0" }}</span>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="station_spawns" :class="{ inactive: !station.online }">
|
||||
<span class="highlight">{{ station.spawns.length }}</span>
|
||||
<td class="station_spawns" :class="{ inactive: !station.onlineInfo }">
|
||||
<span class="highlight">{{ station.onlineInfo?.spawns.length || "0" }}</span>
|
||||
</td>
|
||||
|
||||
<td class="station_schedules" :class="{ inactive: !station.online }">
|
||||
<td class="station_schedules" :class="{ inactive: !station.onlineInfo }">
|
||||
<span>
|
||||
<span class="highlight">
|
||||
{{ station.scheduledTrains.length }}
|
||||
{{ station.onlineInfo?.scheduledTrains?.length || "0" }}
|
||||
</span>
|
||||
/
|
||||
<span style="color: #bbb">
|
||||
{{ station.scheduledTrains.filter((train) => train.stopInfo.confirmed).length }}
|
||||
{{ station.onlineInfo?.scheduledTrains?.filter((train) => train.stopInfo.confirmed).length || "0" }}
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
@@ -259,13 +267,13 @@ export default defineComponent({
|
||||
|
||||
methods: {
|
||||
setScenery(name: string) {
|
||||
const station = this.stations.find((station) => station.stationName === name);
|
||||
const station = this.stations.find((station) => station.name === name);
|
||||
|
||||
if (!station) return;
|
||||
|
||||
this.$router.push({
|
||||
name: 'SceneryView',
|
||||
query: { station: station.stationName.replaceAll(' ', '_') },
|
||||
query: { station: station.name.replaceAll(' ', '_') },
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user