diff --git a/src/App.vue b/src/App.vue index 6fa7915..d29169b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,13 +20,29 @@ const globalStore = useGlobalStore(); onMounted(() => { apiStore.setupAPIData(); - // Setup dark mode - globalStore.darkMode = - localStorage.currentTheme === 'dark' || (!('currentTheme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches); + setupDarkMode(); + loadStorageTimetables(); + setupAfterPrintClose(); }); -// Resetting after print dialog is closed -window.addEventListener('afterprint', () => { - document.title = originalDocumentTitle; -}); +function loadStorageTimetables() { + if (!window.localStorage.getItem('savedTimetables')) return; + + try { + globalStore.storageTimetables = JSON.parse(window.localStorage.getItem('savedTimetables')!); + } catch (error) { + alert('Ups! Coś poszło nie tak podczas pobierania zapisanych RJ!'); + } +} + +function setupDarkMode() { + globalStore.darkMode = + localStorage.currentTheme === 'dark' || (!('currentTheme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches); +} + +function setupAfterPrintClose() { + window.addEventListener('afterprint', () => { + document.title = originalDocumentTitle; + }); +} diff --git a/src/components/Timetable/TimetableBody.vue b/src/components/Timetable/TimetableBody.vue index 36530c8..1cac990 100644 --- a/src/components/Timetable/TimetableBody.vue +++ b/src/components/Timetable/TimetableBody.vue @@ -121,13 +121,13 @@ - + - + - +
{{ row.headLocos[0] }}{{ row.headUnits[0] }}
{{ row.headLocos[1] ?? ' ' }}{{ row.headUnits[1] ?? ' ' }}
{{ row.headLocos[2] ?? ' ' }}{{ row.headUnits[2] ?? ' ' }}
diff --git a/src/components/Timetable/TimetableSelect.vue b/src/components/Timetable/TimetableSelect.vue index 8647b3c..e7578eb 100644 --- a/src/components/Timetable/TimetableSelect.vue +++ b/src/components/Timetable/TimetableSelect.vue @@ -1,11 +1,23 @@ diff --git a/src/components/Timetable/TimetableStorage.vue b/src/components/Timetable/TimetableStorage.vue new file mode 100644 index 0000000..a4be18a --- /dev/null +++ b/src/components/Timetable/TimetableStorage.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/components/Timetable/TrainTimetable.vue b/src/components/Timetable/TrainTimetable.vue index 789ebbf..1953d8b 100644 --- a/src/components/Timetable/TrainTimetable.vue +++ b/src/components/Timetable/TrainTimetable.vue @@ -1,70 +1,68 @@