2019-03-05 11:01:49 -08:00
|
|
|
import UserCard from '../user_card/user_card.vue'
|
2018-12-28 11:39:54 -08:00
|
|
|
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
|
2019-03-25 13:44:58 -07:00
|
|
|
import GestureService from '../../services/gesture_service/gesture_service'
|
2018-12-23 09:50:19 -08:00
|
|
|
|
2018-12-15 09:13:01 -08:00
|
|
|
const SideDrawer = {
|
2018-12-28 11:39:54 -08:00
|
|
|
props: [ 'logout' ],
|
2018-12-23 09:50:19 -08:00
|
|
|
data: () => ({
|
|
|
|
closed: true,
|
2019-03-25 13:44:58 -07:00
|
|
|
closeGesture: undefined
|
2018-12-23 09:50:19 -08:00
|
|
|
}),
|
2019-03-25 13:44:58 -07:00
|
|
|
created () {
|
2019-03-27 13:44:25 -07:00
|
|
|
this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
|
2019-03-25 13:44:58 -07:00
|
|
|
},
|
2019-03-05 11:01:49 -08:00
|
|
|
components: { UserCard },
|
2018-12-15 09:13:01 -08:00
|
|
|
computed: {
|
|
|
|
currentUser () {
|
|
|
|
return this.$store.state.users.currentUser
|
2018-12-28 11:39:54 -08:00
|
|
|
},
|
|
|
|
chat () { return this.$store.state.chat.channel.state === 'joined' },
|
|
|
|
unseenNotifications () {
|
|
|
|
return unseenNotificationsFromStore(this.$store)
|
|
|
|
},
|
|
|
|
unseenNotificationsCount () {
|
|
|
|
return this.unseenNotifications.length
|
2019-01-15 18:33:08 -08:00
|
|
|
},
|
|
|
|
suggestionsEnabled () {
|
|
|
|
return this.$store.state.instance.suggestionsEnabled
|
2019-02-03 11:47:02 -08:00
|
|
|
},
|
|
|
|
logo () {
|
|
|
|
return this.$store.state.instance.logo
|
|
|
|
},
|
|
|
|
sitename () {
|
|
|
|
return this.$store.state.instance.name
|
2019-02-27 11:38:10 -08:00
|
|
|
},
|
|
|
|
followRequestCount () {
|
|
|
|
return this.$store.state.api.followRequests.length
|
2018-12-20 12:20:04 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-12-23 09:50:19 -08:00
|
|
|
toggleDrawer () {
|
|
|
|
this.closed = !this.closed
|
|
|
|
},
|
2018-12-22 07:32:07 -08:00
|
|
|
doLogout () {
|
|
|
|
this.logout()
|
2018-12-28 11:39:54 -08:00
|
|
|
this.toggleDrawer()
|
2018-12-23 09:50:19 -08:00
|
|
|
},
|
|
|
|
touchStart (e) {
|
2019-03-25 13:44:58 -07:00
|
|
|
GestureService.beginSwipe(e, this.closeGesture)
|
2018-12-23 09:50:19 -08:00
|
|
|
},
|
|
|
|
touchMove (e) {
|
2019-03-25 13:44:58 -07:00
|
|
|
GestureService.updateSwipe(e, this.closeGesture)
|
2018-12-15 09:13:01 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SideDrawer
|