logo

pleroma-fe

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

navigation_pins.js (2586B)


  1. import { mapState } from 'vuex'
  2. import { TIMELINES, ROOT_ITEMS, routeTo } from 'src/components/navigation/navigation.js'
  3. import { getListEntries, filterNavigation } from 'src/components/navigation/filter.js'
  4. import { library } from '@fortawesome/fontawesome-svg-core'
  5. import {
  6. faUsers,
  7. faGlobe,
  8. faBookmark,
  9. faEnvelope,
  10. faComments,
  11. faBell,
  12. faInfoCircle,
  13. faStream,
  14. faList
  15. } from '@fortawesome/free-solid-svg-icons'
  16. library.add(
  17. faUsers,
  18. faGlobe,
  19. faBookmark,
  20. faEnvelope,
  21. faComments,
  22. faBell,
  23. faInfoCircle,
  24. faStream,
  25. faList
  26. )
  27. const NavPanel = {
  28. props: ['limit'],
  29. methods: {
  30. getRouteTo (item) {
  31. return routeTo(item, this.currentUser)
  32. }
  33. },
  34. computed: {
  35. getters () {
  36. return this.$store.getters
  37. },
  38. ...mapState({
  39. lists: getListEntries,
  40. currentUser: state => state.users.currentUser,
  41. followRequestCount: state => state.api.followRequests.length,
  42. privateMode: state => state.instance.private,
  43. federating: state => state.instance.federating,
  44. pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable,
  45. supportsAnnouncements: state => state.announcements.supportsAnnouncements,
  46. pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems)
  47. }),
  48. pinnedList () {
  49. if (!this.currentUser) {
  50. return filterNavigation([
  51. { ...TIMELINES.public, name: 'public' },
  52. { ...TIMELINES.twkn, name: 'twkn' },
  53. { ...ROOT_ITEMS.about, name: 'about' }
  54. ],
  55. {
  56. hasChats: this.pleromaChatMessagesAvailable,
  57. hasAnnouncements: this.supportsAnnouncements,
  58. isFederating: this.federating,
  59. isPrivate: this.privateMode,
  60. currentUser: this.currentUser
  61. })
  62. }
  63. return filterNavigation(
  64. [
  65. ...Object
  66. .entries({ ...TIMELINES })
  67. .filter(([k]) => this.pinnedItems.has(k))
  68. .map(([k, v]) => ({ ...v, name: k })),
  69. ...this.lists.filter((k) => this.pinnedItems.has(k.name)),
  70. ...Object
  71. .entries({ ...ROOT_ITEMS })
  72. .filter(([k]) => this.pinnedItems.has(k))
  73. .map(([k, v]) => ({ ...v, name: k }))
  74. ],
  75. {
  76. hasChats: this.pleromaChatMessagesAvailable,
  77. hasAnnouncements: this.supportsAnnouncements,
  78. isFederating: this.federating,
  79. isPrivate: this.privateMode,
  80. currentUser: this.currentUser
  81. }
  82. ).slice(0, this.limit)
  83. }
  84. }
  85. }
  86. export default NavPanel