aboutsummaryrefslogtreecommitdiff
path: root/src/components/mobile_nav/mobile_nav.js
diff options
context:
space:
mode:
authorshpuld <shp@cock.li>2019-03-23 22:03:38 +0200
committershpuld <shp@cock.li>2019-03-23 22:03:38 +0200
commit85584021fb1042a8934945d73f7d25b38f1c29d1 (patch)
tree3cde5ccc823cd42083e5ab0e0f0113b1e0a7dac1 /src/components/mobile_nav/mobile_nav.js
parentf389128e539ffce0ef552e8b67f7b6973e134baf (diff)
make notifications close on navigation
Diffstat (limited to 'src/components/mobile_nav/mobile_nav.js')
-rw-r--r--src/components/mobile_nav/mobile_nav.js18
1 files changed, 15 insertions, 3 deletions
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()
+ }
}
}