feat: router links embeded into timetable stop names

This commit is contained in:
2024-08-18 23:45:42 +02:00
parent 6bd62f13a1
commit 80a5b56785
6 changed files with 77 additions and 25 deletions
+9 -9
View File
@@ -165,20 +165,18 @@ export default defineComponent({
computed: {
scheduleStops(): TrainScheduleStop[] {
let currentSceneryIndex = 0;
if (!this.train.timetableData) return [];
const { timetablePath } = this.train.timetableData;
let currentPathIndex = 0;
return (
this.train.timetableData?.followingStops.map((stop, i, arr) => {
const isExternal =
i > 0 &&
stop.arrivalLine != null &&
(stop.arrivalLine != arr[i - 1].departureLine ||
(stop.arrivalLine == arr[i - 1].departureLine &&
!/-|_|(^it\d+)|(^sbl)/gi.test(stop.arrivalLine)));
i < arr.length - 1 &&
stop.departureLine === timetablePath[currentPathIndex].departureRouteExt;
if (isExternal) currentSceneryIndex++;
const sceneryName = this.train.timetableData!.sceneryNames[currentSceneryIndex];
const sceneryName = timetablePath[currentPathIndex].stationName;
const sceneryInfo = this.apiStore.sceneryData.find((st) => st.name == sceneryName);
const arrivalLineInfo = sceneryInfo?.routesInfo.find(
@@ -189,6 +187,8 @@ export default defineComponent({
(r) => r.routeName == stop.departureLine
);
if (isExternal) currentPathIndex++;
return {
nameHtml: stop.stopName,
nameRaw: stop.stopNameRAW,