logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

side_drawer.js (3293B)


  1. import { mapState, mapGetters } from 'vuex'
  2. import UserCard from '../user_card/user_card.vue'
  3. import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
  4. import GestureService from '../../services/gesture_service/gesture_service'
  5. import { USERNAME_ROUTES } from 'src/components/navigation/navigation.js'
  6. import { library } from '@fortawesome/fontawesome-svg-core'
  7. import {
  8. faSignInAlt,
  9. faSignOutAlt,
  10. faHome,
  11. faComments,
  12. faBell,
  13. faUserPlus,
  14. faBullhorn,
  15. faSearch,
  16. faTachometerAlt,
  17. faCog,
  18. faInfoCircle,
  19. faCompass,
  20. faList,
  21. faFilePen
  22. } from '@fortawesome/free-solid-svg-icons'
  23. library.add(
  24. faSignInAlt,
  25. faSignOutAlt,
  26. faHome,
  27. faComments,
  28. faBell,
  29. faUserPlus,
  30. faBullhorn,
  31. faSearch,
  32. faTachometerAlt,
  33. faCog,
  34. faInfoCircle,
  35. faCompass,
  36. faList,
  37. faFilePen
  38. )
  39. const SideDrawer = {
  40. props: ['logout'],
  41. data: () => ({
  42. closed: true,
  43. closeGesture: undefined
  44. }),
  45. created () {
  46. this.closeGesture = GestureService.swipeGesture(GestureService.DIRECTION_LEFT, this.toggleDrawer)
  47. if (this.currentUser && this.currentUser.locked) {
  48. this.$store.dispatch('startFetchingFollowRequests')
  49. }
  50. },
  51. components: { UserCard },
  52. computed: {
  53. currentUser () {
  54. return this.$store.state.users.currentUser
  55. },
  56. shout () { return this.$store.state.shout.joined },
  57. unseenNotifications () {
  58. return unseenNotificationsFromStore(this.$store)
  59. },
  60. unseenNotificationsCount () {
  61. return this.unseenNotifications.length
  62. },
  63. suggestionsEnabled () {
  64. return this.$store.state.instance.suggestionsEnabled
  65. },
  66. logo () {
  67. return this.$store.state.instance.logo
  68. },
  69. hideSitename () {
  70. return this.$store.state.instance.hideSitename
  71. },
  72. sitename () {
  73. return this.$store.state.instance.name
  74. },
  75. followRequestCount () {
  76. return this.$store.state.api.followRequests.length
  77. },
  78. privateMode () {
  79. return this.$store.state.instance.private
  80. },
  81. federating () {
  82. return this.$store.state.instance.federating
  83. },
  84. timelinesRoute () {
  85. let name
  86. if (this.$store.state.interface.lastTimeline) {
  87. name = this.$store.state.interface.lastTimeline
  88. }
  89. name = this.currentUser ? 'friends' : 'public-timeline'
  90. if (USERNAME_ROUTES.has(name)) {
  91. return { name, params: { username: this.currentUser.screen_name } }
  92. } else {
  93. return { name }
  94. }
  95. },
  96. ...mapState({
  97. pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable,
  98. supportsAnnouncements: state => state.announcements.supportsAnnouncements
  99. }),
  100. ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount', 'draftCount'])
  101. },
  102. methods: {
  103. toggleDrawer () {
  104. this.closed = !this.closed
  105. },
  106. doLogout () {
  107. this.logout()
  108. this.toggleDrawer()
  109. },
  110. touchStart (e) {
  111. GestureService.beginSwipe(e, this.closeGesture)
  112. },
  113. touchMove (e) {
  114. GestureService.updateSwipe(e, this.closeGesture)
  115. },
  116. openSettingsModal () {
  117. this.$store.dispatch('openSettingsModal', 'user')
  118. },
  119. openAdminModal () {
  120. this.$store.dispatch('openSettingsModal', 'admin')
  121. }
  122. }
  123. }
  124. export default SideDrawer