Migrates lists module to store

This commit is contained in:
Sean King 2023-04-06 22:13:30 -06:00
commit 8eff081468
No known key found for this signature in database
GPG key ID: 510C52BACD6E7257
13 changed files with 248 additions and 109 deletions

View file

@ -11,7 +11,7 @@ export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFede
})
}
export const getListEntries = state => state.lists.allLists.map(list => ({
export const getListEntries = store => store.allLists.map(list => ({
name: 'list-' + list.id,
routeObject: { name: 'lists-timeline', params: { id: list.id } },
labelRaw: list.title,

View file

@ -1,4 +1,5 @@
import { mapState } from 'vuex'
import { mapState as mapPiniaState } from 'pinia'
import { TIMELINES, ROOT_ITEMS, routeTo } from 'src/components/navigation/navigation.js'
import { getListEntries, filterNavigation } from 'src/components/navigation/filter.js'
@ -14,6 +15,7 @@ import {
faStream,
faList
} from '@fortawesome/free-solid-svg-icons'
import { useListsStore } from '../../stores/lists'
library.add(
faUsers,
@ -38,8 +40,10 @@ const NavPanel = {
getters () {
return this.$store.getters
},
...mapPiniaState(useListsStore, {
lists: getListEntries
}),
...mapState({
lists: getListEntries,
currentUser: state => state.users.currentUser,
followRequestCount: state => state.api.followRequests.length,
privateMode: state => state.instance.private,