fix navigation
This commit is contained in:
parent
148ce1eb99
commit
5b9027f17a
5 changed files with 27 additions and 11 deletions
|
|
@ -76,7 +76,7 @@ export const ROOT_ITEMS = {
|
||||||
icon: 'comments',
|
icon: 'comments',
|
||||||
label: 'nav.chats',
|
label: 'nav.chats',
|
||||||
badgeStyle: 'notification',
|
badgeStyle: 'notification',
|
||||||
badgeGetter: 'unreadChatsCount',
|
badgeGetter: 'unreadChats',
|
||||||
criteria: ['chats'],
|
criteria: ['chats'],
|
||||||
},
|
},
|
||||||
friendRequests: {
|
friendRequests: {
|
||||||
|
|
@ -85,7 +85,7 @@ export const ROOT_ITEMS = {
|
||||||
label: 'nav.friend_requests',
|
label: 'nav.friend_requests',
|
||||||
badgeStyle: 'notification',
|
badgeStyle: 'notification',
|
||||||
criteria: ['lockedUser'],
|
criteria: ['lockedUser'],
|
||||||
badgeGetter: 'followRequestsCount',
|
badgeGetter: 'followRequests',
|
||||||
},
|
},
|
||||||
about: {
|
about: {
|
||||||
route: 'about',
|
route: 'about',
|
||||||
|
|
@ -99,7 +99,7 @@ export const ROOT_ITEMS = {
|
||||||
label: 'nav.announcements',
|
label: 'nav.announcements',
|
||||||
store: 'announcements',
|
store: 'announcements',
|
||||||
badgeStyle: 'notification',
|
badgeStyle: 'notification',
|
||||||
badgeGetter: 'unreadAnnouncementCount',
|
badgeGetter: 'unreadAnnouncements',
|
||||||
criteria: ['announcements'],
|
criteria: ['announcements'],
|
||||||
},
|
},
|
||||||
drafts: {
|
drafts: {
|
||||||
|
|
@ -107,7 +107,7 @@ export const ROOT_ITEMS = {
|
||||||
icon: 'file-pen',
|
icon: 'file-pen',
|
||||||
label: 'nav.drafts',
|
label: 'nav.drafts',
|
||||||
badgeStyle: 'neutral',
|
badgeStyle: 'neutral',
|
||||||
badgeGetter: 'draftCount',
|
badgeGetter: 'drafts',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ import OptionalRouterLink from 'src/components/optional_router_link/optional_rou
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
import { useUsersStore } from 'src/stores/users.js'
|
import { useUsersStore } from 'src/stores/users.js'
|
||||||
|
import { useDraftsStore } from 'src/stores/drafts.js'
|
||||||
|
import { useChatsStore } from 'src/stores/chats.js'
|
||||||
|
import { useFollowRequestsStore } from 'src/stores/follow_requests.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
@ -40,11 +43,19 @@ const NavigationEntry = {
|
||||||
routeTo() {
|
routeTo() {
|
||||||
return routeTo(this.item, this.currentUser)
|
return routeTo(this.item, this.currentUser)
|
||||||
},
|
},
|
||||||
getters() {
|
badges() {
|
||||||
return this.$store.getters
|
return {
|
||||||
|
drafts: this.draftsCount,
|
||||||
|
unreadAnnouncements: this.unreadAnnouncementCount,
|
||||||
|
followRequests: this.followRequestsCount,
|
||||||
|
unreadChats: this.unreadChatsCount,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
...mapStores(useAnnouncementsStore),
|
...mapStores(useAnnouncementsStore),
|
||||||
|
...mapState(useDraftsStore, ['draftsCount']),
|
||||||
...mapState(useUsersStore, ['currentUser']),
|
...mapState(useUsersStore, ['currentUser']),
|
||||||
|
...mapState(useChatsStore, ['unreadChatsCount']),
|
||||||
|
...mapState(useFollowRequestsStore, ['followRequestsCount']),
|
||||||
...mapState(useSyncConfigStore, {
|
...mapState(useSyncConfigStore, {
|
||||||
pinnedItems: (store) =>
|
pinnedItems: (store) =>
|
||||||
new Set(store.prefsStorage.collections.pinnedNavItems),
|
new Set(store.prefsStorage.collections.pinnedNavItems),
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@
|
||||||
</component>
|
</component>
|
||||||
<slot />
|
<slot />
|
||||||
<div
|
<div
|
||||||
v-if="item.badgeGetter && getters[item.badgeGetter]"
|
v-if="item.badgeGetter && badges[item.badgeGetter]"
|
||||||
class="badge"
|
class="badge"
|
||||||
:class="[`-${item.badgeStyle}`]"
|
:class="[`-${item.badgeStyle}`]"
|
||||||
>
|
>
|
||||||
{{ getters[item.badgeGetter] }}
|
{{ badges[item.badgeGetter] }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="item.badgeGetter && item.store && this[`${item.store}Store`][item.badgeGetter]"
|
v-else-if="item.badgeGetter && item.store && this[`${item.store}Store`][item.badgeGetter]"
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,13 @@ const NavPanel = {
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
computed: {
|
computed: {
|
||||||
getters() {
|
badges() {
|
||||||
return this.$store.getters
|
return {
|
||||||
|
drafts: this.draftsCount,
|
||||||
|
unreadAnnouncements: this.unreadAnnouncementCount,
|
||||||
|
followRequests: this.followRequestsCount,
|
||||||
|
unreadChats: this.unreadChatsCount,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
...mapState(useListsStore, {
|
...mapState(useListsStore, {
|
||||||
lists: getListEntries,
|
lists: getListEntries,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
:src="item.iconEmojiUrl"
|
:src="item.iconEmojiUrl"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="item.badgeGetter && getters[item.badgeGetter]"
|
v-if="item.badgeGetter && badges[item.badgeGetter]"
|
||||||
class="badge -dot"
|
class="badge -dot"
|
||||||
:class="[`-${item.badgeStyle}`]"
|
:class="[`-${item.badgeStyle}`]"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue