logo

pleroma-fe

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

side_drawer.js (3253B)


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