feat/restruct: saving timetables to local storage

This commit is contained in:
2025-01-30 21:52:17 +01:00
parent c334b5bfd3
commit 5f264e8b63
8 changed files with 385 additions and 71 deletions
@@ -0,0 +1,31 @@
<template>
<div>
<div v-if="globalStore.selectedStorageTimetable == null && Object.keys(globalStore.storageTimetables).length == 0">
<div class="font-bold text-xl">TRYB WYSZUKIWANA ZAPISANYCH ROZKŁADÓW JAZDY</div>
<div>Użyj funkcji zapisu rozkładu jazdy, aby go tutaj wyświetlić.</div>
</div>
<div v-else>
<ul class="flex flex-col gap-3">
<li v-for="timetable in globalStore.storageTimetables" class="text-left">
<button class="bg-zinc-900 p-2 w-full text-zinc-300 cursor-pointer hover:bg-zinc-800" @click="selectTimetable(timetable)">
<b>{{ timetable.category }} {{ timetable.trainNo }}</b> {{ timetable.route.replace('|', ' - ') }}
</button>
</li>
</ul>
</div>
</div>
</template>
<script setup lang="ts">
import { useGlobalStore } from '../../stores/global.store';
import type { TimetableData } from '../../types/common.types';
const globalStore = useGlobalStore();
function selectTimetable(timetable: TimetableData) {
globalStore.selectedStorageTimetable = timetable;
}
</script>
<style scoped></style>