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


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