restruct: divide logic and layout into components

This commit is contained in:
2025-01-27 18:25:05 +01:00
parent 5c6910df63
commit 8c7ffc7913
10 changed files with 554 additions and 502 deletions
+18 -2
View File
@@ -1,7 +1,23 @@
import { defineStore } from 'pinia';
import { useApiStore } from './api.store';
import type { ActiveTrain } from '../types/common.types';
export const useGlobalStore = defineStore('global', {
state: () => ({}),
getters: {},
state: () => ({
selectedTrain: null as ActiveTrain | null,
generatedDate: null as Date | null,
generatedMs: 0,
}),
getters: {
activeTimetableTrains() {
const apiStore = useApiStore();
if (!apiStore.activeData) return [];
return apiStore.activeData.trains.filter((train) => train.timetable).sort((t1, t2) => t1.driverName.localeCompare(t2.driverName, 'pl-PL'));
},
},
actions: {},
});