From acb4f03b7f5c839de45438c9cef9ca9f4b68f7d8 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sun, 13 Sep 2020 23:54:12 +0200 Subject: [PATCH] =?UTF-8?q?Oznaczenia=20statusu=20postoju=20w=20sekcji=20m?= =?UTF-8?q?aszynist=C3=B3w=20na=20stacji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StationsView/StationCard.vue | 57 ++++++++++++++++--- .../StationsView/StationTimetable.vue | 56 +++++++++--------- src/store/store.ts | 7 ++- 3 files changed, 83 insertions(+), 37 deletions(-) diff --git a/src/components/StationsView/StationCard.vue b/src/components/StationsView/StationCard.vue index f85edba..ef2ee5e 100644 --- a/src/components/StationsView/StationCard.vue +++ b/src/components/StationsView/StationCard.vue @@ -124,9 +124,9 @@
- + @@ -156,6 +160,7 @@ import { Getter } from "vuex-class"; import styleMixin from "@/mixins/styleMixin"; import Station from "@/scripts/interfaces/Station"; +import Train from "@/scripts/interfaces/Train"; import StationTimetable from "@/components/StationsView/StationTimetable.vue"; @@ -167,7 +172,6 @@ import StationTimetable from "@/components/StationsView/StationTimetable.vue"; export default class StationCard extends styleMixin { @Prop() stationInfo!: Station; @Prop() exit!: void; - @Getter('getTrainList') trains; cardMode: number = 0; @@ -177,11 +181,34 @@ export default class StationCard extends styleMixin { : `${this.stationInfo.dispatcherExp}`; } + get computedScheduledTrains() { + return this.stationInfo.scheduledTrains.map(scheduledTrain => { + 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" } + else if (scheduledTrain.currentStationName != this.stationInfo.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" } + + return { + ...scheduledTrain, + stopStatus, + stopLabel + } + }) + } + get computedStationTrains() { - return this.stationInfo.stationTrains.map(stationTrain => ({ - ...stationTrain, - timetableData: this.trains.find(train => train.timetableData && train.trainNo === stationTrain.trainNo) - })) + return this.stationInfo.stationTrains.map(stationTrain => { + const scheduledData = this.computedScheduledTrains.find(scheduledTrain => scheduledTrain.trainNo === stationTrain.trainNo); + + return { + ...stationTrain, + stopStatus: scheduledData?.stopStatus || "no-timetable" + } + }) } } @@ -401,6 +428,22 @@ export default class StationCard extends styleMixin { pointer-events: none; } } + + &.departed { + border: 1px solid lime; + } + + &.stopped { + border: 1px solid #ffa600; + } + + &.online { + border: 1px solid gold; + } + + &.terminated { + border: 1px solid red; + } } } } diff --git a/src/components/StationsView/StationTimetable.vue b/src/components/StationsView/StationTimetable.vue index cf612db..ba8c65b 100644 --- a/src/components/StationsView/StationTimetable.vue +++ b/src/components/StationsView/StationTimetable.vue @@ -2,7 +2,7 @@
-
{{stationInfo.stationName.toUpperCase()}}
+
{{stationName.toUpperCase()}}
AKTYWNE ROZKŁADY JAZDY
@@ -26,28 +26,8 @@ - - Skończył bieg - - Odprawiony - - Na stacji - - W drodze - - Postój + + {{scheduledTrain.stopLabel}} @@ -87,15 +67,13 @@