pleroma-fe/src/components/side_drawer/side_drawer.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

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