From 63262ccf4a7995e1f5b435d3b1b7b720fa13f4ee Mon Sep 17 00:00:00 2001 From: Spythere Date: Sun, 22 Jun 2025 14:06:22 +0200 Subject: [PATCH] chore: added timetable bottom warnings info --- src/components/Timetable/TimetableContent.vue | 31 +++++++++++++++++++ src/utils/dateUtils.ts | 8 +++++ src/utils/trainUtils.ts | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/utils/dateUtils.ts diff --git a/src/components/Timetable/TimetableContent.vue b/src/components/Timetable/TimetableContent.vue index afc2f59..d93e713 100644 --- a/src/components/Timetable/TimetableContent.vue +++ b/src/components/Timetable/TimetableContent.vue @@ -305,6 +305,28 @@ + +
+ Kursuje: +
+ - {{ parseTimetableRunDate(computedTimetableRows[0].scheduledDepartureDate!) }} + + - + {{ + parseTimetableRunDate( + computedTimetableRows[computedTimetableRows.length - 1].scheduledArrivalDate! + ) + }} + +
+ +
+ Uwagi do rozkładu: +
- {{ timetableWarnings }}
+
+
@@ -313,6 +335,7 @@ import { computed } from 'vue'; import { useApiStore } from '../../stores/api.store'; import { useGlobalStore } from '../../stores/global.store'; import type { SceneryRoute, StopRow, TimetablePathData } from '../../types/common.types'; +import { parseTimetableRunDate } from '../../utils/dateUtils'; const globalStore = useGlobalStore(); const apiStore = useApiStore(); @@ -320,6 +343,14 @@ const apiStore = useApiStore(); // Tymczasowa tabelka z posterunkami APO const apoNames = ['Stary Kisielin, pe', 'Czerwony Dwór, pe', 'Szczejkowice, pe']; +const timetableWarnings = computed(() => { + const timetableData = globalStore.currentTimetableData; + + if (!timetableData) return ''; + + return timetableData.warningNotes; +}); + const computedTimetableRows = computed(() => { const timetableData = globalStore.currentTimetableData; diff --git a/src/utils/dateUtils.ts b/src/utils/dateUtils.ts new file mode 100644 index 0000000..ca76854 --- /dev/null +++ b/src/utils/dateUtils.ts @@ -0,0 +1,8 @@ +const romanMonthDigits = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII']; + +export function parseTimetableRunDate(date: Date) { + return `${date.getDate()}.${romanMonthDigits[date.getMonth()]}.${date + .getFullYear() + .toString() + .slice(2)}`; +} diff --git a/src/utils/trainUtils.ts b/src/utils/trainUtils.ts index 602a71b..80b7a33 100644 --- a/src/utils/trainUtils.ts +++ b/src/utils/trainUtils.ts @@ -42,4 +42,4 @@ export function getHeadUnits(stockString: string) { return acc; }, [] as string[]); -} +} \ No newline at end of file