+
-
-
+
+
@@ -44,6 +55,7 @@ body {
.center {
display: flex;
justify-content: center;
+ min-height: 100vh;
}
main {
diff --git a/src/components/date-selector.vue b/src/components/date-selector.vue
index 8925d48..a57e4bf 100644
--- a/src/components/date-selector.vue
+++ b/src/components/date-selector.vue
@@ -1,13 +1,8 @@
diff --git a/src/main.js b/src/main.js
index 9dbaf23..2139d59 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,6 +5,7 @@ import { registerSW } from "virtual:pwa-register";
import { createI18n } from "vue-i18n";
import { strings } from "./strings";
import { language } from "./store";
+import Vue3TouchEvents from "vue3-touch-events";
const i18n = createI18n({
locale: language.value,
@@ -16,6 +17,7 @@ const app = createApp(App);
app.use(router);
app.use(i18n);
+app.use(Vue3TouchEvents);
app.mount("#app");
diff --git a/src/util.js b/src/util.js
index 6254519..d875204 100644
--- a/src/util.js
+++ b/src/util.js
@@ -1,4 +1,11 @@
-import { classFilter } from "./store";
+import {
+ classFilter,
+ fetchSubstitutions,
+ fetchHistory,
+ loading,
+ selectedDate,
+} from "./store";
+import dayjs from "dayjs";
export function getSubstitutionText(substitution) {
const includeClass = !classFilter.value || classFilter.value == "none";
@@ -22,3 +29,23 @@ export function getSubstitutionColor(substitution) {
return "background-color: var(--substitution-background-cancellation);";
}
}
+
+export function nextDay() {
+ var newDate = dayjs(selectedDate.value).add(1, "day");
+ // Skip weekend
+ if (newDate.day() == 6) newDate = newDate.add(2, "day");
+ changeDate(newDate);
+}
+export function previousDay() {
+ var newDate = dayjs(selectedDate.value).subtract(1, "day");
+ // Skip weekend
+ if (newDate.day() == 0) newDate = newDate.subtract(2, "day");
+ changeDate(newDate);
+}
+export async function changeDate(newDate) {
+ selectedDate.value = new Date(newDate.toDate().setUTCHours(0, 0, 0, 0));
+ loading.value = true;
+ await fetchSubstitutions();
+ await fetchHistory();
+ loading.value = false;
+}