feature: vmax szlaków

This commit is contained in:
2023-02-11 03:08:24 +01:00
parent 3f818069cd
commit 8bedc4dfc6
7 changed files with 207 additions and 199 deletions
@@ -4,12 +4,10 @@
<b>{{ $t('scenery.one-way-routes') }}</b> <b>{{ $t('scenery.one-way-routes') }}</b>
<ul class="routes-list"> <ul class="routes-list">
<li <li v-for="route in station.generalInfo.routes.oneWay">
v-for="route in station.generalInfo.routes.oneWay" <span :class="{ 'no-catenary': !route.catenary, internal: route.isInternal }"> {{ route.name }}</span>
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }" <span v-if="route.speed" class="speed">{{ route.speed }}</span>
> <span v-if="route.SBL" class="sbl">SBL</span>
{{ route.name }}
<b v-if="route.SBL">SBL</b>
</li> </li>
</ul> </ul>
</div> </div>
@@ -18,41 +16,13 @@
<b>{{ $t('scenery.two-way-routes') }}</b> <b>{{ $t('scenery.two-way-routes') }}</b>
<ul class="routes-list"> <ul class="routes-list">
<li <li v-for="route in station.generalInfo.routes.twoWay">
v-for="route in station.generalInfo.routes.twoWay" <span :class="{ 'no-catenary': !route.catenary, internal: route.isInternal }">{{ route.name }}</span>
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }" <span v-if="route.speed" class="speed">{{ route.speed }}</span>
> <span v-if="route.SBL" class="sbl">SBL</span>
{{ route.name }} <b v-if="route.SBL">SBL</b>
</li> </li>
</ul> </ul>
</div> </div>
<!-- <div
class="route-info"
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }"
v-for="route in [...station.generalInfo.routes.oneWay, ...station.generalInfo.routes.twoWay].filter(
(route) => route.name != '-'
)"
:key="route.name"
:title="`Szlak ${route.name}: ${route.isInternal ? 'wewnętrzny' : 'zewnętrzny'}, ${
route.tracks == 2 ? 'dwutorowy' : 'jednotorowy'
}, ${route.catenary ? 'zelektryfikowany' : 'niezelektryfikowany'} z ${route.SBL ? 'SBL' : 'PBL'} ${
route.TWB ? 'i blokadą dwukierunkową' : ''
}`"
> -->
<!-- <span class="track-name">
<b>{{ route.name }}</b>
</span> -->
<!--
<span class="track-specs">
{{ route.tracks }}tor
<img v-if="route.catenary" :src="icons.trackCatenary" alt="icon track catenary" />
<img v-else :src="icons.trackNoCatenary" alt="icon track no catenary" />
<img v-if="route.TWB" :src="icons.trackTWB" alt="icon track twb" />
<img v-if="route.SBL" :src="icons.trackSBL" alt="icon track sbl" />
</span> -->
<!-- </div> -->
</section> </section>
</template> </template>
@@ -93,10 +63,12 @@ ul.routes-list {
display: flex; display: flex;
li { li {
background-color: #007599; margin: 0.2em 0.25em;
span {
padding: 0.2em 0.25em; padding: 0.2em 0.25em;
margin-left: 0.25em; background-color: #007599;
font-weight: bold;
&.no-catenary { &.no-catenary {
background-color: #686868; background-color: #686868;
@@ -106,8 +78,28 @@ ul.routes-list {
text-decoration: underline; text-decoration: underline;
} }
b { &.speed {
background-color: #404040;
color: #cfcfcf;
}
&.sbl {
color: var(--clr-primary); color: var(--clr-primary);
background-color: #404040;
}
&:last-child {
border-radius: 0 0.5em 0.5em 0;
}
&:first-child {
border-radius: 0.5em 0 0 0.5em;
}
&:only-child {
border-radius: 0.5em;
}
} }
} }
} }
@@ -89,6 +89,7 @@ import dateMixin from '../../mixins/dateMixin';
import imageMixin from '../../mixins/imageMixin'; import imageMixin from '../../mixins/imageMixin';
import Train from '../../scripts/interfaces/Train'; import Train from '../../scripts/interfaces/Train';
import TrainStop from '../../scripts/interfaces/TrainStop'; import TrainStop from '../../scripts/interfaces/TrainStop';
import { useStore } from '../../store/store';
import StopDate from '../Global/StopDate.vue'; import StopDate from '../Global/StopDate.vue';
export default defineComponent({ export default defineComponent({
@@ -106,6 +107,8 @@ export default defineComponent({
setup(props) { setup(props) {
return { return {
store: useStore(),
lastConfirmed: computed(() => { lastConfirmed: computed(() => {
return props.train.timetableData!.followingStops.findIndex( return props.train.timetableData!.followingStops.findIndex(
(stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed && !stops[i + 1]?.stopped (stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed && !stops[i + 1]?.stopped
@@ -424,3 +427,4 @@ ul.stop_list > li.stop {
} }
} }
</style> </style>
+5 -2
View File
@@ -1,12 +1,13 @@
export default interface StationRoutes { export default interface StationRoutes {
oneWay: oneWay: {
{
name: string; name: string;
catenary: boolean; catenary: boolean;
SBL: boolean; SBL: boolean;
TWB: boolean; TWB: boolean;
isInternal: boolean; isInternal: boolean;
tracks: number; tracks: number;
speed: number;
length: number;
}[]; }[];
twoWay: { twoWay: {
@@ -16,6 +17,8 @@ export default interface StationRoutes {
TWB: boolean; TWB: boolean;
isInternal: boolean; isInternal: boolean;
tracks: number; tracks: number;
speed: number;
length: number;
}[]; }[];
/* [catenary, noCatenary] */ /* [catenary, noCatenary] */
+1 -1
View File
@@ -12,7 +12,7 @@ export default interface Train {
driverId: number; driverId: number;
trainNo: number; trainNo: number;
driverName: string; driverName: string;
driverLevel: number; driverLevel?: number;
currentStationName: string; currentStationName: string;
currentStationHash: string; currentStationHash: string;
locoURL: string; locoURL: string;
+12 -4
View File
@@ -24,6 +24,7 @@ export const useStore = defineStore('store', {
stationList: [], stationList: [],
trainList: [], trainList: [],
routesList: [],
sceneryData: [], sceneryData: [],
lastDispatcherStatuses: [], lastDispatcherStatuses: [],
@@ -115,8 +116,8 @@ export const useStore = defineStore('store', {
sceneries: timetable.sceneries, sceneries: timetable.sceneries,
} }
: undefined, : undefined,
}; } as Train;
}) as Train[]; });
}, },
getDispatcherStatus(onlineStationData: StationAPIData) { getDispatcherStatus(onlineStationData: StationAPIData) {
@@ -294,7 +295,8 @@ export const useStore = defineStore('store', {
return; return;
} }
this.stationList = sceneryData.map((scenery) => ({ this.stationList = sceneryData.map((scenery) => {
return {
name: scenery.name, name: scenery.name,
generalInfo: { generalInfo: {
@@ -315,6 +317,9 @@ export const useStore = defineStore('store', {
const catenary = specs2[1] == 'E'; const catenary = specs2[1] == 'E';
const SBL = specs2[2] == 'S'; const SBL = specs2[2] == 'S';
const TWB = specs2[3] ? true : false; const TWB = specs2[3] ? true : false;
const speed = Number(routeString.split(':')[1]) || 0;
const length = Number(routeString.split(':')[2]) || 0;
const propName = twoWay const propName = twoWay
? catenary ? catenary
@@ -331,6 +336,8 @@ export const useStore = defineStore('store', {
catenary, catenary,
isInternal, isInternal,
tracks: twoWay ? 2 : 1, tracks: twoWay ? 2 : 1,
length,
speed,
}); });
if (!isInternal) acc[propName].push(name); if (!isInternal) acc[propName].push(name);
@@ -352,7 +359,8 @@ export const useStore = defineStore('store', {
? scenery.checkpoints.split(';').map((sub) => ({ checkpointName: sub, scheduledTrains: [] })) ? scenery.checkpoints.split(';').map((sub) => ({ checkpointName: sub, scheduledTrains: [] }))
: [], : [],
}, },
})); };
});
}, },
connectToWebsocket() { connectToWebsocket() {
+1
View File
@@ -69,6 +69,7 @@ export interface StationJSONData {
SUP: boolean; SUP: boolean;
routes: string; routes: string;
checkpoints: string | null; checkpoints: string | null;
authors?: string; authors?: string;