From f19284357e94968cdc9d4034c5e33ef9d6f6d9d7 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 14 Mar 2019 17:46:04 +0200 Subject: make nav bar slide, move mobile post status to mobile nav --- src/components/mobile_nav/mobile_nav.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index a79aa636..88fab656 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -1,11 +1,13 @@ 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' const MobileNav = { components: { SideDrawer, - Notifications + Notifications, + MobilePostStatusModal }, data: () => ({ notificationsOpen: false @@ -25,9 +27,19 @@ const MobileNav = { }, toggleMobileNotifications () { this.notificationsOpen = !this.notificationsOpen + if (!this.notificationsOpen) { + this.markNotificationsAsSeen() + } }, scrollToTop () { window.scrollTo(0, 0) + }, + logout () { + this.$router.replace('/main/public') + this.$store.dispatch('logout') + }, + markNotificationsAsSeen () { + this.$refs.notifications.markAsSeen() } } } -- cgit v1.2.3-70-g09d2 From 0a86d39ba9cf48fc0b4fb6d91b0d5eff404b2a66 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 14 Mar 2019 20:40:56 +0200 Subject: remove notifications from sidebar, make notifications appear on login only --- src/components/mobile_nav/mobile_nav.js | 3 +++ src/components/mobile_nav/mobile_nav.vue | 6 +++--- src/components/side_drawer/side_drawer.vue | 5 ----- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 88fab656..fd373ac1 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -13,6 +13,9 @@ const MobileNav = { notificationsOpen: false }), computed: { + currentUser () { + return this.$store.state.users.currentUser + }, unseenNotifications () { return unseenNotificationsFromStore(this.$store) }, diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index af2d6d5a..cb1aaa46 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -8,18 +8,18 @@ {{sitename}}
- Notifications + {{$t('notifications.notifications')}}
-
+
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index 95ee21b4..27db12d7 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -20,11 +20,6 @@ {{ $t("login.login") }} -
  • - - {{ $t("notifications.notifications") }} {{ unseenNotificationsCount > 0 ? `(${unseenNotificationsCount})` : '' }} - -
  • {{ $t("nav.dms") }} -- cgit v1.2.3-70-g09d2 From 85584021fb1042a8934945d73f7d25b38f1c29d1 Mon Sep 17 00:00:00 2001 From: shpuld Date: Sat, 23 Mar 2019 22:03:38 +0200 Subject: make notifications close on navigation --- src/components/mobile_nav/mobile_nav.js | 18 +++++++++++++++--- src/components/mobile_nav/mobile_nav.vue | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index fd373ac1..c1f5c2a9 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -28,9 +28,14 @@ const MobileNav = { toggleMobileSidebar () { this.$refs.sideDrawer.toggleDrawer() }, - toggleMobileNotifications () { - this.notificationsOpen = !this.notificationsOpen - if (!this.notificationsOpen) { + openMobileNotifications () { + this.notificationsOpen = true + }, + closeMobileNotifications () { + if (this.notificationsOpen) { + // make sure to mark notifs seen only when the notifs were open and not + // from close-calls. + this.notificationsOpen = false this.markNotificationsAsSeen() } }, @@ -44,6 +49,13 @@ const MobileNav = { markNotificationsAsSeen () { this.$refs.notifications.markAsSeen() } + }, + watch: { + $route () { + // handles closing notificaitons when you press any router-link on the + // notifications. + this.closeMobileNotifications() + } } } diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index 514931f0..39622fad 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -8,7 +8,7 @@ {{sitename}}
  • - +
    @@ -18,7 +18,7 @@
    {{$t('notifications.notifications')}} - +
    -- cgit v1.2.3-70-g09d2 From c06bcf3303d89aa44ddcdad3a9d2f723303ae3d1 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 28 Mar 2019 22:54:45 +0200 Subject: add gesture to close notifications drawer --- src/components/mobile_nav/mobile_nav.js | 15 +++++++++++++++ src/components/mobile_nav/mobile_nav.vue | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index c1f5c2a9..bc63d2ba 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 39622fad..5fa41638 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -1,5 +1,5 @@