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

@ -5,7 +5,6 @@ import BottomNavbar from "./components/bottom-navbar.vue";
import DateSelector from "./components/date-selector.vue";
import LoadingElement from "./components/loading-element.vue";
import { loading } from "./store";
import { previousDay, nextDay } from "./util";
import { computed } from "vue";
const route = useRoute();
@ -15,19 +14,13 @@ const isDataView = computed(() => {
routeName.value != "title.settings" && routeName.value != "title.login"
);
});
function swipeHandler(direction) {
if (!isDataView.value) return;
if (direction == "left") nextDay();
else if (direction == "right") previousDay();
}
</script>
<template>
<div class="app">
<TitleBar />
<DateSelector v-show="isDataView" />
<div class="center" v-touch:swipe="swipeHandler">
<div class="center">
<main>
<LoadingElement :active="loading" v-show="isDataView" />
<RouterView />
@ -57,18 +50,17 @@ body {
.app {
display: grid;
grid-template-rows: auto auto 1fr;
height: 100vh;
}
.center {
display: flex;
justify-content: center;
overflow-y: auto;
overflow: overlay;
}
main {
width: 100%;
max-width: 900px;
overflow: hidden;
}
</style>