diff --git a/public/favicon.svg b/public/favicon.svg
index 32e3939..21895a9 100644
--- a/public/favicon.svg
+++ b/public/favicon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index cc8e55a..f060725 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -37,8 +37,8 @@ const isDataView = computed(() => {
+
-
diff --git a/src/components/bottom-navbar.vue b/src/components/bottom-navbar.vue
index 2cc36dc..d907541 100644
--- a/src/components/bottom-navbar.vue
+++ b/src/components/bottom-navbar.vue
@@ -32,18 +32,16 @@ import { RouterLink } from "vue-router";
.bottomnav {
width: calc(90% - 40px);
height: 50px;
- background-color: var(--bottomnav-color);
- border-radius: 10px;
+ max-width: 800px;
+ padding: 0px 20px;
position: fixed;
bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
display: grid;
grid-auto-columns: 1fr;
grid-auto-flow: column;
- padding: 0px 20px;
- max-width: 800px;
z-index: 100;
+ border-radius: 10px;
+ background-color: var(--bottomnav-color);
box-shadow: var(--bottomnav-shadow);
}
diff --git a/src/components/date-selector.vue b/src/components/date-selector.vue
index 0aba2bd..02608b0 100644
--- a/src/components/date-selector.vue
+++ b/src/components/date-selector.vue
@@ -2,6 +2,7 @@
import { selectedDate, selectedDay, changeDay, changeDate } from "../store";
import ArrowIcon from "./icons/arrow-icon.vue";
import dayjs from "dayjs";
+import { getDateSkippingWeekend } from "../util";
const dayNames = [
"days.sunday",
@@ -16,15 +17,15 @@ const dayNames = [
-
(changeDay -= 1)" />
-
+
+
{{ $t(dayNames[selectedDay + 1]) }},
{{ dayjs(selectedDate).format("DD.MM.YYYY") }}
- (changeDay += 1)"
- />
+
diff --git a/src/components/day-carousel.vue b/src/components/day-carousel.vue
index c6e0d04..05ac9e4 100644
--- a/src/components/day-carousel.vue
+++ b/src/components/day-carousel.vue
@@ -3,6 +3,7 @@ import { selectedDate, changeDate, changeDay } from "../store";
import { Swiper, SwiperSlide } from "swiper/vue";
import { Virtual } from "swiper";
import { ref, watch } from "vue";
+import { getDateSkippingWeekend } from "../util";
defineProps({
element: {
@@ -26,20 +27,25 @@ const loadedDates = ref([
// Load left or right date on slide change
function slideChange(swiper) {
+ const activeSlide = swiper.activeIndex;
// Only trigger data refresh if date is different
- const newSelectedDate = loadedDates.value[swiper.activeIndex];
+ const newSelectedDate = loadedDates.value[activeSlide];
if (selectedDate.value.getTime() != newSelectedDate.getTime())
selectedDate.value = newSelectedDate;
-
- const activeSlide = swiper.activeIndex;
+ // Check if current slide is the last one
if (activeSlide == loadedDates.value.length - 1) {
- const lastDate = loadedDates.value[loadedDates.value.length - 1];
+ // Append next day to loadedDates
+ const lastDate = loadedDates.value.at(-1);
loadedDates.value.push(getDateSkippingWeekend(calculateDate(lastDate, 1)));
}
}
function slideChangeEnd(swiper) {
const activeSlide = swiper.activeIndex;
+ // Check if the current slide is the first one
if (activeSlide == 0) {
+ // Prepend the previous day to loadedDates
+ // and slide to the next slide without transition
+ // so the same day as before is shown
const lastDate = loadedDates.value[0];
loadedDates.value = [
getDateSkippingWeekend(calculateDate(lastDate, -1)),
@@ -48,6 +54,12 @@ function slideChangeEnd(swiper) {
swiper.slideTo(activeSlide + 1, 0);
}
}
+// Also check if a day needs to be prepended
+// if the user releases the card later because
+// a different event is fired for that
+function slideResetEnd(swiper) {
+ slideChangeEnd(swiper);
+}
// Helper functions
function calculateDate(date, offset) {
@@ -60,6 +72,8 @@ function slideToDate(date) {
const slide = calculateSlide(date);
if (slide != -1) swiperElement.value.slideTo(slide);
else {
+ // If the slide is not loaded yet reset
+ // loaded dates and load that date
loadedDates.value = [calculateDate(date, -1), date, calculateDate(date, 1)];
swiperElement.value.slideTo(1, 0);
}
@@ -76,16 +90,6 @@ watch(changeDay, (change) => {
watch(changeDate, (date) => {
slideToDate(new Date(date.setUTCHours(0, 0, 0, 0)));
});
-
-function getDateSkippingWeekend(date) {
- var calculatedDate = date;
- // Skip weekend
- if (calculatedDate.getDay() == 6)
- calculatedDate = new Date(calculatedDate.getTime() + 86400000 * 2);
- if (calculatedDate.getDay() == 0)
- calculatedDate = new Date(calculatedDate.getTime() - 86400000 * 2);
- return calculatedDate;
-}
@@ -96,6 +100,7 @@ function getDateSkippingWeekend(date) {
:initial-slide="1"
:virtual="true"
@slide-change-transition-end="slideChangeEnd"
+ @slide-reset-transition-end="slideResetEnd"
@slide-change="slideChange"
@swiper="setSwiper"
>
diff --git a/src/components/loading-element.vue b/src/components/loading-element.vue
index 47f8197..bd1ca2f 100644
--- a/src/components/loading-element.vue
+++ b/src/components/loading-element.vue
@@ -15,6 +15,7 @@ const props = defineProps({
},
});
+const loadingElement = ref(null);
const computedProgress = ref(0);
const visible = ref(true);
var hideTimeout;
@@ -38,6 +39,7 @@ watch(
hideTimeout = setTimeout(() => {
if (!props.active) {
visible.value = false;
+ loadingElement.value.classList.remove("transition");
computedProgress.value = 0;
}
}, 500);
@@ -48,7 +50,8 @@ watch(
@@ -57,9 +60,12 @@ watch(