2022-08-15 17:34:45 +00:00
|
|
|
import ListsMenuContent from 'src/components/lists_menu/lists_menu_content.vue'
|
2020-05-07 13:10:53 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex'
|
2022-08-11 18:00:27 +00:00
|
|
|
import { TIMELINES, ROOT_ITEMS } from 'src/components/navigation/navigation.js'
|
2022-08-15 20:31:05 +00:00
|
|
|
import { filterNavigation } from 'src/components/navigation/filter.js'
|
2022-08-11 18:00:27 +00:00
|
|
|
import NavigationEntry from 'src/components/navigation/navigation_entry.vue'
|
2022-08-11 18:56:30 +00:00
|
|
|
import NavigationPins from 'src/components/navigation/navigation_pins.vue'
|
2022-08-15 18:56:07 +00:00
|
|
|
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
2020-07-03 09:56:31 +00:00
|
|
|
|
2020-10-19 16:38:49 +00:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import {
|
|
|
|
faUsers,
|
2020-10-20 21:25:59 +00:00
|
|
|
faGlobe,
|
2020-10-19 16:38:49 +00:00
|
|
|
faBookmark,
|
|
|
|
faEnvelope,
|
2021-02-22 14:24:04 +00:00
|
|
|
faChevronDown,
|
|
|
|
faChevronUp,
|
2020-10-19 16:38:49 +00:00
|
|
|
faComments,
|
|
|
|
faBell,
|
2021-02-22 14:24:04 +00:00
|
|
|
faInfoCircle,
|
2022-08-06 14:26:43 +00:00
|
|
|
faStream,
|
|
|
|
faList
|
2020-10-19 16:38:49 +00:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
faUsers,
|
2020-10-20 21:25:59 +00:00
|
|
|
faGlobe,
|
2020-10-19 16:38:49 +00:00
|
|
|
faBookmark,
|
|
|
|
faEnvelope,
|
2021-02-22 14:24:04 +00:00
|
|
|
faChevronDown,
|
|
|
|
faChevronUp,
|
2020-10-19 16:38:49 +00:00
|
|
|
faComments,
|
|
|
|
faBell,
|
2021-02-22 14:24:04 +00:00
|
|
|
faInfoCircle,
|
2022-08-06 14:26:43 +00:00
|
|
|
faStream,
|
|
|
|
faList
|
2020-10-19 16:38:49 +00:00
|
|
|
)
|
2016-11-06 19:10:20 +00:00
|
|
|
const NavPanel = {
|
2022-08-15 18:56:07 +00:00
|
|
|
props: ['forceExpand', 'forceEditMode'],
|
2019-02-27 19:38:10 +00:00
|
|
|
created () {
|
|
|
|
},
|
2021-02-22 14:24:04 +00:00
|
|
|
components: {
|
2022-08-11 18:00:27 +00:00
|
|
|
ListsMenuContent,
|
2022-08-11 18:56:30 +00:00
|
|
|
NavigationEntry,
|
2022-08-15 18:56:07 +00:00
|
|
|
NavigationPins,
|
|
|
|
Checkbox
|
2021-02-22 14:24:04 +00:00
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
2022-08-15 18:56:07 +00:00
|
|
|
editMode: false,
|
2022-08-06 14:26:43 +00:00
|
|
|
showTimelines: false,
|
2022-08-11 11:30:58 +00:00
|
|
|
showLists: false,
|
|
|
|
timelinesList: Object.entries(TIMELINES).map(([k, v]) => ({ ...v, name: k })),
|
|
|
|
rootList: Object.entries(ROOT_ITEMS).map(([k, v]) => ({ ...v, name: k }))
|
2021-02-22 14:24:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleTimelines () {
|
|
|
|
this.showTimelines = !this.showTimelines
|
2022-08-06 14:26:43 +00:00
|
|
|
},
|
|
|
|
toggleLists () {
|
|
|
|
this.showLists = !this.showLists
|
2022-08-11 11:30:58 +00:00
|
|
|
},
|
2022-08-15 18:56:07 +00:00
|
|
|
toggleEditMode () {
|
|
|
|
this.editMode = !this.editMode
|
|
|
|
},
|
2022-08-11 11:30:58 +00:00
|
|
|
toggleCollapse () {
|
2022-08-11 15:06:28 +00:00
|
|
|
this.$store.commit('setPreference', { path: 'simple.collapseNav', value: !this.collapsed })
|
|
|
|
this.$store.dispatch('pushServerSideStorage')
|
2022-08-11 11:30:58 +00:00
|
|
|
},
|
|
|
|
isPinned (item) {
|
|
|
|
return this.pinnedItems.has(item)
|
|
|
|
},
|
|
|
|
togglePin (item) {
|
|
|
|
if (this.isPinned(item)) {
|
|
|
|
this.$store.commit('removeCollectionPreference', { path: 'collections.pinnedNavItems', value: item })
|
|
|
|
} else {
|
|
|
|
this.$store.commit('addCollectionPreference', { path: 'collections.pinnedNavItems', value: item })
|
|
|
|
}
|
2022-08-11 15:06:28 +00:00
|
|
|
this.$store.dispatch('pushServerSideStorage')
|
2021-02-22 14:24:04 +00:00
|
|
|
}
|
|
|
|
},
|
2020-07-03 09:56:31 +00:00
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
currentUser: state => state.users.currentUser,
|
|
|
|
followRequestCount: state => state.api.followRequests.length,
|
|
|
|
privateMode: state => state.instance.private,
|
2020-05-07 13:10:53 +00:00
|
|
|
federating: state => state.instance.federating,
|
2022-08-11 11:30:58 +00:00
|
|
|
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable,
|
2022-08-11 15:06:28 +00:00
|
|
|
pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems),
|
|
|
|
collapsed: state => state.serverSideStorage.prefsStorage.simple.collapseNav
|
2020-05-07 13:10:53 +00:00
|
|
|
}),
|
2022-08-11 21:50:08 +00:00
|
|
|
timelinesItems () {
|
|
|
|
return filterNavigation(
|
|
|
|
Object
|
|
|
|
.entries({ ...TIMELINES })
|
|
|
|
.map(([k, v]) => ({ ...v, name: k })),
|
|
|
|
{
|
|
|
|
hasChats: this.pleromaChatMessagesAvailable,
|
|
|
|
isFederating: this.federating,
|
2022-08-11 22:19:19 +00:00
|
|
|
isPrivate: this.privateMode,
|
2022-08-11 21:50:08 +00:00
|
|
|
currentUser: this.currentUser
|
|
|
|
}
|
|
|
|
)
|
|
|
|
},
|
2022-08-11 11:30:58 +00:00
|
|
|
rootItems () {
|
2022-08-11 18:00:27 +00:00
|
|
|
return filterNavigation(
|
|
|
|
Object
|
|
|
|
.entries({ ...ROOT_ITEMS })
|
|
|
|
.map(([k, v]) => ({ ...v, name: k })),
|
|
|
|
{
|
2022-08-11 18:56:30 +00:00
|
|
|
hasChats: this.pleromaChatMessagesAvailable,
|
2022-08-11 18:00:27 +00:00
|
|
|
isFederating: this.federating,
|
2022-08-11 22:19:19 +00:00
|
|
|
isPrivate: this.privateMode,
|
2022-08-11 18:00:27 +00:00
|
|
|
currentUser: this.currentUser
|
|
|
|
}
|
|
|
|
)
|
2022-08-11 11:30:58 +00:00
|
|
|
},
|
2020-05-07 13:10:53 +00:00
|
|
|
...mapGetters(['unreadChatCount'])
|
2020-07-03 09:56:31 +00:00
|
|
|
}
|
2016-11-06 19:10:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default NavPanel
|