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 (6428B)


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