diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index c1f5c2a94fb3fe21539c55040f17ff2ba94dd1e9..bc63d2ba72c898fd5ecfce6304e7edad9f85980b 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -2,6 +2,7 @@ import SideDrawer from '../side_drawer/side_drawer.vue' import Notifications from '../notifications/notifications.vue' import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue' import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils' +import GestureService from '../../services/gesture_service/gesture_service' const MobileNav = { components: { @@ -10,8 +11,16 @@ const MobileNav = { MobilePostStatusModal }, data: () => ({ + notificationsCloseGesture: undefined, notificationsOpen: false }), + created () { + this.notificationsCloseGesture = GestureService.swipeGesture( + GestureService.DIRECTION_RIGHT, + this.closeMobileNotifications, + 50 + ) + }, computed: { currentUser () { return this.$store.state.users.currentUser @@ -39,6 +48,12 @@ const MobileNav = { this.markNotificationsAsSeen() } }, + notificationsTouchStart (e) { + GestureService.beginSwipe(e, this.notificationsCloseGesture) + }, + notificationsTouchMove (e) { + GestureService.updateSwipe(e, this.notificationsCloseGesture) + }, scrollToTop () { window.scrollTo(0, 0) }, diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index 39622fad95a40924fdf41738f5c920a81584d0f4..5fa416380ba513505c1beda61eaa3057bffdc732 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -1,5 +1,5 @@ <template> - <nav class='nav-bar container asd' id="nav"> + <nav class='nav-bar container' id="nav"> <div class='mobile-inner-nav' @click="scrollToTop()"> <div class='item'> <a href="#" class="mobile-nav-button" @click.stop.prevent="toggleMobileSidebar()"> @@ -15,7 +15,12 @@ </div> </div> <SideDrawer ref="sideDrawer" :logout="logout"/> - <div v-if="currentUser" class="mobile-notifications-drawer" :class="{ 'closed': !notificationsOpen }"> + <div v-if="currentUser" + class="mobile-notifications-drawer" + :class="{ 'closed': !notificationsOpen }" + @touchstart="notificationsTouchStart" + @touchmove="notificationsTouchMove" + > <div class="mobile-notifications-header"> <span class="title">{{$t('notifications.notifications')}}</span> <a class="mobile-nav-button" @click.stop.prevent="closeMobileNotifications()">