logo

pleroma-fe

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

desktop_nav.js (3043B)


  1. import SearchBar from 'components/search_bar/search_bar.vue'
  2. import ConfirmModal from '../confirm_modal/confirm_modal.vue'
  3. import { library } from '@fortawesome/fontawesome-svg-core'
  4. import {
  5. faSignInAlt,
  6. faSignOutAlt,
  7. faHome,
  8. faComments,
  9. faBell,
  10. faUserPlus,
  11. faBullhorn,
  12. faSearch,
  13. faTachometerAlt,
  14. faCog,
  15. faInfoCircle
  16. } from '@fortawesome/free-solid-svg-icons'
  17. library.add(
  18. faSignInAlt,
  19. faSignOutAlt,
  20. faHome,
  21. faComments,
  22. faBell,
  23. faUserPlus,
  24. faBullhorn,
  25. faSearch,
  26. faTachometerAlt,
  27. faCog,
  28. faInfoCircle
  29. )
  30. export default {
  31. components: {
  32. SearchBar,
  33. ConfirmModal
  34. },
  35. data: () => ({
  36. searchBarHidden: true,
  37. supportsMask: window.CSS && window.CSS.supports && (
  38. window.CSS.supports('mask-size', 'contain') ||
  39. window.CSS.supports('-webkit-mask-size', 'contain') ||
  40. window.CSS.supports('-moz-mask-size', 'contain') ||
  41. window.CSS.supports('-ms-mask-size', 'contain') ||
  42. window.CSS.supports('-o-mask-size', 'contain')
  43. ),
  44. showingConfirmLogout: false
  45. }),
  46. computed: {
  47. enableMask () { return this.supportsMask && this.$store.state.instance.logoMask },
  48. logoStyle () {
  49. return {
  50. visibility: this.enableMask ? 'hidden' : 'visible'
  51. }
  52. },
  53. logoMaskStyle () {
  54. return this.enableMask
  55. ? {
  56. 'mask-image': `url(${this.$store.state.instance.logo})`
  57. }
  58. : {
  59. 'background-color': this.enableMask ? '' : 'transparent'
  60. }
  61. },
  62. logoBgStyle () {
  63. return Object.assign({
  64. margin: `${this.$store.state.instance.logoMargin} 0`,
  65. opacity: this.searchBarHidden ? 1 : 0
  66. }, this.enableMask
  67. ? {}
  68. : {
  69. 'background-color': this.enableMask ? '' : 'transparent'
  70. })
  71. },
  72. logo () { return this.$store.state.instance.logo },
  73. sitename () { return this.$store.state.instance.name },
  74. hideSitename () { return this.$store.state.instance.hideSitename },
  75. logoLeft () { return this.$store.state.instance.logoLeft },
  76. currentUser () { return this.$store.state.users.currentUser },
  77. privateMode () { return this.$store.state.instance.private },
  78. shouldConfirmLogout () {
  79. return this.$store.getters.mergedConfig.modalOnLogout
  80. }
  81. },
  82. methods: {
  83. scrollToTop () {
  84. window.scrollTo(0, 0)
  85. },
  86. showConfirmLogout () {
  87. this.showingConfirmLogout = true
  88. },
  89. hideConfirmLogout () {
  90. this.showingConfirmLogout = false
  91. },
  92. logout () {
  93. if (!this.shouldConfirmLogout) {
  94. this.doLogout()
  95. } else {
  96. this.showConfirmLogout()
  97. }
  98. },
  99. doLogout () {
  100. this.$router.replace('/main/public')
  101. this.$store.dispatch('logout')
  102. this.hideConfirmLogout()
  103. },
  104. onSearchBarToggled (hidden) {
  105. this.searchBarHidden = hidden
  106. },
  107. openSettingsModal () {
  108. this.$store.dispatch('openSettingsModal', 'user')
  109. },
  110. openAdminModal () {
  111. this.$store.dispatch('openSettingsModal', 'admin')
  112. }
  113. }
  114. }