blob: 2064dfa5041cb9cd2c107c277bd42c37f878f122 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import UserCardContent from '../user_card_content/user_card_content.vue'
const deltaX = (oldX, newX) => newX - oldX
const touchEventX = e => e.touches[0].screenX
const SideDrawer = {
props: [ 'activatePanel', 'logout' ],
data: () => ({
closed: true,
touchX: 0
}),
components: { UserCardContent },
computed: {
currentUser () {
return this.$store.state.users.currentUser
}
},
methods: {
toggleDrawer () {
this.closed = !this.closed
},
gotoPanel (panel) {
this.activatePanel(panel)
this.toggleDrawer()
},
doLogout () {
this.logout()
this.gotoPanel('timeline')
},
touchStart (e) {
this.touchX = touchEventX(e)
},
touchMove (e) {
const delta = deltaX(this.touchX, touchEventX(e))
if (delta < -30) {
this.toggleDrawer()
}
}
}
}
export default SideDrawer
|