logo

pleroma-fe

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

settings_modal_user_content.js (2200B)


  1. import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
  2. import DataImportExportTab from './tabs/data_import_export_tab.vue'
  3. import MutesAndBlocksTab from './tabs/mutes_and_blocks_tab.vue'
  4. import NotificationsTab from './tabs/notifications_tab.vue'
  5. import FilteringTab from './tabs/filtering_tab.vue'
  6. import SecurityTab from './tabs/security_tab/security_tab.vue'
  7. import ProfileTab from './tabs/profile_tab.vue'
  8. import GeneralTab from './tabs/general_tab.vue'
  9. import VersionTab from './tabs/version_tab.vue'
  10. import ThemeTab from './tabs/theme_tab/theme_tab.vue'
  11. import { library } from '@fortawesome/fontawesome-svg-core'
  12. import {
  13. faWrench,
  14. faUser,
  15. faFilter,
  16. faPaintBrush,
  17. faBell,
  18. faDownload,
  19. faEyeSlash,
  20. faInfo
  21. } from '@fortawesome/free-solid-svg-icons'
  22. library.add(
  23. faWrench,
  24. faUser,
  25. faFilter,
  26. faPaintBrush,
  27. faBell,
  28. faDownload,
  29. faEyeSlash,
  30. faInfo
  31. )
  32. const SettingsModalContent = {
  33. components: {
  34. TabSwitcher,
  35. DataImportExportTab,
  36. MutesAndBlocksTab,
  37. NotificationsTab,
  38. FilteringTab,
  39. SecurityTab,
  40. ProfileTab,
  41. GeneralTab,
  42. VersionTab,
  43. ThemeTab
  44. },
  45. computed: {
  46. isLoggedIn () {
  47. return !!this.$store.state.users.currentUser
  48. },
  49. open () {
  50. return this.$store.state.interface.settingsModalState !== 'hidden'
  51. },
  52. bodyLock () {
  53. return this.$store.state.interface.settingsModalState === 'visible'
  54. }
  55. },
  56. methods: {
  57. onOpen () {
  58. const targetTab = this.$store.state.interface.settingsModalTargetTab
  59. // We're being told to open in specific tab
  60. if (targetTab) {
  61. const tabIndex = this.$refs.tabSwitcher.$slots.default().findIndex(elm => {
  62. return elm.props && elm.props['data-tab-name'] === targetTab
  63. })
  64. if (tabIndex >= 0) {
  65. this.$refs.tabSwitcher.setTab(tabIndex)
  66. }
  67. }
  68. // Clear the state of target tab, so that next time settings is opened
  69. // it doesn't force it.
  70. this.$store.dispatch('clearSettingsModalTargetTab')
  71. }
  72. },
  73. mounted () {
  74. this.onOpen()
  75. },
  76. watch: {
  77. open: function (value) {
  78. if (value) this.onOpen()
  79. }
  80. }
  81. }
  82. export default SettingsModalContent