Dodano szczegółowy rozkład pociągów

This commit is contained in:
2020-09-19 19:34:47 +02:00
parent e71a9e01f2
commit 0b4a32eeb2
14 changed files with 1064 additions and 683 deletions
+8 -10
View File
@@ -186,10 +186,10 @@ export default class StationCard extends styleMixin {
let stopStatus = "";
let stopLabel = "";
if (scheduledTrain.terminatesHere && scheduledTrain.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
else if (!scheduledTrain.terminatesHere && scheduledTrain.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && !scheduledTrain.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && scheduledTrain.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
if (scheduledTrain.stopInfo.terminatesHere && scheduledTrain.stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
else if (!scheduledTrain.stopInfo.terminatesHere && scheduledTrain.stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && !scheduledTrain.stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
else if (scheduledTrain.currentStationName == this.stationInfo.stationName && scheduledTrain.stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
else if (scheduledTrain.currentStationName != this.stationInfo.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
return {
@@ -223,13 +223,11 @@ export default class StationCard extends styleMixin {
}
.station-card {
scroll-behavior: smooth;
font-size: calc(0.5rem + 0.4vw);
max-width: 850px;
font-size: calc(0.5rem + 0.35vw);
max-width: 800px;
@include bigScreen {
font-size: 1.1rem;
font-size: 1rem;
}
@include smallScreen {
@@ -269,7 +267,7 @@ export default class StationCard extends styleMixin {
grid-template-areas: "main main" "icons icons" "dispatcher hours" "users spawns";
grid-template-columns: repeat(2, minmax(0, 1fr));
min-width: 200px;
max-height: 500px;
max-height: 600px;
transform: translateY(0%);
+1 -1
View File
@@ -126,7 +126,7 @@
/
<span
style="color:#bbb"
>{{ station.scheduledTrains.filter(train => train.confirmed).length }}</span>
>{{ station.scheduledTrains.filter(train => train.stopInfo.confirmed).length }}</span>
</span>
<span v-else>...</span>
@@ -33,29 +33,32 @@
<span class="timetable-schedule">
<span class="schedule-arrival">
<span class="arrival-time begins" v-if="scheduledTrain.beginsHere">ROZPOCZYNA BIEG</span>
<span
class="arrival-time begins"
v-if="scheduledTrain.stopInfo.beginsHere"
>ROZPOCZYNA BIEG</span>
<span
class="arrival-time"
v-else
>{{timestampToTime(scheduledTrain.arrivalTime)}} ({{scheduledTrain.arrivalDelay}})</span>
>{{scheduledTrain.stopInfo.arrivalTimeString}} ({{scheduledTrain.stopInfo.arrivalDelay}})</span>
</span>
<span class="schedule-stop">
<span
class="stop-time"
v-if="scheduledTrain.stopTime"
>{{scheduledTrain.stopTime}} {{scheduledTrain.stopType}}</span>
v-if="scheduledTrain.stopInfo.stopTime"
>{{scheduledTrain.stopInfo.stopTime}} {{scheduledTrain.stopInfo.stopType}}</span>
<span class="stop-arrow arrow"></span>
</span>
<span class="schedule-departure">
<span
class="departure-time terminates"
v-if="scheduledTrain.terminatesHere"
v-if="scheduledTrain.stopInfo.terminatesHere"
>KOŃCZY BIEG</span>
<span
class="departure-time"
v-else
>{{timestampToTime(scheduledTrain.departureTime)}} ({{scheduledTrain.departureDelay}})</span>
>{{scheduledTrain.stopInfo.departureTimeString}} ({{scheduledTrain.stopInfo.departureDelay}})</span>
</span>
</span>
</div>
@@ -67,6 +70,8 @@
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';
import Station from "@/scripts/interfaces/Station";
@Component
export default class StationTimetable extends Vue {
@Prop() readonly scheduledTrains;
@@ -74,17 +79,10 @@ export default class StationTimetable extends Vue {
get computedScheduledTrains() {
return this.scheduledTrains.sort((a, b) => {
if (a.arrivalTime > b.arrivalTime) return 1;
else if ((a.arrivalTime < b.arrivalTime)) return -1;
if (a.stopInfo.arrivalTimestamp > b.stopInfo.arrivalTimestamp) return 1;
else if ((a.stopInfo.arrivalTimestamp < b.stopInfo.arrivalTimestamp)) return -1;
return a.departureTime > b.departureTime ? 1 : -1;
})
}
timestampToTime(timestamp: number) {
return new Date(timestamp).toLocaleTimeString('pl-PL', {
hour: '2-digit',
minute: '2-digit',
return a.stopInfo.departureTimestamp > b.stopInfo.departureTimestamp ? 1 : -1;
})
}
}