mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
feat: router links embeded into timetable stop names
This commit is contained in:
@@ -214,6 +214,12 @@ export default defineComponent({
|
||||
this.loadSelectedOption();
|
||||
},
|
||||
|
||||
watch: {
|
||||
station() {
|
||||
this.loadSelectedOption();
|
||||
}
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
const route = useRoute();
|
||||
const currentURL = computed(() => `${location.origin}${route.fullPath}`);
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
class="stop-label"
|
||||
:data-minor="stop.isSBL || (stop.nameRaw.endsWith(', po.') && !stop.duration)"
|
||||
>
|
||||
<span class="name" v-html="stop.nameHtml"></span>
|
||||
<router-link :to="`/scenery?station=${stop.sceneryName}`" @click="closeModal">
|
||||
<span class="name" v-html="stop.nameHtml"></span>
|
||||
</router-link>
|
||||
|
||||
<span
|
||||
v-if="stop.position != 'begin'"
|
||||
@@ -67,9 +69,10 @@
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { TrainScheduleStop } from './TrainSchedule.vue';
|
||||
import modalTrainMixin from '../../mixins/modalTrainMixin';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin],
|
||||
mixins: [dateMixin, modalTrainMixin],
|
||||
|
||||
props: {
|
||||
stop: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user