logo

pleroma-fe

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

App.js (5445B)


  1. import UserPanel from './components/user_panel/user_panel.vue'
  2. import NavPanel from './components/nav_panel/nav_panel.vue'
  3. import InstanceSpecificPanel from './components/instance_specific_panel/instance_specific_panel.vue'
  4. import FeaturesPanel from './components/features_panel/features_panel.vue'
  5. import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_panel.vue'
  6. import ShoutPanel from './components/shout_panel/shout_panel.vue'
  7. import MediaModal from './components/media_modal/media_modal.vue'
  8. import SideDrawer from './components/side_drawer/side_drawer.vue'
  9. import MobilePostStatusButton from './components/mobile_post_status_button/mobile_post_status_button.vue'
  10. import MobileNav from './components/mobile_nav/mobile_nav.vue'
  11. import DesktopNav from './components/desktop_nav/desktop_nav.vue'
  12. import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue'
  13. import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue'
  14. import PostStatusModal from './components/post_status_modal/post_status_modal.vue'
  15. import StatusHistoryModal from './components/status_history_modal/status_history_modal.vue'
  16. import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
  17. import { windowWidth, windowHeight } from './services/window_utils/window_utils'
  18. import { mapGetters } from 'vuex'
  19. import { defineAsyncComponent } from 'vue'
  20. export default {
  21. name: 'app',
  22. components: {
  23. UserPanel,
  24. NavPanel,
  25. Notifications: defineAsyncComponent(() => import('./components/notifications/notifications.vue')),
  26. InstanceSpecificPanel,
  27. FeaturesPanel,
  28. WhoToFollowPanel,
  29. ShoutPanel,
  30. MediaModal,
  31. SideDrawer,
  32. MobilePostStatusButton,
  33. MobileNav,
  34. DesktopNav,
  35. SettingsModal: defineAsyncComponent(() => import('./components/settings_modal/settings_modal.vue')),
  36. UpdateNotification: defineAsyncComponent(() => import('./components/update_notification/update_notification.vue')),
  37. UserReportingModal,
  38. PostStatusModal,
  39. EditStatusModal,
  40. StatusHistoryModal,
  41. GlobalNoticeList
  42. },
  43. data: () => ({
  44. mobileActivePanel: 'timeline'
  45. }),
  46. created () {
  47. // Load the locale from the storage
  48. const val = this.$store.getters.mergedConfig.interfaceLanguage
  49. this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
  50. window.addEventListener('resize', this.updateMobileState)
  51. },
  52. unmounted () {
  53. window.removeEventListener('resize', this.updateMobileState)
  54. },
  55. computed: {
  56. classes () {
  57. return [
  58. {
  59. '-reverse': this.reverseLayout,
  60. '-no-sticky-headers': this.noSticky,
  61. '-has-new-post-button': this.newPostButtonShown
  62. },
  63. '-' + this.layoutType
  64. ]
  65. },
  66. navClasses () {
  67. const { navbarColumnStretch } = this.$store.getters.mergedConfig
  68. return [
  69. '-' + this.layoutType,
  70. ...(navbarColumnStretch ? ['-column-stretch'] : [])
  71. ]
  72. },
  73. currentUser () { return this.$store.state.users.currentUser },
  74. userBackground () { return this.currentUser.background_image },
  75. instanceBackground () {
  76. return this.mergedConfig.hideInstanceWallpaper
  77. ? null
  78. : this.$store.state.instance.background
  79. },
  80. background () { return this.userBackground || this.instanceBackground },
  81. bgStyle () {
  82. if (this.background) {
  83. return {
  84. '--body-background-image': `url(${this.background})`
  85. }
  86. }
  87. },
  88. shout () { return this.$store.state.shout.joined },
  89. suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled },
  90. showInstanceSpecificPanel () {
  91. return this.$store.state.instance.showInstanceSpecificPanel &&
  92. !this.$store.getters.mergedConfig.hideISP &&
  93. this.$store.state.instance.instanceSpecificPanelContent
  94. },
  95. isChats () {
  96. return this.$route.name === 'chat' || this.$route.name === 'chats'
  97. },
  98. isListEdit () {
  99. return this.$route.name === 'lists-edit'
  100. },
  101. newPostButtonShown () {
  102. if (this.isChats) return false
  103. if (this.isListEdit) return false
  104. return this.$store.getters.mergedConfig.alwaysShowNewPostButton || this.layoutType === 'mobile'
  105. },
  106. showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
  107. editingAvailable () { return this.$store.state.instance.editingAvailable },
  108. shoutboxPosition () {
  109. return this.$store.getters.mergedConfig.alwaysShowNewPostButton || false
  110. },
  111. hideShoutbox () {
  112. return this.$store.getters.mergedConfig.hideShoutbox
  113. },
  114. layoutType () { return this.$store.state.interface.layoutType },
  115. privateMode () { return this.$store.state.instance.private },
  116. reverseLayout () {
  117. const { thirdColumnMode, sidebarRight: reverseSetting } = this.$store.getters.mergedConfig
  118. if (this.layoutType !== 'wide') {
  119. return reverseSetting
  120. } else {
  121. return thirdColumnMode === 'notifications' ? reverseSetting : !reverseSetting
  122. }
  123. },
  124. noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
  125. showScrollbars () { return this.$store.getters.mergedConfig.showScrollbars },
  126. ...mapGetters(['mergedConfig'])
  127. },
  128. methods: {
  129. updateMobileState () {
  130. this.$store.dispatch('setLayoutWidth', windowWidth())
  131. this.$store.dispatch('setLayoutHeight', windowHeight())
  132. }
  133. }
  134. }