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