Dodano listę szlaków w widoku scenerii

This commit is contained in:
2022-03-05 16:50:08 +01:00
parent fb18a156d0
commit c9d0a674e4
10 changed files with 101 additions and 21 deletions
-2
View File
@@ -139,8 +139,6 @@
display: flex; display: flex;
align-items: center; align-items: center;
color: $accentCol;
span { span {
margin: 0 0.15em; margin: 0 0.15em;
} }
+8 -5
View File
@@ -50,8 +50,9 @@
</span> </span>
<img src="@/assets/icon-dispatcher.svg" alt="icon dispatcher" /> <img src="@/assets/icon-dispatcher.svg" alt="icon dispatcher" />
<span>{{ data.activeStationCount }}</span> {{ data.activeStationCount }}
<span>{{ data.activeTrainCount }}</span> |
{{ data.activeTrainCount }}
<img src="@/assets/icon-train.svg" alt="icon train" /> <img src="@/assets/icon-train.svg" alt="icon train" />
</div> </div>
</span> </span>
@@ -131,6 +132,11 @@ export default defineComponent({
sceneryDataStatus, sceneryDataStatus,
dispatcherDataStatus: computed(() => data.value.dispatcherDataStatus), dispatcherDataStatus: computed(() => data.value.dispatcherDataStatus),
timetableCount: data.value.trainList.filter((train) => train.timetableData).length,
onlineDispatcherCount: data.value.stationList.filter(
(station) => station.onlineInfo && station.onlineInfo.statusTimestamp > 0
).length,
openFilterCard() { openFilterCard() {
isFilterCardVisible.value = true; isFilterCardVisible.value = true;
}, },
@@ -148,8 +154,6 @@ export default defineComponent({
pl: require('@/assets/icon-pl.svg'), pl: require('@/assets/icon-pl.svg'),
error: require('@/assets/icon-error.svg'), error: require('@/assets/icon-error.svg'),
}, },
}), }),
created() { created() {
@@ -174,7 +178,6 @@ export default defineComponent({
StorageManager.setBooleanValue('version_notes_read', true); StorageManager.setBooleanValue('version_notes_read', true);
}, },
changeLang(lang: string) { changeLang(lang: string) {
this.$i18n.locale = lang; this.$i18n.locale = lang;
this.currentLang = lang; this.currentLang = lang;
+3
View File
@@ -0,0 +1,3 @@
<svg width="144" height="144" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M77.9831 61.3284L97.9732 7L44 74.9104H69.9871L51.996 137L99.9722 61.3284H77.9831Z" fill="#FFF500"/>
</svg>

After

Width:  |  Height:  |  Size: 216 B

+5
View File
@@ -0,0 +1,5 @@
<svg width="144" height="144" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="9.20437" y="2.4661" width="36.5457" height="57.8287" rx="16.7449" transform="matrix(0.869001 -0.494811 0.505207 0.862998 50.006 87.4256)" stroke="white" stroke-width="13.3959"/>
<rect x="9.20437" y="2.4661" width="36.5457" height="57.8287" rx="16.7449" transform="matrix(0.869001 -0.494811 0.505207 0.862998 14.9599 29.6039)" stroke="white" stroke-width="13.3959"/>
<path d="M65.1132 58.145L79.8523 84.3103" stroke="white" stroke-width="10.0469" stroke-linecap="round" stroke-linejoin="bevel"/>
</svg>

After

Width:  |  Height:  |  Size: 611 B

+3
View File
@@ -0,0 +1,3 @@
<svg width="144" height="144" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.19995 72L44.3741 93.9988L44.8386 50.8056L7.19995 72ZM139.192 73.4193L102.018 51.4204L101.554 94.6137L139.192 73.4193ZM40.8255 76.1026L105.486 76.7979L105.567 69.3166L40.9059 68.6214L40.8255 76.1026Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 334 B

@@ -21,7 +21,7 @@
:title="$t('desc.signals-type') + $t(`signals.${station.generalInfo.signalType}`)" :title="$t('desc.signals-type') + $t(`signals.${station.generalInfo.signalType}`)"
/> />
<img <!-- <img
v-if="station.generalInfo && station.generalInfo.routes.sblRouteNames.length > 0" v-if="station.generalInfo && station.generalInfo.routes.sblRouteNames.length > 0"
:src="icons.SBL" :src="icons.SBL"
alt="sbl icon" alt="sbl icon"
@@ -35,7 +35,7 @@
:title=" :title="
$t('desc.TWB-routes') + station.generalInfo.routes.twoWay.filter(route => route.TWB).map(route => route.name).join(', ') $t('desc.TWB-routes') + station.generalInfo.routes.twoWay.filter(route => route.TWB).map(route => route.name).join(', ')
" "
/> /> -->
<img v-if="station.generalInfo?.default" :src="icons.td2" alt="default scenery" :title="$t('desc.default')" /> <img v-if="station.generalInfo?.default" :src="icons.td2" alt="default scenery" :title="$t('desc.default')" />
@@ -28,6 +28,33 @@
</span> </span>
</span> </span>
</section> </section>
<section class="info-tracks" v-if="station.generalInfo">
<div
class="track-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 :src="require('@/assets/icon-track-catenary.svg')" alt="icon track catenary" v-if="route.catenary" />
<img v-if="route.TWB" :src="require('@/assets/icon-track-twb.svg')" alt="icon track twb"/>
<img v-if="route.SBL" :src="require('@/assets/icon-track-sbl.svg')" alt="icon track sbl"/>
</span>
</div>
</section>
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -57,6 +84,43 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../styles/variables.scss'; @import '../../../styles/variables.scss';
.info-tracks {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 0 3em;
}
.track-info {
margin: 0.45em 0.25em;
font-size: 1.05em;
cursor: help;
span {
height: 100%;
background-color: #009dce;
padding: 0.2em 0.25em;
}
&.no-catenary > span {
background-color: #686868;
}
&.internal > .track-name {
text-decoration: underline;
}
img {
height: 1.2em;
vertical-align: text-bottom;
}
}
.train-specs {
}
.info-stats { .info-stats {
padding: 1rem 0; padding: 1rem 0;
+10 -4
View File
@@ -1,17 +1,15 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import StationsView from "@/views/StationsView.vue";
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{ {
path: '/', path: '/',
name: 'StationsView', name: 'StationsView',
component: StationsView component: () => import("@/views/StationsView.vue")
}, },
{ {
path: "/trains", path: "/trains",
name: "TrainsView", name: "TrainsView",
component: () => import("@/views/TrainsView.vue"), component: () => import("@/views/TrainsView.vue"),
props: route => ({ train: route.query.train }) props: route => ({ train: route.query.train })
}, },
{ {
@@ -32,6 +30,14 @@ const routes: Array<RouteRecordRaw> = [
] ]
const router = createRouter({ const router = createRouter({
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { top: 0, left: 0 };
}
},
history: createWebHistory(), history: createWebHistory(),
routes, routes,
}) })
+2
View File
@@ -6,6 +6,7 @@ export default interface StationRoutes {
SBL: boolean; SBL: boolean;
TWB: boolean; TWB: boolean;
isInternal: boolean; isInternal: boolean;
tracks: number;
}[]; }[];
twoWay: { twoWay: {
@@ -14,6 +15,7 @@ export default interface StationRoutes {
SBL: boolean; SBL: boolean;
TWB: boolean; TWB: boolean;
isInternal: boolean; isInternal: boolean;
tracks: number;
}[]; }[];
/* [catenary, noCatenary] */ /* [catenary, noCatenary] */
+2 -6
View File
@@ -365,7 +365,7 @@ export const store = createStore<State>({
? 'oneWayCatenaryRouteNames' ? 'oneWayCatenaryRouteNames'
: 'oneWayNoCatenaryRouteNames'; : 'oneWayNoCatenaryRouteNames';
acc[twoWay ? 'twoWay' : 'oneWay'].push({ name, SBL, TWB, catenary, isInternal }); acc[twoWay ? 'twoWay' : 'oneWay'].push({ name, SBL, TWB, catenary, isInternal, tracks: twoWay ? 2 : 1 });
if(!isInternal) acc[propName].push(name); if(!isInternal) acc[propName].push(name);
if (SBL) acc['sblRouteNames'].push(name); if (SBL) acc['sblRouteNames'].push(name);
@@ -573,12 +573,8 @@ export const store = createStore<State>({
state.trainList = state.trainList.reduce((acc, train) => { state.trainList = state.trainList.reduce((acc, train) => {
const timetable = timetableList.find(tt => tt.data && tt.trainNo === train.trainNo && tt.data.driverId === train.driverId); const timetable = timetableList.find(tt => tt.data && tt.trainNo === train.trainNo && tt.data.driverId === train.driverId);
const allTimetables = timetableList.filter(tt => tt.data && tt.data.driverId === train.driverId && tt.trainNo !== train.trainNo);
// if (!timetable || !timetable.data) return acc; if (!train.online && !timetable) return acc;;
if (allTimetables.length > 0)
return acc;
const trainStopData = state.stationList const trainStopData = state.stationList
.find(station => station.name === train.currentStationName) .find(station => station.name === train.currentStationName)