diff --git a/src/App.vue b/src/App.vue
index d8c5c37..cc8e55a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -4,7 +4,7 @@ import TitleBar from "./components/titlebar-element.vue";
import BottomNavbar from "./components/bottom-navbar.vue";
import DateSelector from "./components/date-selector.vue";
import LoadingElement from "./components/loading-element.vue";
-import { loading, theme } from "./store";
+import { loading, loadingProgress, theme } from "./store";
import { computed, ref } from "vue";
const autoThemes = { true: "dark", false: "light" };
@@ -31,10 +31,10 @@ const isDataView = computed(() => {
:class="theme == 'auto' ? `theme-${autoTheme}` : `theme-${theme}`"
>
-
+
-
+
diff --git a/src/assets/themes.css b/src/assets/themes.css
index 1096af7..5a85f9a 100644
--- a/src/assets/themes.css
+++ b/src/assets/themes.css
@@ -16,6 +16,7 @@
--bottomnav-active-color: #7ca74b;
--bottomnav-shadow: 5px 7px 19px 0px rgba(0, 0, 0, 0.25);
--loader-color: #7ca74b;
+ --loader-error-color: #a54a4a;
--substitution-background-change: #095079;
--substitution-background-cancellation: #7d2b2d;
--substitution-background-addition: #375c1d;
@@ -42,7 +43,8 @@
--bottomnav-icon-active-color: #456c47;
--bottomnav-active-color: #99b677;
--bottomnav-shadow: 5px 7px 19px 0px rgba(0, 0, 0, 0.25);
- --loader-color: #7ca74b;
+ --loader-color: #8bab7c;
+ --loader-error-color: #db5a5a;
--substitution-background-change: #9bb7c7;
--substitution-background-cancellation: #e4a7a9;
--substitution-background-addition: #b0d396;
diff --git a/src/components/day-carousel.vue b/src/components/day-carousel.vue
index fc0ab61..3b31d68 100644
--- a/src/components/day-carousel.vue
+++ b/src/components/day-carousel.vue
@@ -26,7 +26,11 @@ const loadedDates = ref([
// Load left or right date on slide change
function slideChange(swiper) {
- selectedDate.value = loadedDates.value[swiper.activeIndex];
+ // Only trigger data refresh if date is different
+ const newSelectedDate = loadedDates.value[swiper.activeIndex];
+ if (selectedDate.value.getTime() != newSelectedDate.getTime())
+ selectedDate.value = newSelectedDate;
+
const activeSlide = swiper.activeIndex;
if (activeSlide == loadedDates.value.length - 1) {
const lastDate = loadedDates.value[loadedDates.value.length - 1];
diff --git a/src/components/loading-element.vue b/src/components/loading-element.vue
index 6272b5e..47f8197 100644
--- a/src/components/loading-element.vue
+++ b/src/components/loading-element.vue
@@ -1,54 +1,73 @@
-
-
-
+
diff --git a/src/store.js b/src/store.js
index 1fe6a6e..79fb07c 100644
--- a/src/store.js
+++ b/src/store.js
@@ -5,6 +5,7 @@ import i18n from "./main";
export const lastRoute = ref();
export const loading = ref(false);
+export const loadingProgress = ref(0);
export const classFilter = ref(localStorage.getItem("classFilter") || "none");
export const timetableGroups = ref(
@@ -45,9 +46,12 @@ if (selectedDay.value == -1)
// Load new data if date changes
watch(selectedDate, async () => {
+ loadingProgress.value = 0.1;
loading.value = true;
await fetchSubstitutions();
+ loadingProgress.value = 1 / 2;
await fetchHistory();
+ loadingProgress.value = 1;
loading.value = false;
});
@@ -124,16 +128,22 @@ export const possibleTimetableGroups = computed(() => {
const baseUrl = import.meta.env.VITE_API_ENDPOINT || "/api";
export async function fetchData() {
+ loadingProgress.value = 0.1;
loading.value = true;
const checkResponse = await fetch(`${baseUrl}/check`);
if (checkResponse.status != 200) router.push("/login");
+ loadingProgress.value = 1 / 5;
await fetchClassList();
+ loadingProgress.value = 2 / 5;
await fetchTimetable();
+ loadingProgress.value = 3 / 5;
await fetchSubstitutions();
+ loadingProgress.value = 4 / 5;
await fetchHistory();
+ loadingProgress.value = 1;
loading.value = false;
}