mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Optymalizacja listy pociągów; dodatkowe informacje o uwagach ekspl.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<ul class="train-list">
|
<ul class="train-list">
|
||||||
<li
|
<li
|
||||||
class="train-row"
|
class="train-row"
|
||||||
v-for="(train) in computedTrains.filter((_, i) => i < 10)"
|
v-for="train in computedTrains.filter((_, i) => i < 10)"
|
||||||
:key="train.trainNo + train.driverId"
|
:key="train.trainNo + train.driverId"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@keydown.enter="changeScheduleShowState(train.timetableData?.timetableId)"
|
@keydown.enter="changeScheduleShowState(train.timetableData?.timetableId)"
|
||||||
@@ -80,8 +80,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="info_comments" v-if="hasTimetableComments(train.timetableData)">
|
<div class="info_comments" v-if="getSceneriesWithComments(train.timetableData).length > 0">
|
||||||
<img :src="icons.warning" :title="$t('trains.timetable-comments')" />
|
<img
|
||||||
|
:src="icons.warning"
|
||||||
|
:title="
|
||||||
|
`${$t('trains.timetable-comments')} (${getSceneriesWithComments(train.timetableData).join(',')})`
|
||||||
|
"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -107,10 +112,14 @@
|
|||||||
|
|
||||||
<span v-else>{{ displayLocoInfo(train.locoType) }}</span>
|
<span v-else>{{ displayLocoInfo(train.locoType) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<img v-if="defaultVehicleIcons.includes(train.locoType)" class="train-image" :src="defaultLocoImage" alt="default vehicle">
|
|
||||||
<img v-else class="train-image" :src="train.locoURL" :alt="train.locoType" @error="onImageError" />
|
|
||||||
|
|
||||||
|
<img
|
||||||
|
v-if="defaultVehicleIcons.includes(train.locoType)"
|
||||||
|
class="train-image"
|
||||||
|
:src="defaultLocoImage"
|
||||||
|
alt="default vehicle"
|
||||||
|
/>
|
||||||
|
<img v-else class="train-image" :src="train.locoURL" :alt="train.locoType" @error="onImageError" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -153,7 +162,7 @@
|
|||||||
import { computed, ComputedRef, defineComponent, Ref, ref } from '@vue/runtime-core';
|
import { computed, ComputedRef, defineComponent, Ref, ref } from '@vue/runtime-core';
|
||||||
import { useStore } from '@/store';
|
import { useStore } from '@/store';
|
||||||
|
|
||||||
import defaultVehicleIconsJSON from "@/data/defaultVehicleIcons.json";
|
import defaultVehicleIconsJSON from '@/data/defaultVehicleIcons.json';
|
||||||
|
|
||||||
import Train from '@/scripts/interfaces/Train';
|
import Train from '@/scripts/interfaces/Train';
|
||||||
import TrainStop from '@/scripts/interfaces/TrainStop';
|
import TrainStop from '@/scripts/interfaces/TrainStop';
|
||||||
@@ -251,7 +260,7 @@ export default defineComponent({
|
|||||||
() =>
|
() =>
|
||||||
props.computedTrains.findIndex(({ timetableData }) => timetableData && timetableData.routeDistance > 200) !=
|
props.computedTrains.findIndex(({ timetableData }) => timetableData && timetableData.routeDistance > 200) !=
|
||||||
-1
|
-1
|
||||||
)
|
),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -342,8 +351,14 @@ export default defineComponent({
|
|||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
|
|
||||||
hasTimetableComments(timetableData: Train['timetableData']) {
|
getSceneriesWithComments(timetableData: Train['timetableData']) {
|
||||||
return timetableData?.followingStops.some((stop) => stop.comments) || false;
|
return (
|
||||||
|
timetableData?.followingStops.reduce((acc, stop) => {
|
||||||
|
if (stop.comments) acc.push(stop.stopNameRAW);
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, [] as string[]) || []
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user