logo

pleroma-fe

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

navigation_entry.js (1378B)


  1. import { mapState } from 'vuex'
  2. import { routeTo } from 'src/components/navigation/navigation.js'
  3. import OptionalRouterLink from 'src/components/optional_router_link/optional_router_link.vue'
  4. import { library } from '@fortawesome/fontawesome-svg-core'
  5. import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
  6. import { mapStores } from 'pinia'
  7. import { useAnnouncementsStore } from 'src/stores/announcements'
  8. library.add(faThumbtack)
  9. const NavigationEntry = {
  10. props: ['item', 'showPin'],
  11. components: {
  12. OptionalRouterLink
  13. },
  14. methods: {
  15. isPinned (value) {
  16. return this.pinnedItems.has(value)
  17. },
  18. togglePin (value) {
  19. if (this.isPinned(value)) {
  20. this.$store.commit('removeCollectionPreference', { path: 'collections.pinnedNavItems', value })
  21. } else {
  22. this.$store.commit('addCollectionPreference', { path: 'collections.pinnedNavItems', value })
  23. }
  24. this.$store.dispatch('pushServerSideStorage')
  25. }
  26. },
  27. computed: {
  28. routeTo () {
  29. return routeTo(this.item, this.currentUser)
  30. },
  31. getters () {
  32. return this.$store.getters
  33. },
  34. ...mapStores(useAnnouncementsStore),
  35. ...mapState({
  36. currentUser: state => state.users.currentUser,
  37. pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems)
  38. })
  39. }
  40. }
  41. export default NavigationEntry