Implement day navigation gestures with Swiper.js

This commit is contained in:
2022-09-11 20:40:08 +02:00
parent 8d9bcee279
commit 4346aa23c5
19 changed files with 2966 additions and 2342 deletions

View File

@ -24,6 +24,12 @@ watch(language, (newValue) => {
location.reload();
});
// Set this to a positive or negative integer
// to change selectedDate by this number
export const changeDay = ref(0);
// Set this to jump to a specific date
export const changeDate = ref(new Date());
export const selectedDate = ref(new Date(new Date().setUTCHours(0, 0, 0, 0)));
export const selectedDay = computed(() => selectedDate.value.getDay() - 1);
// Jump to next Monday if it is weekend
@ -32,6 +38,14 @@ if (selectedDay.value == 5)
if (selectedDay.value == -1)
selectedDate.value = new Date(selectedDate.value.getTime() + 86400000);
// Load new data if date changes
watch(selectedDate, async () => {
loading.value = true;
await fetchSubstitutions();
await fetchHistory();
loading.value = false;
});
export const timetable = ref({ trusted: true });
export const substitutions = ref([]);
export const history = ref([]);