mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Rozwijany RJ aktywnych pociągów
This commit is contained in:
@@ -1,39 +1,243 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="train-info">
|
<div class="train-info simple" tabindex="0">
|
||||||
<div class="wrapper">
|
<section>
|
||||||
<train-info-simple :train="train" />
|
<span>
|
||||||
|
<div>
|
||||||
<!-- <train-info-extended :train="train" v-else /> -->
|
<span>
|
||||||
</div>
|
<span class="timetable_warnings">
|
||||||
|
<span class="warning twr" v-if="train.timetableData?.TWR">TWR</span>
|
||||||
|
<span class="warning skr" v-if="train.timetableData?.SKR">SKR</span>
|
||||||
|
</span>
|
||||||
|
<strong v-if="train.timetableData">{{ train.timetableData.category }} </strong>
|
||||||
|
<strong>{{ train.trainNo }}</strong>
|
||||||
|
<span> | {{ train.driverName }}</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<img
|
||||||
|
class="image-offline"
|
||||||
|
style="height: 1em"
|
||||||
|
v-if="!train.currentStationHash"
|
||||||
|
:src="icons.offline"
|
||||||
|
alt="offline"
|
||||||
|
:title="$t('trains.offline')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="timetable_route">
|
||||||
|
<strong v-if="train.timetableData">{{ train.timetableData.route.replace('|', ' - ') }}</strong>
|
||||||
|
<img
|
||||||
|
v-if="getSceneriesWithComments(train.timetableData).length > 0"
|
||||||
|
class="image-warning"
|
||||||
|
:src="icons.warning"
|
||||||
|
:title="`${$t('trains.timetable-comments')} (${getSceneriesWithComments(train.timetableData)})`"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr style="margin: 0.25em 0" />
|
||||||
|
|
||||||
|
<div class="timetable_stops" v-if="train.timetableData">
|
||||||
|
<span v-if="train.timetableData.followingStops.length > 2">
|
||||||
|
{{ $t('trains.via-title') }}
|
||||||
|
<span v-html="displayStopList(train.timetableData.followingStops)"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 0.5em" v-if="train.timetableData">
|
||||||
|
<span style="color: gray" v-html="generateProgressBar(train)"></span>
|
||||||
|
{{ currentDistance(train.timetableData.followingStops) }} km /
|
||||||
|
<span class="text--primary"> {{ train.timetableData.routeDistance }} km </span>
|
||||||
|
|
|
||||||
|
<span v-html="currentDelay(train.timetableData.followingStops)"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="driver_position text--grayed" style="margin-top: 0.25em">
|
||||||
|
<span v-if="train.currentStationHash">
|
||||||
|
{{ $t('trains.current-scenery') }} <span>{{ train['currentStationName'] }} </span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span v-else>
|
||||||
|
{{ $t('trains.current-scenery') }}
|
||||||
|
<span>{{ train['currentStationName'].replace(/.[a-zA-Z0-9]+.sc/, '') }} (offline) </span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span v-if="train.signal">
|
||||||
|
{{ $t('trains.current-signal') }} <span>{{ train['signal'] }} </span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span v-if="train.connectedTrack">
|
||||||
|
{{ $t('trains.current-track') }} <span>{{ train['connectedTrack'] }} </span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span v-if="train.distance">({{ displayDistance(train.distance) }})</span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="train-image" style="display: flex; justify-content: center; align-items: center">
|
||||||
|
<img :src="train.locoURL" alt="Not Found" @error="onImageError" />
|
||||||
|
|
||||||
|
<div class="text--grayed">
|
||||||
|
{{ train.locoType }}
|
||||||
|
<span v-if="train.cars.length > 0">
|
||||||
|
• {{ $t('trains.cars') }}:
|
||||||
|
<span class="count">{{ train.cars.length }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<span v-for="(stat, i) in STATS.main" :key="stat.name">
|
||||||
|
<span v-if="i > 0"> • </span>
|
||||||
|
<span>{{ `${~~(train[stat.name] * (stat.multiplier || 1))}${stat.unit}` }} </span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import trainInfoMixin from '@/mixins/trainInfoMixin';
|
||||||
import Train from '@/scripts/interfaces/Train';
|
import Train from '@/scripts/interfaces/Train';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import TrainInfoExtended from './TrainInfoExtended.vue';
|
|
||||||
import TrainInfoSimple from './TrainInfoSimple.vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { TrainInfoSimple, TrainInfoExtended },
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
train: {
|
train: {
|
||||||
type: Object as () => Train,
|
type: Object as () => Train,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mixins: [trainInfoMixin],
|
||||||
|
|
||||||
|
data: () => ({
|
||||||
|
icons: {
|
||||||
|
warning: require('@/assets/icon-warning.svg'),
|
||||||
|
offline: require('@/assets/icon-offline.svg'),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
generateProgressBar(train: Train) {
|
||||||
|
if (!train.timetableData) return '';
|
||||||
|
|
||||||
|
const percentage = Math.floor(Number(this.confirmedPercentage(train.timetableData.followingStops)));
|
||||||
|
|
||||||
|
let progressBarString = `<span style="color: white"> ${percentage}% </span> `;
|
||||||
|
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
progressBarString += `<span style="color: ${
|
||||||
|
i < Math.round(percentage / 20) ? 'springgreen' : 'gray'
|
||||||
|
}">▉</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return progressBarString;
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import '../../styles/responsive.scss';
|
@import '../../styles/responsive.scss';
|
||||||
|
|
||||||
.wrapper {
|
.image-warning,
|
||||||
font-size: 1em;
|
.image-offline {
|
||||||
|
height: 1em;
|
||||||
|
|
||||||
@include smallScreen() {
|
margin-left: 0.5em;
|
||||||
font-size: 1.2em;
|
}
|
||||||
|
|
||||||
|
.train-image {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
width: 12em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.simple {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 1fr;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #202020;
|
||||||
|
gap: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.driver_position:first-letter {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timetable_stops {
|
||||||
|
font-size: 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timetable_route {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timetable_warnings {
|
||||||
|
color: black;
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
padding: 0.1em 0.5em;
|
||||||
|
margin-right: 0.2em;
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
&.twr {
|
||||||
|
background: var(--clr-twr);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.skr {
|
||||||
|
background: var(--clr-skr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.comments {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
font-size: 0.9em;
|
||||||
|
|
||||||
|
margin-top: 1em;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include smallScreen() {
|
||||||
|
.simple {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 1em 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-stats {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timetable_route {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comments {
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin: 0 0 0.5em 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,243 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="train-info simple" tabindex="0">
|
|
||||||
<section>
|
|
||||||
<span>
|
|
||||||
<div>
|
|
||||||
<span>
|
|
||||||
<span class="timetable_warnings">
|
|
||||||
<span class="warning twr" v-if="train.timetableData?.TWR">TWR</span>
|
|
||||||
<span class="warning skr" v-if="train.timetableData?.SKR">SKR</span>
|
|
||||||
</span>
|
|
||||||
<strong v-if="train.timetableData">{{ train.timetableData.category }} </strong>
|
|
||||||
<strong>{{ train.trainNo }}</strong>
|
|
||||||
<span> | {{ train.driverName }}</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<img
|
|
||||||
class="image-offline"
|
|
||||||
style="height: 1em"
|
|
||||||
v-if="!train.currentStationHash"
|
|
||||||
:src="icons.offline"
|
|
||||||
alt="offline"
|
|
||||||
:title="$t('trains.offline')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="timetable_route">
|
|
||||||
<strong v-if="train.timetableData">{{ train.timetableData.route.replace('|', ' - ') }}</strong>
|
|
||||||
<img
|
|
||||||
v-if="getSceneriesWithComments(train.timetableData).length > 0"
|
|
||||||
class="image-warning"
|
|
||||||
:src="icons.warning"
|
|
||||||
:title="`${$t('trains.timetable-comments')} (${getSceneriesWithComments(train.timetableData)})`"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr style="margin: 0.25em 0" />
|
|
||||||
|
|
||||||
<div class="timetable_stops" v-if="train.timetableData">
|
|
||||||
<span v-if="train.timetableData.followingStops.length > 2">
|
|
||||||
{{ $t('trains.via-title') }}
|
|
||||||
<span v-html="displayStopList(train.timetableData.followingStops)"></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div style="margin-top: 0.5em" v-if="train.timetableData">
|
|
||||||
<span style="color: gray" v-html="generateProgressBar(train)"></span>
|
|
||||||
{{ currentDistance(train.timetableData.followingStops) }} km /
|
|
||||||
<span class="text--primary"> {{ train.timetableData.routeDistance }} km </span>
|
|
||||||
|
|
|
||||||
<span v-html="currentDelay(train.timetableData.followingStops)"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="driver_position text--grayed" style="margin-top: 0.25em">
|
|
||||||
<span v-if="train.currentStationHash">
|
|
||||||
{{ $t('trains.current-scenery') }} <span>{{ train['currentStationName'] }} </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-else>
|
|
||||||
{{ $t('trains.current-scenery') }}
|
|
||||||
<span>{{ train['currentStationName'].replace(/.[a-zA-Z0-9]+.sc/, '') }} (offline) </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-if="train.signal">
|
|
||||||
{{ $t('trains.current-signal') }} <span>{{ train['signal'] }} </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-if="train.connectedTrack">
|
|
||||||
{{ $t('trains.current-track') }} <span>{{ train['connectedTrack'] }} </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-if="train.distance">({{ displayDistance(train.distance) }})</span>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="train-image" style="display: flex; justify-content: center; align-items: center">
|
|
||||||
<img :src="train.locoURL" alt="Not Found" @error="onImageError" />
|
|
||||||
|
|
||||||
<div class="text--grayed">
|
|
||||||
{{ train.locoType }}
|
|
||||||
<span v-if="train.cars.length > 0">
|
|
||||||
• {{ $t('trains.cars') }}:
|
|
||||||
<span class="count">{{ train.cars.length }}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<span v-for="(stat, i) in STATS.main" :key="stat.name">
|
|
||||||
<span v-if="i > 0"> • </span>
|
|
||||||
<span>{{ `${~~(train[stat.name] * (stat.multiplier || 1))}${stat.unit}` }} </span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import trainInfoMixin from '@/mixins/trainInfoMixin';
|
|
||||||
import Train from '@/scripts/interfaces/Train';
|
|
||||||
import { defineComponent } from 'vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
props: {
|
|
||||||
train: {
|
|
||||||
type: Object as () => Train,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [trainInfoMixin],
|
|
||||||
|
|
||||||
data: () => ({
|
|
||||||
icons: {
|
|
||||||
warning: require('@/assets/icon-warning.svg'),
|
|
||||||
offline: require('@/assets/icon-offline.svg'),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
generateProgressBar(train: Train) {
|
|
||||||
if (!train.timetableData) return '';
|
|
||||||
|
|
||||||
const percentage = Math.floor(Number(this.confirmedPercentage(train.timetableData.followingStops)));
|
|
||||||
|
|
||||||
let progressBarString = `<span style="color: white"> ${percentage}% </span> `;
|
|
||||||
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
progressBarString += `<span style="color: ${
|
|
||||||
i < Math.round(percentage / 20) ? 'springgreen' : 'gray'
|
|
||||||
}">▉</span>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return progressBarString;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import '../../styles/responsive.scss';
|
|
||||||
|
|
||||||
.image-warning,
|
|
||||||
.image-offline {
|
|
||||||
height: 1em;
|
|
||||||
|
|
||||||
margin-left: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.train-image {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin: 0.5em 0;
|
|
||||||
width: 12em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.simple {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 2fr 1fr;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
|
|
||||||
padding: 1em;
|
|
||||||
background-color: #202020;
|
|
||||||
gap: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.driver_position:first-letter {
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timetable_stops {
|
|
||||||
font-size: 0.75em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timetable_route {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
margin-top: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timetable_warnings {
|
|
||||||
color: black;
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
padding: 0.1em 0.5em;
|
|
||||||
margin-right: 0.2em;
|
|
||||||
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
&.twr {
|
|
||||||
background: var(--clr-twr);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.skr {
|
|
||||||
background: var(--clr-skr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.comments {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
font-size: 0.9em;
|
|
||||||
|
|
||||||
margin-top: 1em;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include smallScreen() {
|
|
||||||
.simple {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
gap: 1em 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-stats {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timetable_route {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comments {
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
img {
|
|
||||||
margin: 0 0 0.5em 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,8 +1,43 @@
|
|||||||
p<template>
|
p
|
||||||
|
<template>
|
||||||
<div class="train-schedule" @click="toggleShowState">
|
<div class="train-schedule" @click="toggleShowState">
|
||||||
|
<div class="train-stock">
|
||||||
|
<ul class="stock-list">
|
||||||
|
<li>
|
||||||
|
<img class="train-image" :src="train.locoURL" alt="loco" @error="onImageError" />
|
||||||
|
<div>{{ train.locoType }}</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li v-if="train.locoType.startsWith('EN')">
|
||||||
|
<img :src="train.locoURL.replace('rb', 's')" @error="onImageError" alt="" />
|
||||||
|
<div>{{ train.locoType }}S</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li v-if="train.locoType.startsWith('EN71')">
|
||||||
|
<img :src="train.locoURL.replace('rb', 's')" @error="onImageError" alt="" />
|
||||||
|
<div>{{ train.locoType }}S</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li v-if="train.locoType.startsWith('EN')">
|
||||||
|
<img :src="train.locoURL.replace('rb', 'ra')" @error="onImageError" alt="" />
|
||||||
|
<div>{{ train.locoType }}RA</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li v-for="(car, i) in train.cars" :key="i">
|
||||||
|
<img
|
||||||
|
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${car.split(':')[0]}.png`"
|
||||||
|
@error="onImageError"
|
||||||
|
alt="car"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div>{{ car.replace(/_/g, ' ').split(":")[0] }}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="schedule-wrapper">
|
<div class="schedule-wrapper">
|
||||||
<ul class="stop_list">
|
<ul class="stop_list">
|
||||||
<li v-for="(stop, i) in followingStops" :key="i" class="stop" :class="addClasses(stop, i)">
|
<li v-for="(stop, i) in train.timetableData!.followingStops" :key="i" class="stop" :class="addClasses(stop, i)">
|
||||||
<span class="stop_info">
|
<span class="stop_info">
|
||||||
<div class="indicator"></div>
|
<div class="indicator"></div>
|
||||||
|
|
||||||
@@ -19,25 +54,25 @@ p<template>
|
|||||||
<stop-date :stop="stop" />
|
<stop-date :stop="stop" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="stop_line" v-if="i < followingStops.length - 1">
|
<div class="stop_line" v-if="i < train.timetableData!.followingStops.length - 1">
|
||||||
<div class="progress-bar"></div>
|
<div class="progress-bar"></div>
|
||||||
|
|
||||||
<div v-if="stop.comments" style="color: salmon;">
|
<div v-if="stop.comments" style="color: salmon">
|
||||||
<b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span>
|
<b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span v-if="stop.departureLine == followingStops[i + 1].arrivalLine">
|
<span v-if="stop.departureLine == train.timetableData!.followingStops[i + 1].arrivalLine">
|
||||||
{{ stop.departureLine }}
|
{{ stop.departureLine }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ stop.departureLine }} /
|
{{ stop.departureLine }} /
|
||||||
{{ followingStops[i + 1].arrivalLine }}
|
{{ train.timetableData!.followingStops[i + 1].arrivalLine }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stop_line" v-else>
|
<div class="stop_line" v-else>
|
||||||
<div v-if="stop.comments" style="color: salmon;">
|
<div v-if="stop.comments" style="color: salmon">
|
||||||
<b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span>
|
<b>{{ stop.stopNameRAW }} </b>: <span v-html="stop.comments"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,16 +83,17 @@ p<template>
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent } from '@vue/runtime-core';
|
import { computed, defineComponent, PropType } from '@vue/runtime-core';
|
||||||
import dateMixin from '@/mixins/dateMixin';
|
import dateMixin from '@/mixins/dateMixin';
|
||||||
import TrainStop from '@/scripts/interfaces/TrainStop';
|
import TrainStop from '@/scripts/interfaces/TrainStop';
|
||||||
import StopDate from '../Global/StopDate.vue';
|
import StopDate from '../Global/StopDate.vue';
|
||||||
|
import Train from '@/scripts/interfaces/Train';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { StopDate },
|
components: { StopDate },
|
||||||
props: {
|
props: {
|
||||||
followingStops: {
|
train: {
|
||||||
type: Array as () => TrainStop[],
|
type: Object as PropType<Train>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -75,20 +111,20 @@ export default defineComponent({
|
|||||||
setup(props) {
|
setup(props) {
|
||||||
return {
|
return {
|
||||||
lastConfirmed: computed(() => {
|
lastConfirmed: computed(() => {
|
||||||
return props.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
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
activeMinorStops: computed(() => {
|
activeMinorStops: computed(() => {
|
||||||
const lastMajorConfirmed = props.followingStops.findIndex(
|
const lastMajorConfirmed = props.train.timetableData!.followingStops.findIndex(
|
||||||
(stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed
|
(stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed
|
||||||
);
|
);
|
||||||
|
|
||||||
const activeMinorStopList: number[] = [];
|
const activeMinorStopList: number[] = [];
|
||||||
if (lastMajorConfirmed + 1 >= props.followingStops.length) return activeMinorStopList;
|
if (lastMajorConfirmed + 1 >= props.train.timetableData!.followingStops.length) return activeMinorStopList;
|
||||||
|
|
||||||
for (let i = lastMajorConfirmed + 1; i < props.followingStops.length; i++) {
|
for (let i = lastMajorConfirmed + 1; i < props.train.timetableData!.followingStops.length; i++) {
|
||||||
if (props.followingStops[i].stopNameRAW.includes('po.')) activeMinorStopList.push(i);
|
if (props.train.timetableData!.followingStops[i].stopNameRAW.includes('po.')) activeMinorStopList.push(i);
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +151,11 @@ export default defineComponent({
|
|||||||
'last-confirmed': index == this.lastConfirmed && !stop.terminatesHere,
|
'last-confirmed': index == this.lastConfirmed && !stop.terminatesHere,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onImageError(e: Event) {
|
||||||
|
const imageEl = e.target as HTMLImageElement;
|
||||||
|
imageEl.src = require('@/assets/unknown.png');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -138,13 +179,6 @@ $stopNameClr: #22a8d1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.train-schedule {
|
.train-schedule {
|
||||||
max-height: 500px;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
overflow-y: auto;
|
|
||||||
|
|
||||||
z-index: 5;
|
|
||||||
|
|
||||||
background-color: #202020;
|
background-color: #202020;
|
||||||
padding: 0 0.25em;
|
padding: 0 0.25em;
|
||||||
|
|
||||||
@@ -153,8 +187,31 @@ $stopNameClr: #22a8d1;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.train-stock {
|
||||||
|
padding: 0.25em 0.5em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
ul.stock-list {
|
||||||
|
display: flex;
|
||||||
|
align-items: end;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
|
||||||
|
li > div {
|
||||||
|
text-align: center;
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.schedule-wrapper {
|
.schedule-wrapper {
|
||||||
margin-left: 2.5rem;
|
overflow-y: auto;
|
||||||
|
max-height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 5;
|
||||||
|
|
||||||
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
@@ -204,6 +261,10 @@ $stopNameClr: #22a8d1;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.stop_list {
|
||||||
|
margin-left: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
ul.stop_list > li.stop {
|
ul.stop_list > li.stop {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
@click="toggleTimetable(train)"
|
@click="toggleTimetable(train)"
|
||||||
@keydown.enter="toggleTimetable(train)"
|
@keydown.enter="toggleTimetable(train)"
|
||||||
>
|
>
|
||||||
<TrainInfo :train="train" :simpleView="true" />
|
<TrainInfo :train="train" />
|
||||||
|
|
||||||
<train-schedule
|
<TrainSchedule
|
||||||
v-if="train.timetableData && chosenTrainId == getTrainId(train)"
|
v-if="train.timetableData && chosenTrainId == getTrainId(train)"
|
||||||
:followingStops="train.timetableData.followingStops"
|
:train="train"
|
||||||
ref="card-inner"
|
ref="card-inner"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user