fix: unable to use print mode when loading timetable using 'id' query parameter

This commit is contained in:
2025-04-27 18:00:55 +02:00
parent dc7d0a7ccc
commit f4aa0b28a1
2 changed files with 14 additions and 5 deletions
+3 -1
View File
@@ -53,7 +53,9 @@ function loadStorageTimetables() {
function setupDarkMode() { function setupDarkMode() {
globalStore.darkMode = globalStore.darkMode =
localStorage.currentTheme === 'dark' || (!('currentTheme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches); localStorage.currentTheme === 'dark' ||
(!('currentTheme' in localStorage) &&
window.matchMedia('(prefers-color-scheme: dark)').matches);
} }
function setupAfterPrintClose() { function setupAfterPrintClose() {
+11 -4
View File
@@ -123,6 +123,7 @@ import {
} from '@heroicons/vue/16/solid'; } from '@heroicons/vue/16/solid';
import { getRegionNameById } from '../../utils/trainUtils'; import { getRegionNameById } from '../../utils/trainUtils';
import type { TimetableData, ViewMode } from '../../types/common.types'; import type { TimetableData, ViewMode } from '../../types/common.types';
import { watch } from 'vue';
// Stores // Stores
const apiStore = useApiStore(); const apiStore = useApiStore();
@@ -137,6 +138,16 @@ const isTimetableSaved = computed(() => {
); );
}); });
// Watchers
watch(
() => globalStore.selectedActiveTrain,
(curr) => {
if (curr != null) {
globalStore.generatedDate = new Date();
}
}
);
// Methods // Methods
function selectTrain() { function selectTrain() {
if (!apiStore.activeData) return; if (!apiStore.activeData) return;
@@ -144,10 +155,6 @@ function selectTrain() {
globalStore.selectedActiveTrain = globalStore.selectedActiveTrain =
globalStore.activeTimetableTrains.find((train) => train.id == globalStore.selectedTrainId) ?? globalStore.activeTimetableTrains.find((train) => train.id == globalStore.selectedTrainId) ??
null; null;
if (globalStore.selectedActiveTrain != null) {
globalStore.generatedDate = new Date();
}
} }
function toggleViewMode(viewMode: ViewMode) { function toggleViewMode(viewMode: ViewMode) {