logo

pleroma-fe

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

App.js (6376B)


  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. watch: {
  47. themeApplied (value) {
  48. this.removeSplash()
  49. },
  50. layoutType (value) {
  51. document.getElementById('modal').classList = ['-' + this.layoutType]
  52. }
  53. },
  54. created () {
  55. // Load the locale from the storage
  56. const val = this.$store.getters.mergedConfig.interfaceLanguage
  57. this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
  58. window.addEventListener('resize', this.updateMobileState)
  59. document.getElementById('modal').classList = ['-' + this.layoutType]
  60. },
  61. mounted () {
  62. if (this.$store.state.interface.themeApplied) {
  63. this.removeSplash()
  64. }
  65. },
  66. unmounted () {
  67. window.removeEventListener('resize', this.updateMobileState)
  68. },
  69. computed: {
  70. themeApplied () {
  71. return this.$store.state.interface.themeApplied
  72. },
  73. layoutModalClass () {
  74. return '-' + this.layoutType
  75. },
  76. classes () {
  77. return [
  78. {
  79. '-reverse': this.reverseLayout,
  80. '-no-sticky-headers': this.noSticky,
  81. '-has-new-post-button': this.newPostButtonShown
  82. },
  83. '-' + this.layoutType
  84. ]
  85. },
  86. navClasses () {
  87. const { navbarColumnStretch } = this.$store.getters.mergedConfig
  88. return [
  89. '-' + this.layoutType,
  90. ...(navbarColumnStretch ? ['-column-stretch'] : [])
  91. ]
  92. },
  93. currentUser () { return this.$store.state.users.currentUser },
  94. userBackground () { return this.currentUser.background_image },
  95. instanceBackground () {
  96. return this.mergedConfig.hideInstanceWallpaper
  97. ? null
  98. : this.$store.state.instance.background
  99. },
  100. background () { return this.userBackground || this.instanceBackground },
  101. bgStyle () {
  102. if (this.background) {
  103. return {
  104. '--body-background-image': `url(${this.background})`
  105. }
  106. }
  107. },
  108. shout () { return this.$store.state.shout.joined },
  109. suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled },
  110. showInstanceSpecificPanel () {
  111. return this.$store.state.instance.showInstanceSpecificPanel &&
  112. !this.$store.getters.mergedConfig.hideISP &&
  113. this.$store.state.instance.instanceSpecificPanelContent
  114. },
  115. isChats () {
  116. return this.$route.name === 'chat' || this.$route.name === 'chats'
  117. },
  118. isListEdit () {
  119. return this.$route.name === 'lists-edit'
  120. },
  121. newPostButtonShown () {
  122. if (this.isChats) return false
  123. if (this.isListEdit) return false
  124. return this.$store.getters.mergedConfig.alwaysShowNewPostButton || this.layoutType === 'mobile'
  125. },
  126. showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
  127. editingAvailable () { return this.$store.state.instance.editingAvailable },
  128. shoutboxPosition () {
  129. return this.$store.getters.mergedConfig.alwaysShowNewPostButton || false
  130. },
  131. hideShoutbox () {
  132. return this.$store.getters.mergedConfig.hideShoutbox
  133. },
  134. layoutType () { return this.$store.state.interface.layoutType },
  135. privateMode () { return this.$store.state.instance.private },
  136. reverseLayout () {
  137. const { thirdColumnMode, sidebarRight: reverseSetting } = this.$store.getters.mergedConfig
  138. if (this.layoutType !== 'wide') {
  139. return reverseSetting
  140. } else {
  141. return thirdColumnMode === 'notifications' ? reverseSetting : !reverseSetting
  142. }
  143. },
  144. noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
  145. showScrollbars () { return this.$store.getters.mergedConfig.showScrollbars },
  146. ...mapGetters(['mergedConfig'])
  147. },
  148. methods: {
  149. updateMobileState () {
  150. this.$store.dispatch('setLayoutWidth', windowWidth())
  151. this.$store.dispatch('setLayoutHeight', windowHeight())
  152. },
  153. removeSplash () {
  154. document.querySelector('#status').textContent = this.$t('splash.fun_' + Math.ceil(Math.random() * 4))
  155. const splashscreenRoot = document.querySelector('#splash')
  156. splashscreenRoot.addEventListener('transitionend', () => {
  157. splashscreenRoot.remove()
  158. })
  159. splashscreenRoot.classList.add('hidden')
  160. document.querySelector('#app').classList.remove('hidden')
  161. }
  162. }
  163. }