2019-03-13 08:50:54 +11:00
|
|
|
import SideDrawer from '../side_drawer/side_drawer.vue'
|
|
|
|
import Notifications from '../notifications/notifications.vue'
|
2019-03-15 02:46:04 +11:00
|
|
|
import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue'
|
2019-03-13 08:50:54 +11:00
|
|
|
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
|
|
|
|
|
|
|
|
const MobileNav = {
|
|
|
|
components: {
|
|
|
|
SideDrawer,
|
2019-03-15 02:46:04 +11:00
|
|
|
Notifications,
|
|
|
|
MobilePostStatusModal
|
2019-03-13 08:50:54 +11:00
|
|
|
},
|
|
|
|
data: () => ({
|
|
|
|
notificationsOpen: false
|
|
|
|
}),
|
|
|
|
computed: {
|
|
|
|
unseenNotifications () {
|
|
|
|
return unseenNotificationsFromStore(this.$store)
|
|
|
|
},
|
|
|
|
unseenNotificationsCount () {
|
|
|
|
return this.unseenNotifications.length
|
|
|
|
},
|
|
|
|
sitename () { return this.$store.state.instance.name }
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleMobileSidebar () {
|
|
|
|
this.$refs.sideDrawer.toggleDrawer()
|
|
|
|
},
|
|
|
|
toggleMobileNotifications () {
|
|
|
|
this.notificationsOpen = !this.notificationsOpen
|
2019-03-15 02:46:04 +11:00
|
|
|
if (!this.notificationsOpen) {
|
|
|
|
this.markNotificationsAsSeen()
|
|
|
|
}
|
2019-03-13 08:50:54 +11:00
|
|
|
},
|
|
|
|
scrollToTop () {
|
|
|
|
window.scrollTo(0, 0)
|
2019-03-15 02:46:04 +11:00
|
|
|
},
|
|
|
|
logout () {
|
|
|
|
this.$router.replace('/main/public')
|
|
|
|
this.$store.dispatch('logout')
|
|
|
|
},
|
|
|
|
markNotificationsAsSeen () {
|
|
|
|
this.$refs.notifications.markAsSeen()
|
2019-03-13 08:50:54 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MobileNav
|