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


  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. library.add(faThumbtack)
  7. const NavigationEntry = {
  8. props: ['item', 'showPin'],
  9. components: {
  10. OptionalRouterLink
  11. },
  12. methods: {
  13. isPinned (value) {
  14. return this.pinnedItems.has(value)
  15. },
  16. togglePin (value) {
  17. if (this.isPinned(value)) {
  18. this.$store.commit('removeCollectionPreference', { path: 'collections.pinnedNavItems', value })
  19. } else {
  20. this.$store.commit('addCollectionPreference', { path: 'collections.pinnedNavItems', value })
  21. }
  22. this.$store.dispatch('pushServerSideStorage')
  23. }
  24. },
  25. computed: {
  26. routeTo () {
  27. return routeTo(this.item, this.currentUser)
  28. },
  29. getters () {
  30. return this.$store.getters
  31. },
  32. ...mapState({
  33. currentUser: state => state.users.currentUser,
  34. pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems)
  35. })
  36. }
  37. }
  38. export default NavigationEntry