mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
fix: reworked train stop statuses descriptions and their tooltip styles
This commit is contained in:
@@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
<span class="schedule-stop">
|
<span class="schedule-stop">
|
||||||
<span class="stop-connection">
|
<span class="stop-connection">
|
||||||
{{ row.arrivingLine }}
|
{{ row.currentElement.arrivalRouteExt }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="stop-time">
|
<span class="stop-time">
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="stop-connection">
|
<span class="stop-connection">
|
||||||
{{ row.departureLine }}
|
{{ row.currentElement.departureRouteExt }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -279,12 +279,9 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
checkpointStop: ct.checkpointStop,
|
checkpointStop: ct.checkpointStop,
|
||||||
train: ct.train,
|
train: ct.train,
|
||||||
prevDepartureLine: ct.previousSceneryElement?.departureRouteExt ?? null,
|
prevElement: ct.previousSceneryElement,
|
||||||
nextArrivalLine: ct.nextSceneryElement?.arrivalRouteExt ?? null,
|
nextElement: ct.nextSceneryElement,
|
||||||
departureLine: ct.timetablePathElement.departureRouteExt ?? null,
|
currentElement: ct.timetablePathElement,
|
||||||
arrivingLine: ct.timetablePathElement.arrivalRouteExt ?? null,
|
|
||||||
prevStationName: ct.previousSceneryElement?.stationName ?? null,
|
|
||||||
nextStationName: ct.nextSceneryElement?.stationName ?? null,
|
|
||||||
status: trainStopStatus
|
status: trainStopStatus
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<div class="general-status">
|
<div class="general-status">
|
||||||
<span
|
<span
|
||||||
:class="computedScheduledTrain.status"
|
:class="computedScheduledTrain.status"
|
||||||
:title="computedScheduledTrain.stopStatusDescription"
|
data-tooltip-type="HtmlTooltip"
|
||||||
|
:data-tooltip-content="computedScheduledTrain.stopStatusDescription"
|
||||||
|
@click.prevent="() => {}"
|
||||||
>
|
>
|
||||||
{{ computedScheduledTrain.stopStatusIndicator }}
|
{{ computedScheduledTrain.stopStatusIndicator }}
|
||||||
</span>
|
</span>
|
||||||
@@ -24,16 +26,16 @@ export default defineComponent({
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
computedScheduledTrain() {
|
computedScheduledTrain() {
|
||||||
const { prevDepartureLine, prevStationName, nextArrivalLine, nextStationName, status } =
|
const { status, prevElement, currentElement, nextElement } = this.sceneryTimetableRow;
|
||||||
this.sceneryTimetableRow;
|
|
||||||
|
|
||||||
const prevDepartureIndicator = prevDepartureLine
|
const prevDepartureIndicator = prevElement?.departureRouteExt
|
||||||
? `(${prevDepartureLine}) ${prevStationName}`
|
? `(${prevElement.departureRouteExt}) ${prevElement.stationName}`
|
||||||
: '---';
|
|
||||||
const nextArrivalIndicator = nextArrivalLine
|
|
||||||
? `(${nextArrivalLine}) ${nextStationName}`
|
|
||||||
: '---';
|
: '---';
|
||||||
|
|
||||||
|
const nextArrivalIndicator = nextElement?.arrivalRouteExt
|
||||||
|
? `(${nextElement.arrivalRouteExt}) ${nextElement.stationName}`
|
||||||
|
: `${currentElement.stationName}`;
|
||||||
|
|
||||||
let stopStatusDescription = '',
|
let stopStatusDescription = '',
|
||||||
stopStatusIndicator = '';
|
stopStatusIndicator = '';
|
||||||
|
|
||||||
@@ -41,34 +43,45 @@ export default defineComponent({
|
|||||||
case StopStatus.ARRIVING:
|
case StopStatus.ARRIVING:
|
||||||
stopStatusIndicator = `${this.$t('timetables.from')}: ${prevDepartureIndicator}`;
|
stopStatusIndicator = `${this.$t('timetables.from')}: ${prevDepartureIndicator}`;
|
||||||
stopStatusDescription = this.$t('timetables.desc-arriving', {
|
stopStatusDescription = this.$t('timetables.desc-arriving', {
|
||||||
prevStationName,
|
prevStationName: prevElement?.stationName ?? '',
|
||||||
prevDepartureLine
|
prevDepartureLine: prevElement?.departureRouteExt ?? ''
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StopStatus.ONLINE:
|
case StopStatus.ONLINE:
|
||||||
case StopStatus.STOPPED:
|
case StopStatus.STOPPED:
|
||||||
stopStatusIndicator = nextArrivalLine
|
stopStatusIndicator = nextElement?.arrivalRouteExt
|
||||||
? `${this.$t('timetables.to')}: ${nextArrivalIndicator}`
|
? `${this.$t('timetables.to')}: ${nextArrivalIndicator}`
|
||||||
: `${this.$t('timetables.desc-end')}`;
|
: `${this.$t('timetables.desc-end')}`;
|
||||||
stopStatusDescription = nextArrivalLine
|
stopStatusDescription = nextElement?.arrivalRouteExt
|
||||||
? this.$t(`timetables.desc-${status}`, { nextStationName, nextArrivalLine })
|
? this.$t(`timetables.desc-${status}`, {
|
||||||
|
nextStationName: nextElement?.stationName,
|
||||||
|
nextArrivalLine: nextElement?.arrivalRouteExt
|
||||||
|
})
|
||||||
: '';
|
: '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StopStatus.DEPARTED:
|
case StopStatus.DEPARTED:
|
||||||
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
||||||
stopStatusDescription = this.$t('timetables.desc-departed', {
|
|
||||||
nextStationName,
|
if (!nextElement?.stationName) {
|
||||||
nextArrivalLine
|
stopStatusDescription = this.$t('timetables.desc-departed-ends', {
|
||||||
});
|
nextStationName: currentElement.stationName
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
stopStatusDescription = this.$t('timetables.desc-departed', {
|
||||||
|
nextStationName: nextElement?.stationName ?? currentElement.stationName,
|
||||||
|
nextArrivalLine: nextElement?.arrivalRouteExt
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StopStatus.DEPARTED_AWAY:
|
case StopStatus.DEPARTED_AWAY:
|
||||||
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
||||||
stopStatusDescription = this.$t('timetables.desc-departed-away', {
|
stopStatusDescription = this.$t('timetables.desc-departed-away', {
|
||||||
nextStationName,
|
nextStationName: nextElement?.stationName,
|
||||||
nextArrivalLine
|
nextArrivalLine: nextElement?.arrivalRouteExt
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -93,6 +106,7 @@ export default defineComponent({
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.general-status {
|
.general-status {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
|
cursor: help;
|
||||||
|
|
||||||
span.arriving {
|
span.arriving {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import { StopStatus, Train, TrainStop } from '../../typings/common';
|
import { StopStatus, TimetablePathElement, Train, TrainStop } from '../../typings/common';
|
||||||
|
|
||||||
export interface SceneryTimetableRow {
|
export interface SceneryTimetableRow {
|
||||||
checkpointStop: TrainStop;
|
checkpointStop: TrainStop;
|
||||||
train: Train;
|
train: Train;
|
||||||
prevDepartureLine: string | null;
|
prevElement: TimetablePathElement | null;
|
||||||
nextArrivalLine: string | null;
|
nextElement: TimetablePathElement | null;
|
||||||
departureLine: string | null;
|
currentElement: TimetablePathElement;
|
||||||
arrivingLine: string | null;
|
|
||||||
prevStationName: string | null;
|
|
||||||
nextStationName: string | null;
|
|
||||||
status: StopStatus;
|
status: StopStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tooltip-content">
|
||||||
|
<span v-html="tooltipStore.content"></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { useTooltipStore } from '../../store/tooltipStore';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tooltipStore: useTooltipStore()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tooltip-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5em;
|
||||||
|
white-space: pre-line;
|
||||||
|
|
||||||
|
padding: 0.25em 0.5em;
|
||||||
|
border-radius: 0.25em;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
background-color: #1f1f1f;
|
||||||
|
box-shadow: 0 0 5px 2px #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
height: 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -12,11 +12,19 @@ import VehiclePreviewTooltip from './VehiclePreviewTooltip.vue';
|
|||||||
import BaseTooltip from './BaseTooltip.vue';
|
import BaseTooltip from './BaseTooltip.vue';
|
||||||
import SpawnsTooltip from './SpawnsTooltip.vue';
|
import SpawnsTooltip from './SpawnsTooltip.vue';
|
||||||
import UsersTooltip from './UsersTooltip.vue';
|
import UsersTooltip from './UsersTooltip.vue';
|
||||||
|
import HtmlTooltip from './HtmlTooltip.vue';
|
||||||
|
|
||||||
const BOX_PADDING_PX = 20;
|
const BOX_PADDING_PX = 20;
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { DonatorTooltip, VehiclePreviewTooltip, BaseTooltip, SpawnsTooltip, UsersTooltip },
|
components: {
|
||||||
|
DonatorTooltip,
|
||||||
|
VehiclePreviewTooltip,
|
||||||
|
BaseTooltip,
|
||||||
|
SpawnsTooltip,
|
||||||
|
UsersTooltip,
|
||||||
|
HtmlTooltip
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
+7
-6
@@ -543,12 +543,13 @@
|
|||||||
"terminates": "TERMINATES\nHERE",
|
"terminates": "TERMINATES\nHERE",
|
||||||
"from": "FROM",
|
"from": "FROM",
|
||||||
"to": "TO",
|
"to": "TO",
|
||||||
"desc-arriving": "The train is not here yet. It's going to come from: {prevStationName} (szlak {prevDepartureLine})",
|
"desc-arriving": "The train is not here yet.\nIt's going to come from: <b>{prevStationName} (route {prevDepartureLine})</b>",
|
||||||
"desc-online": "The train is at the station. It's going to leave to: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-online": "The train is at the station.\nIt's going to leave to: <b>{nextStationName} (route {nextArrivalLine})</b>",
|
||||||
"desc-stopped": "The train is at the station and is stopped. It's going to leave towards: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-stopped": "The train is at the station and is stopped.\nIt's going to leave towards: <b>{nextStationName} (route {nextArrivalLine})</b>",
|
||||||
"desc-next-arrival": "Leaves towards: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-next-arrival": "Leaves towards: <b>{nextStationName} (route {nextArrivalLine})</b>",
|
||||||
"desc-departed": "The train is at the station and it's been departed. Leaves towards: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-departed": "The train is at the station and it's been departed.\nLeaves towards: <b>{nextStationName} (route {nextArrivalLine})</b>",
|
||||||
"desc-departed-away": "The train has been departed to: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-departed-ends": "The train is at the station and it's been departed.\nLeaves towards station: <b>{nextStationName}</b>",
|
||||||
|
"desc-departed-away": "The train has been departed to:\n<b>{nextStationName} (route {nextArrivalLine})</b>",
|
||||||
"desc-end": "The train terminates here",
|
"desc-end": "The train terminates here",
|
||||||
"desc-terminated": "The train has been terminated"
|
"desc-terminated": "The train has been terminated"
|
||||||
},
|
},
|
||||||
|
|||||||
+7
-6
@@ -529,12 +529,13 @@
|
|||||||
"terminates": "KOŃCZY BIEG",
|
"terminates": "KOŃCZY BIEG",
|
||||||
"from": "Z",
|
"from": "Z",
|
||||||
"to": "DO",
|
"to": "DO",
|
||||||
"desc-arriving": "Pociągu nie ma jeszcze na tej scenerii. Przyjedzie z: {prevStationName} (szlak {prevDepartureLine})",
|
"desc-arriving": "Pociągu nie ma jeszcze na tej scenerii.\nPrzyjedzie z: <b>{prevStationName} (szlak {prevDepartureLine})</b>",
|
||||||
"desc-online": "Pociąg jest na tej scenerii. Odjedzie do: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-online": "Pociąg jest na tej scenerii.\nOdjedzie w kierunku: <b>{nextStationName} (szlak {nextArrivalLine})</b>",
|
||||||
"desc-stopped": "Pociąg jest na tej scenerii i odbywa postój. Odjedzie do: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-stopped": "Pociąg jest na tej scenerii i odbywa postój.\nOdjedzie w kierunku: <b>{nextStationName} (szlak {nextArrivalLine})</b>",
|
||||||
"desc-next-arrival": "Odjeżdża do: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-next-arrival": "Odjeżdża do:\n<b>{nextStationName} (szlak {nextArrivalLine})</b>",
|
||||||
"desc-departed": "Pociąg jest na tej scenerii i został odprawiony. Odjeżdża do: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-departed": "Pociąg jest na tej scenerii i został odprawiony.\nOdjeżdża w kierunku: <b>{nextStationName} (szlak {nextArrivalLine})</b>",
|
||||||
"desc-departed-away": "Pociąg został odprawiony i odjechał do: {nextStationName} (szlak {nextArrivalLine})",
|
"desc-departed-ends": "Pociąg jest na tej scenerii i został odprawiony.\nOdjechał w kierunku stacji: <b>{nextStationName}</b>",
|
||||||
|
"desc-departed-away": "Pociąg został odprawiony i odjechał do:\n<b>{nextStationName} (szlak {nextArrivalLine})</b>",
|
||||||
"desc-end": "Pociąg kończy bieg",
|
"desc-end": "Pociąg kończy bieg",
|
||||||
"desc-terminated": "Pociąg skończył bieg"
|
"desc-terminated": "Pociąg skończył bieg"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ export const tooltipKeys = [
|
|||||||
'BaseTooltip',
|
'BaseTooltip',
|
||||||
'VehiclePreviewTooltip',
|
'VehiclePreviewTooltip',
|
||||||
'SpawnsTooltip',
|
'SpawnsTooltip',
|
||||||
'UsersTooltip'
|
'UsersTooltip',
|
||||||
|
'HtmlTooltip'
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type TooltipType = (typeof tooltipKeys)[number];
|
export type TooltipType = (typeof tooltipKeys)[number];
|
||||||
|
|||||||
Reference in New Issue
Block a user