2020-05-07 13:10:53 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex'
|
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'
|
2020-10-20 19:13:19 +00:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import {
|
|
|
|
faSignInAlt,
|
|
|
|
faSignOutAlt,
|
|
|
|
faHome,
|
|
|
|
faComments,
|
|
|
|
faBell,
|
|
|
|
faUserPlus,
|
|
|
|
faBullhorn,
|
|
|
|
faSearch,
|
|
|
|
faTachometerAlt,
|
|
|
|
faCog,
|
2022-06-14 20:53:51 +00:00
|
|
|
faInfoCircle,
|
|
|
|
faList
|
2020-10-20 19:13:19 +00:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
faSignInAlt,
|
|
|
|
faSignOutAlt,
|
|
|
|
faHome,
|
|
|
|
faComments,
|
|
|
|
faBell,
|
|
|
|
faUserPlus,
|
|
|
|
faBullhorn,
|
|
|
|
faSearch,
|
|
|
|
faTachometerAlt,
|
|
|
|
faCog,
|
2022-06-14 20:53:51 +00:00
|
|
|
faInfoCircle,
|
|
|
|
faList
|
2020-10-20 19:13:19 +00:00
|
|
|
)
|
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
|
|
|
},
|
2022-04-06 21:06:41 +00:00
|
|
|
shout () { return this.$store.state.shout.joined },
|
2018-12-28 19:39:54 +00:00
|
|
|
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
|
2020-07-07 15:20:37 +00:00
|
|
|
},
|
|
|
|
timelinesRoute () {
|
2020-07-23 12:09:32 +00:00
|
|
|
if (this.$store.state.interface.lastTimeline) {
|
|
|
|
return this.$store.state.interface.lastTimeline
|
|
|
|
}
|
2020-07-07 15:20:37 +00:00
|
|
|
return this.currentUser ? 'friends' : 'public-timeline'
|
2020-07-14 08:44:06 +00:00
|
|
|
},
|
2020-05-07 13:10:53 +00:00
|
|
|
...mapState({
|
|
|
|
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
|
|
|
|
}),
|
2022-07-18 13:08:50 +00:00
|
|
|
...mapGetters(['unreadChatCount', 'unreadAnnouncementCount'])
|
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
|