Compare commits

..

10 Commits

Author SHA1 Message Date
Spythere 0ac7ba51e5 Merge pull request #100 from Spythere/development
v1.25.2
2024-07-12 16:13:06 +02:00
Spythere bdf85cd8ec bump: 1.25.2 2024-07-12 16:01:45 +02:00
Spythere 63b268d9b9 feat: added journal timetable path 2024-07-12 15:59:08 +02:00
Spythere d73c8ef112 fix: update modal won't open on first visit 2024-07-12 15:11:17 +02:00
Spythere 3d1c66b420 fix: cache control 2024-07-12 14:50:01 +02:00
Spythere b3f7108979 fix: detecting podg in timetables 2024-07-12 13:58:43 +02:00
Spythere feabfd29e0 Merge pull request #99 from Spythere/development
fix: recognizing timetables for sceneries with the same stop names
2024-07-09 20:33:16 +02:00
Spythere f17fedc976 fix: recognizing timetables for sceneries with the same stop names; optimization 2024-07-09 19:15:04 +02:00
Spythere c83c75e014 Merge pull request #98 from Spythere/development
hotfix: thumbnails v2 src
2024-07-08 22:12:41 +02:00
Spythere e57143f517 hotfix: thumbnails v2 src 2024-07-08 22:12:05 +02:00
10 changed files with 152 additions and 108 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "stacjownik", "name": "stacjownik",
"version": "1.25.1", "version": "1.25.2",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+2 -1
View File
@@ -131,7 +131,8 @@ export default defineComponent({
}; };
this.isUpdateCardOpen = this.isUpdateCardOpen =
storageVersion != version || import.meta.env.VITE_UPDATE_TEST === 'test'; (storageVersion != '' && storageVersion != version) ||
import.meta.env.VITE_UPDATE_TEST === 'test';
} catch (error) { } catch (error) {
console.error(`Wystąpił błąd podczas pobierania danych z API GitHuba: ${error}`); console.error(`Wystąpił błąd podczas pobierania danych z API GitHuba: ${error}`);
} }
+1 -1
View File
@@ -16,7 +16,7 @@
:data-mouseover="vehicleName" :data-mouseover="vehicleName"
data-tooltip-type="VehiclePreviewTooltip" data-tooltip-type="VehiclePreviewTooltip"
:data-tooltip-content="vehicleName" :data-tooltip-content="vehicleName"
:src="`https://static.spythere.eu/thumbnails/${thumbnailImage}.png`" :src="`https://static.spythere.eu/thumbnails/v2/${thumbnailImage}.png`"
@error="onImageError($event, imagesFallbacks[imageIndex])" @error="onImageError($event, imagesFallbacks[imageIndex])"
@click.stop="() => {}" @click.stop="() => {}"
height="60" height="60"
@@ -1,5 +1,6 @@
<template> <template>
<div class="stop-list" v-if="showExtraInfo == true"> <div class="timetable-stops">
<div class="stop-list">
<span <span
v-for="(stop, i) in timetableStops.filter((_, i) => v-for="(stop, i) in timetableStops.filter((_, i) =>
!showExtraInfo ? i == 0 || i == timetableStops.length - 1 : true !showExtraInfo ? i == 0 || i == timetableStops.length - 1 : true
@@ -19,6 +20,23 @@
<span v-html="stop.html"></span> <span v-html="stop.html"></span>
</span> </span>
</div> </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 }} &RightArrow; </span>
<b class="path-scenery">{{ pathData.sceneryName }}</b>
<span class="path-departure" v-if="pathData.departure">
&RightArrow; {{ pathData.departure }}&nbsp;
</span>
</span>
</div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -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>
@@ -238,11 +238,12 @@ export default defineComponent({
sceneryTimetables(): SceneryTimetableRow[] { sceneryTimetables(): SceneryTimetableRow[] {
if (!this.onlineScenery) return []; if (!this.onlineScenery) return [];
const sceneryName = this.$route.query['station']?.toString() ?? ''; const sceneryName = this.$route.query['station']?.toString().replace(/_/g, ' ') ?? '';
return this.onlineScenery.scheduledTrains return this.onlineScenery.scheduledTrains
.filter( .filter(
(ct) => (ct) =>
ct.timetablePathElement.stationName == sceneryName &&
ct.train.region == this.mainStore.region.id && ct.train.region == this.mainStore.region.id &&
this.chosenCheckpoint && this.chosenCheckpoint &&
ct.checkpointStop.stopNameRAW.toLowerCase() == this.chosenCheckpoint.toLowerCase() ct.checkpointStop.stopNameRAW.toLowerCase() == this.chosenCheckpoint.toLowerCase()
@@ -251,75 +252,18 @@ export default defineComponent({
const trainStopStatus = getTrainStopStatus( const trainStopStatus = getTrainStopStatus(
ct.checkpointStop, ct.checkpointStop,
ct.train.currentStationName, ct.train.currentStationName,
sceneryName.replace(/_/g, ' ') sceneryName
); );
const trainStopIndex =
ct.train.timetableData?.followingStops.findIndex(
(stop) => stop.stopName == ct.checkpointStop.stopName
) ?? -1;
let prevStationName = '',
nextStationName = '';
let departureLine: string | null = null;
let arrivingLine: string | null = null;
let prevDepartureLine: string | null = null,
nextArrivalLine: string | null = null;
if (trainStopIndex > -1 && ct.train.timetableData?.followingStops !== undefined) {
for (let i = trainStopIndex; i >= 0; i--) {
const stop = ct.train.timetableData.followingStops[i];
if (
/strong|podg\.|pe\./g.test(stop.stopName) &&
!prevStationName &&
i <= trainStopIndex - 1
)
prevStationName = stop.stopNameRAW.replace(/,.*/g, '');
if (
stop.arrivalLine != null &&
!arrivingLine &&
!/-|_|it|sbl/gi.test(stop.arrivalLine)
) {
arrivingLine = stop.arrivalLine;
prevDepartureLine =
ct.train.timetableData.followingStops[i - 1]?.departureLine || null;
}
}
for (let i = trainStopIndex; i < ct.train.timetableData.followingStops.length; i++) {
const stop = ct.train.timetableData.followingStops[i];
if (
/strong|podg\.|pe\./g.test(stop.stopName) &&
!nextStationName &&
i > trainStopIndex
)
nextStationName = stop.stopNameRAW.replace(/,.*/g, '');
if (
stop.departureLine &&
!departureLine &&
!/-|_|it|sbl/gi.test(stop.departureLine)
) {
departureLine = stop.departureLine;
nextArrivalLine = ct.train.timetableData.followingStops[i + 1]?.arrivalLine || null;
}
}
}
return { return {
checkpointStop: ct.checkpointStop, checkpointStop: ct.checkpointStop,
train: ct.train, train: ct.train,
prevDepartureLine, prevDepartureLine: ct.previousSceneryElement?.departureRouteExt ?? null,
nextArrivalLine, nextArrivalLine: ct.nextSceneryElement?.arrivalRouteExt ?? null,
departureLine, departureLine: ct.timetablePathElement.departureRouteExt ?? null,
arrivingLine, arrivingLine: ct.timetablePathElement.arrivalRouteExt ?? null,
prevStationName, prevStationName: ct.previousSceneryElement?.stationName ?? null,
nextStationName, nextStationName: ct.nextSceneryElement?.stationName ?? null,
status: trainStopStatus status: trainStopStatus
}; };
}) })
+6
View File
@@ -51,6 +51,12 @@ export const useApiStore = defineStore('apiStore', {
// Static data // Static data
this.fetchDonatorsData(); this.fetchDonatorsData();
this.fetchStationsGeneralInfo(); this.fetchStationsGeneralInfo();
// Ponowne pobieranie danych po ServiceWorkerze
setTimeout(() => {
this.fetchStationsGeneralInfo();
}, Math.floor(Math.random() * 500) + 1000);
this.fetchVehiclesInfo(); this.fetchVehiclesInfo();
}, },
+36 -6
View File
@@ -96,7 +96,17 @@ export const useMainStore = defineStore('mainStore', {
followingStops: timetable.stopList, followingStops: timetable.stopList,
routeDistance: timetable.stopList[timetable.stopList.length - 1].stopDistance, routeDistance: timetable.stopList[timetable.stopList.length - 1].stopDistance,
sceneries: timetable.sceneries, sceneries: timetable.sceneries,
sceneryNames: sceneryNames.reverse() sceneryNames: sceneryNames.reverse(),
timetablePath: timetable.path.split(';').map((pathElementString) => {
const [arrival, station, departure] = pathElementString.split(',');
return {
arrivalRouteExt: arrival,
departureRouteExt: departure,
stationName: station.split(' ').slice(0, -1).join(' '),
stationHash: station.split(' ').slice(-1).join(' ')
};
})
} }
: undefined : undefined
} as Train; } as Train;
@@ -110,11 +120,25 @@ export const useMainStore = defineStore('mainStore', {
} else sceneriesTrains.set(train.currentStationName, [trainObj]); } else sceneriesTrains.set(train.currentStationName, [trainObj]);
// Checkpoints trains map // Checkpoints trains map
timetable?.stopList.forEach((stop, i) => { if (trainObj.timetableData) {
if (/strong|podg\.|pe\./.test(stop.stopName)) { let currentSceneryIndex = 0;
const timetablePath = trainObj.timetableData.timetablePath;
trainObj.timetableData.followingStops.forEach((stop, i) => {
if (/strong|podg|pe/.test(stop.stopName)) {
const checkpointTrain: CheckpointTrain = { const checkpointTrain: CheckpointTrain = {
train: trainObj, train: trainObj,
checkpointStop: stop checkpointStop: stop,
previousSceneryElement:
currentSceneryIndex > 0 ? timetablePath[currentSceneryIndex - 1] : null,
nextSceneryElement:
currentSceneryIndex < timetablePath.length - 1
? timetablePath[currentSceneryIndex + 1]
: null,
timetablePathElement: timetablePath[currentSceneryIndex]
}; };
if (checkpointsTrains.has(stop.stopNameRAW.toLowerCase())) { if (checkpointsTrains.has(stop.stopNameRAW.toLowerCase())) {
@@ -124,7 +148,11 @@ export const useMainStore = defineStore('mainStore', {
]); ]);
} else checkpointsTrains.set(stop.stopNameRAW.toLowerCase(), [checkpointTrain]); } else checkpointsTrains.set(stop.stopNameRAW.toLowerCase(), [checkpointTrain]);
} }
if (timetablePath[currentSceneryIndex].departureRouteExt == stop.departureLine)
currentSceneryIndex++;
}); });
}
return trainObj; return trainObj;
}); });
@@ -252,8 +280,10 @@ export const useMainStore = defineStore('mainStore', {
if (!scheduledTrains) return; if (!scheduledTrains) return;
scheduledTrains.forEach(({ train, checkpointStop }) => { scheduledTrains.forEach(({ train, checkpointStop, timetablePathElement, ...v }) => {
scenery.scheduledTrains.push({ train, checkpointStop }); if (scenery.name != timetablePathElement.stationName) return;
scenery.scheduledTrains.push({ train, checkpointStop, timetablePathElement, ...v });
if (uniqueTrainIds.includes(train.id) || train.region != this.region.id) return; if (uniqueTrainIds.includes(train.id) || train.region != this.region.id) return;
+4 -4
View File
@@ -195,6 +195,8 @@ export namespace API {
TWR: boolean; TWR: boolean;
SKR: boolean; SKR: boolean;
sceneries: string[]; sceneries: string[];
path: string;
} }
} }
@@ -249,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[];
+11
View File
@@ -39,6 +39,13 @@ export interface RegionCounters {
timetablesCount: number; timetablesCount: number;
} }
export interface TimetablePathElement {
arrivalRouteExt?: string;
departureRouteExt?: string;
stationName: string;
stationHash: string;
}
export interface Train { export interface Train {
id: string; id: string;
modalId: string; modalId: string;
@@ -73,6 +80,7 @@ export interface Train {
routeDistance: number; routeDistance: number;
sceneries: string[]; sceneries: string[];
sceneryNames: string[]; sceneryNames: string[];
timetablePath: TimetablePathElement[];
}; };
} }
@@ -188,6 +196,9 @@ export interface TrainStop {
export interface CheckpointTrain { export interface CheckpointTrain {
checkpointStop: TrainStop; checkpointStop: TrainStop;
train: Train; train: Train;
timetablePathElement: TimetablePathElement;
previousSceneryElement: TimetablePathElement | null;
nextSceneryElement: TimetablePathElement | null;
} }
// Vehicles Data // Vehicles Data