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] ?? ' ' }} |