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