mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 22:08:12 +00:00
fix: stop labels statuses
This commit is contained in:
@@ -8,15 +8,9 @@
|
|||||||
<span
|
<span
|
||||||
v-if="stop.position != 'begin'"
|
v-if="stop.position != 'begin'"
|
||||||
class="date arrival"
|
class="date arrival"
|
||||||
:data-status="
|
:data-status-delayed="stop.arrivalDelay > 0"
|
||||||
stop.arrivalDelay > 0 && stop.status != 'unconfirmed'
|
:data-status-preponed="stop.arrivalDelay < 0"
|
||||||
? 'delayed'
|
:data-status="stop.status"
|
||||||
: stop.arrivalDelay < 0 && stop.status != 'unconfirmed'
|
|
||||||
? 'preponed'
|
|
||||||
: stop.arrivalDelay == 0 && stop.status == 'confirmed'
|
|
||||||
? 'on-time'
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
p.
|
p.
|
||||||
<span v-if="stop.arrivalDelay != 0 && stop.status != 'unconfirmed'">
|
<span v-if="stop.arrivalDelay != 0 && stop.status != 'unconfirmed'">
|
||||||
@@ -31,10 +25,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="stop.duration"
|
||||||
stop.duration ||
|
|
||||||
(stop.status == 'stopped' && stop.position != 'begin' && stop.departureDelay > 0)
|
|
||||||
"
|
|
||||||
class="date stop"
|
class="date stop"
|
||||||
:data-stop-types="stop.type.replace(', ', '-')"
|
:data-stop-types="stop.type.replace(', ', '-')"
|
||||||
:data-stop-status="stop.departureDelay > 0 && !stop.duration ? 'delayed' : ''"
|
:data-stop-status="stop.departureDelay > 0 && !stop.duration ? 'delayed' : ''"
|
||||||
@@ -53,20 +44,12 @@
|
|||||||
(stop.duration != 0 || stop.status == 'stopped' || stop.departureDelay != stop.arrivalDelay)
|
(stop.duration != 0 || stop.status == 'stopped' || stop.departureDelay != stop.arrivalDelay)
|
||||||
"
|
"
|
||||||
class="date departure"
|
class="date departure"
|
||||||
:data-status="
|
:data-status-delayed="stop.departureDelay > 0"
|
||||||
stop.departureDelay > 0 && stop.status == 'confirmed'
|
:data-status-preponed="stop.departureDelay < 0"
|
||||||
? 'delayed'
|
:data-status-confirmed="stop.status == 'confirmed'"
|
||||||
: stop.departureDelay < 0 && stop.status == 'confirmed'
|
|
||||||
? 'preponed'
|
|
||||||
: stop.departureDelay == 0 && stop.status == 'confirmed'
|
|
||||||
? 'on-time'
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
o.
|
o.
|
||||||
<span
|
<span v-if="stop.departureDelay != 0 && stop.status == 'confirmed'">
|
||||||
v-if="stop.departureDelay != 0 && (stop.status == 'confirmed' || stop.status == 'stopped')"
|
|
||||||
>
|
|
||||||
<s>{{ timestampToString(stop.departureScheduled) }}</s>
|
<s>{{ timestampToString(stop.departureScheduled) }}</s>
|
||||||
{{ timestampToString(stop.departureReal) }}
|
{{ timestampToString(stop.departureReal) }}
|
||||||
|
|
||||||
@@ -105,6 +88,10 @@ $stopExchangeClr: #db8e29;
|
|||||||
$stopDefaultClr: #252525;
|
$stopDefaultClr: #252525;
|
||||||
$stopNameClr: #303030;
|
$stopNameClr: #303030;
|
||||||
|
|
||||||
|
s {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
.stop-label {
|
.stop-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -157,28 +144,45 @@ $stopNameClr: #303030;
|
|||||||
color: $delayedClr;
|
color: $delayedClr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.arrival,
|
.stop .arrival {
|
||||||
.departure {
|
&[data-status='confirmed'][data-status-delayed='true'] {
|
||||||
&[data-status='delayed'] {
|
|
||||||
s {
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: $delayedClr;
|
color: $delayedClr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-status='preponed'] {
|
&[data-status='confirmed'][data-status-preponed='true'] {
|
||||||
s {
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: $preponedClr;
|
color: $preponedClr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[data-status='stopped'][data-status-preponed='true'] {
|
||||||
|
span {
|
||||||
|
color: $preponedClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-status='stopped'][data-status-delayed='true'] {
|
||||||
|
span {
|
||||||
|
color: $delayedClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.stop .departure[data-status-confirmed='true'] {
|
||||||
|
&[data-status-delayed='true'] {
|
||||||
|
span {
|
||||||
|
color: $delayedClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-status-preponed='true'] {
|
||||||
|
span {
|
||||||
|
color: $preponedClr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -108,16 +108,19 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
currentDelay(stops: TrainStop[]) {
|
currentDelay(stops: TrainStop[]) {
|
||||||
const delay =
|
const lastConfirmedStop = stops.find(
|
||||||
stops.find(
|
|
||||||
(stop, i) =>
|
(stop, i) =>
|
||||||
(i == 0 && !stop.confirmed) || (i > 0 && stops[i - 1].confirmed && !stop.confirmed)
|
(i == 0 && !stop.confirmed) ||
|
||||||
)?.departureDelay || 0;
|
(i > 0 && stops[i - 1].confirmed && !stop.confirmed) ||
|
||||||
|
(stops[i + 1] == undefined && stop.confirmed)
|
||||||
|
);
|
||||||
|
|
||||||
if (delay > 0)
|
const lastDelay = lastConfirmedStop?.departureDelay ?? lastConfirmedStop?.arrivalDelay ?? 0;
|
||||||
return `<span style='color: salmon'>${this.$t('trains.delayed')} ${delay} min</span>`;
|
|
||||||
else if (delay < 0)
|
if (lastDelay > 0)
|
||||||
return `<span style='color: lightgreen'>${this.$t('trains.preponed')} ${delay} min</span>`;
|
return `<span style='color: salmon'>${this.$t('trains.delayed')} ${lastDelay} min</span>`;
|
||||||
|
else if (lastDelay < 0)
|
||||||
|
return `<span style='color: lightgreen'>${this.$t('trains.preponed')} ${lastDelay} min</span>`;
|
||||||
else return this.$t('trains.on-time');
|
else return this.$t('trains.on-time');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user