🚸 ♻️ Refactor store and improve UX
- Move view related functions out of the store - Restructure the store.js file - Improve error handling of `/check` - Show red loading spinner if data fetch failed - Prefetch current, next and previous day instead of only current - Refactor some other frontend file
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { substitutionsForDate } from "../store";
|
||||
import { substitutions } from "../store";
|
||||
import { getSubstitutionText, getSubstitutionColor } from "../util";
|
||||
import { computed } from "vue";
|
||||
|
||||
@ -9,13 +9,13 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const substitutions = computed(() => {
|
||||
return substitutionsForDate.value[props.date.setUTCHours(0, 0, 0, 0)];
|
||||
const substitutionsForDate = computed(() => {
|
||||
return substitutions.value[props.date.getTime()];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-for="substitution in substitutions" :key="substitution">
|
||||
<template v-for="substitution in substitutionsForDate" :key="substitution">
|
||||
<div class="substitution" :style="getSubstitutionColor(substitution)">
|
||||
<span class="hour">{{ substitution.lesson }}</span>
|
||||
<div class="infos">
|
||||
|
Reference in New Issue
Block a user