mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
feat: added journal timetable path
This commit is contained in:
@@ -1,23 +1,41 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stop-list" v-if="showExtraInfo == true">
|
<div class="timetable-stops">
|
||||||
<span
|
<div class="stop-list">
|
||||||
v-for="(stop, i) in timetableStops.filter((_, i) =>
|
<span
|
||||||
!showExtraInfo ? i == 0 || i == timetableStops.length - 1 : true
|
v-for="(stop, i) in timetableStops.filter((_, i) =>
|
||||||
)"
|
!showExtraInfo ? i == 0 || i == timetableStops.length - 1 : true
|
||||||
class="stop-list-item"
|
)"
|
||||||
:key="stop.stopName"
|
class="stop-list-item"
|
||||||
:data-confirmed="stop.confirmed"
|
:key="stop.stopName"
|
||||||
>
|
:data-confirmed="stop.confirmed"
|
||||||
<span v-if="i > 0">
|
>
|
||||||
>
|
<span v-if="i > 0">
|
||||||
<span v-if="!showExtraInfo && i == 1 && timetableStops.length > 2">
|
>
|
||||||
... (+{{ timetableStops.length - 2 }}) >
|
<span v-if="!showExtraInfo && i == 1 && timetableStops.length > 2">
|
||||||
|
... (+{{ timetableStops.length - 2 }}) >
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="stop-name">{{ stop.stopName }}</span>
|
||||||
|
<span v-html="stop.html"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="path-details" v-if="showExtraInfo && timetablePathDetails">
|
||||||
|
<span
|
||||||
|
v-for="(pathData, i) in timetablePathDetails"
|
||||||
|
:data-visited="pathData.isVisited"
|
||||||
|
:data-next-visited="
|
||||||
|
i < timetablePathDetails.length - 1 && timetablePathDetails[i + 1].isVisited
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<span class="path-arrival" v-if="pathData.arrival">/ {{ pathData.arrival }} → </span>
|
||||||
|
<b class="path-scenery">{{ pathData.sceneryName }}</b>
|
||||||
|
<span class="path-departure" v-if="pathData.departure">
|
||||||
|
→ {{ pathData.departure }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
<span class="stop-name">{{ stop.stopName }}</span>
|
|
||||||
<span v-html="stop.html"></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,6 +60,24 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
timetablePathDetails() {
|
||||||
|
if (!this.timetable.path || this.timetable.path == '') return null;
|
||||||
|
|
||||||
|
return this.timetable.path.split(';').map((pathEl, i) => {
|
||||||
|
const [arrival, name, departure] = pathEl.split(',');
|
||||||
|
const sceneryName = name.split(' ').slice(0, -1).join(' ');
|
||||||
|
const sceneryHash = name.split(' ').pop()?.replace('.sc', '') ?? '';
|
||||||
|
|
||||||
|
return {
|
||||||
|
arrival,
|
||||||
|
sceneryName,
|
||||||
|
sceneryHash,
|
||||||
|
departure,
|
||||||
|
isVisited: this.timetable.visitedSceneries?.includes(sceneryHash) ?? false
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
timetableStops() {
|
timetableStops() {
|
||||||
const timetable = this.timetable;
|
const timetable = this.timetable;
|
||||||
|
|
||||||
@@ -94,13 +130,14 @@ export default defineComponent({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.stop-list {
|
.timetable-stops {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
gap: 0.25em;
|
gap: 0.25em;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
|
|
||||||
color: #adadad;
|
color: #adadad;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stop-list {
|
||||||
&-item[data-confirmed='true'] {
|
&-item[data-confirmed='true'] {
|
||||||
color: lightgreen;
|
color: lightgreen;
|
||||||
|
|
||||||
@@ -109,4 +146,19 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.path-details {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-details > span[data-visited='true'] {
|
||||||
|
.path-arrival,
|
||||||
|
.path-scenery {
|
||||||
|
color: lightgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-next-visited='true'] .path-departure {
|
||||||
|
color: lightgreen;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+3
-5
@@ -195,7 +195,7 @@ export namespace API {
|
|||||||
TWR: boolean;
|
TWR: boolean;
|
||||||
SKR: boolean;
|
SKR: boolean;
|
||||||
sceneries: string[];
|
sceneries: string[];
|
||||||
|
|
||||||
path: string;
|
path: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,16 +251,14 @@ export namespace API {
|
|||||||
hashesString?: string;
|
hashesString?: string;
|
||||||
currentSceneryName?: string;
|
currentSceneryName?: string;
|
||||||
currentSceneryHash?: string;
|
currentSceneryHash?: string;
|
||||||
|
|
||||||
routeSceneries?: string;
|
routeSceneries?: string;
|
||||||
|
|
||||||
checkpointArrivals?: string[];
|
checkpointArrivals?: string[];
|
||||||
checkpointDepartures?: string[];
|
checkpointDepartures?: string[];
|
||||||
|
|
||||||
checkpointArrivalsScheduled?: string[];
|
checkpointArrivalsScheduled?: string[];
|
||||||
checkpointDeparturesScheduled?: string[];
|
checkpointDeparturesScheduled?: string[];
|
||||||
|
|
||||||
checkpointStopTypes?: string[];
|
checkpointStopTypes?: string[];
|
||||||
|
visitedSceneries?: string[];
|
||||||
|
path: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Response = Data[];
|
export type Response = Data[];
|
||||||
|
|||||||
Reference in New Issue
Block a user