2022-08-11 18:56:30 +00:00
|
|
|
import { mapState } from 'vuex'
|
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(faThumbtack)
|
|
|
|
|
|
|
|
const NavigationEntry = {
|
|
|
|
props: ['item', 'showPin'],
|
|
|
|
methods: {
|
|
|
|
isPinned (value) {
|
|
|
|
return this.pinnedItems.has(value)
|
|
|
|
},
|
|
|
|
togglePin (value) {
|
|
|
|
if (this.isPinned(value)) {
|
|
|
|
this.$store.commit('removeCollectionPreference', { path: 'collections.pinnedNavItems', value })
|
|
|
|
} else {
|
|
|
|
this.$store.commit('addCollectionPreference', { path: 'collections.pinnedNavItems', value })
|
|
|
|
}
|
2022-08-11 22:19:19 +00:00
|
|
|
this.$store.dispatch('pushServerSideStorage')
|
2022-08-11 18:56:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
getters () {
|
|
|
|
return this.$store.getters
|
|
|
|
},
|
|
|
|
...mapState({
|
|
|
|
currentUser: state => state.users.currentUser,
|
|
|
|
pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default NavigationEntry
|