aboutsummaryrefslogtreecommitdiff
path: root/src/components/side_drawer/side_drawer.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-01-15 16:35:13 +0000
committerShpuld Shpludson <shp@cock.li>2020-01-15 16:35:13 +0000
commit3ab128e73924ce34d190ff609cb9b081cdffe402 (patch)
treebba013a7d61688b90c1f59a8f9fa6c3323b72a05 /src/components/side_drawer/side_drawer.js
parent7c26435e66fd7e142ea4b88fbe51eede32eeb5ce (diff)
parent7397636914a9d3e7fd30373034c25175273ab808 (diff)
Merge branch 'develop' into 'master'
`master` refresh with `develop` See merge request pleroma/pleroma-fe!1028
Diffstat (limited to 'src/components/side_drawer/side_drawer.js')
-rw-r--r--src/components/side_drawer/side_drawer.js31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js
index ad3738d1..2534eb8f 100644
--- a/src/components/side_drawer/side_drawer.js
+++ b/src/components/side_drawer/side_drawer.js
@@ -1,17 +1,20 @@
import UserCard from '../user_card/user_card.vue'
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
-
-// TODO: separate touch gesture stuff into their own utils if more components want them
-const deltaCoord = (oldCoord, newCoord) => [newCoord[0] - oldCoord[0], newCoord[1] - oldCoord[1]]
-
-const touchEventCoord = e => ([e.touches[0].screenX, e.touches[0].screenY])
+import GestureService from '../../services/gesture_service/gesture_service'
const SideDrawer = {
props: [ 'logout' ],
data: () => ({
closed: true,
- touchCoord: [0, 0]
+ closeGesture: undefined
}),
+ created () {
+ this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
+
+ if (this.currentUser && this.currentUser.locked) {
+ this.$store.dispatch('startFetchingFollowRequest')
+ }
+ },
components: { UserCard },
computed: {
currentUser () {
@@ -30,11 +33,20 @@ const SideDrawer = {
logo () {
return this.$store.state.instance.logo
},
+ hideSitename () {
+ return this.$store.state.instance.hideSitename
+ },
sitename () {
return this.$store.state.instance.name
},
followRequestCount () {
return this.$store.state.api.followRequests.length
+ },
+ privateMode () {
+ return this.$store.state.instance.private
+ },
+ federating () {
+ return this.$store.state.instance.federating
}
},
methods: {
@@ -46,13 +58,10 @@ const SideDrawer = {
this.toggleDrawer()
},
touchStart (e) {
- this.touchCoord = touchEventCoord(e)
+ GestureService.beginSwipe(e, this.closeGesture)
},
touchMove (e) {
- const delta = deltaCoord(this.touchCoord, touchEventCoord(e))
- if (delta[0] < -30 && Math.abs(delta[1]) < Math.abs(delta[0]) && !this.closed) {
- this.toggleDrawer()
- }
+ GestureService.updateSwipe(e, this.closeGesture)
}
}
}