2026-01-06 16:23:17 +02:00
|
|
|
import { mapState as mapPiniaState } from 'pinia'
|
2026-01-08 17:26:52 +02:00
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
2026-01-06 16:23:17 +02:00
|
|
|
import {
|
|
|
|
|
filterNavigation,
|
|
|
|
|
getBookmarkFolderEntries,
|
|
|
|
|
getListEntries,
|
|
|
|
|
} from 'src/components/navigation/filter.js'
|
|
|
|
|
import {
|
|
|
|
|
ROOT_ITEMS,
|
|
|
|
|
routeTo,
|
|
|
|
|
TIMELINES,
|
|
|
|
|
} from 'src/components/navigation/navigation.js'
|
2026-06-04 20:49:43 +03:00
|
|
|
|
2025-01-30 21:56:07 +02:00
|
|
|
import { useAnnouncementsStore } from 'src/stores/announcements'
|
2025-02-21 23:37:29 -07:00
|
|
|
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders'
|
2026-01-29 00:49:26 +02:00
|
|
|
import { useInstanceStore } from 'src/stores/instance.js'
|
2026-02-05 00:28:45 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-01-06 16:23:17 +02:00
|
|
|
import { useListsStore } from 'src/stores/lists'
|
2026-02-13 13:59:00 +02:00
|
|
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
2026-08-10 15:00:59 +03:00
|
|
|
import { useUsersStore } from 'src/stores/users.js'
|
2026-01-08 17:26:52 +02:00
|
|
|
|
|
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
|
|
|
|
faBell,
|
|
|
|
|
faBookmark,
|
|
|
|
|
faCity,
|
|
|
|
|
faComments,
|
|
|
|
|
faEnvelope,
|
|
|
|
|
faGlobe,
|
|
|
|
|
faInfoCircle,
|
|
|
|
|
faList,
|
|
|
|
|
faStream,
|
|
|
|
|
faUsers,
|
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
2022-08-11 21:56:30 +03:00
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
|
faUsers,
|
|
|
|
|
faGlobe,
|
2025-06-24 15:56:08 +03:00
|
|
|
faCity,
|
2022-08-11 21:56:30 +03:00
|
|
|
faBookmark,
|
|
|
|
|
faEnvelope,
|
|
|
|
|
faComments,
|
|
|
|
|
faBell,
|
|
|
|
|
faInfoCircle,
|
|
|
|
|
faStream,
|
2026-01-06 16:22:52 +02:00
|
|
|
faList,
|
2022-08-11 21:56:30 +03:00
|
|
|
)
|
2022-08-23 15:36:54 +03:00
|
|
|
|
2022-08-11 21:56:30 +03:00
|
|
|
const NavPanel = {
|
2022-08-12 01:26:19 +03:00
|
|
|
props: ['limit'],
|
2022-08-23 15:36:54 +03:00
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
getRouteTo(item) {
|
2023-03-17 22:24:22 +03:00
|
|
|
return routeTo(item, this.currentUser)
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2022-08-23 15:36:54 +03:00
|
|
|
},
|
2026-06-04 21:59:09 +03:00
|
|
|
components: {},
|
2022-08-11 21:56:30 +03:00
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
getters() {
|
2022-08-11 21:56:30 +03:00
|
|
|
return this.$store.getters
|
|
|
|
|
},
|
2023-04-06 22:13:30 -06:00
|
|
|
...mapPiniaState(useListsStore, {
|
2026-01-06 16:22:52 +02:00
|
|
|
lists: getListEntries,
|
2023-04-06 22:13:30 -06:00
|
|
|
}),
|
2025-01-30 21:56:07 +02:00
|
|
|
...mapPiniaState(useAnnouncementsStore, {
|
2026-01-06 16:22:52 +02:00
|
|
|
supportsAnnouncements: (store) => store.supportsAnnouncements,
|
2025-01-30 21:56:07 +02:00
|
|
|
}),
|
2025-02-21 23:37:29 -07:00
|
|
|
...mapPiniaState(useBookmarkFoldersStore, {
|
2025-03-23 20:03:25 +02:00
|
|
|
bookmarks: getBookmarkFolderEntries,
|
|
|
|
|
}),
|
2026-02-13 13:59:00 +02:00
|
|
|
...mapPiniaState(useSyncConfigStore, {
|
2026-01-06 16:22:52 +02:00
|
|
|
pinnedItems: (store) =>
|
|
|
|
|
new Set(store.prefsStorage.collections.pinnedNavItems),
|
2025-02-21 23:37:29 -07:00
|
|
|
}),
|
2026-02-05 01:28:56 +02:00
|
|
|
...mapPiniaState(useInstanceStore, ['privateMode', 'federating']),
|
2026-02-05 00:28:45 +02:00
|
|
|
...mapPiniaState(useInstanceCapabilitiesStore, [
|
|
|
|
|
'pleromaChatMessagesAvailable',
|
|
|
|
|
'localBubble',
|
|
|
|
|
]),
|
2026-08-10 15:00:59 +03:00
|
|
|
...mapPiniaState(useUsersStore, ['currentUser']),
|
2022-08-11 21:56:30 +03:00
|
|
|
...mapState({
|
2026-01-06 16:22:52 +02:00
|
|
|
followRequestCount: (state) => state.api.followRequests.length,
|
2022-08-11 21:56:30 +03:00
|
|
|
}),
|
2026-01-06 16:22:52 +02:00
|
|
|
pinnedList() {
|
2022-08-12 00:50:08 +03:00
|
|
|
if (!this.currentUser) {
|
2026-01-06 16:22:52 +02:00
|
|
|
return filterNavigation(
|
|
|
|
|
[
|
|
|
|
|
{ ...TIMELINES.public, name: 'public' },
|
|
|
|
|
{ ...TIMELINES.twkn, name: 'twkn' },
|
|
|
|
|
{ ...ROOT_ITEMS.about, name: 'about' },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
hasChats: this.pleromaChatMessagesAvailable,
|
|
|
|
|
hasAnnouncements: this.supportsAnnouncements,
|
|
|
|
|
isFederating: this.federating,
|
2026-02-05 01:28:56 +02:00
|
|
|
isPrivate: this.privateMode,
|
2026-01-06 16:22:52 +02:00
|
|
|
currentUser: this.currentUser,
|
2026-02-05 00:28:45 +02:00
|
|
|
supportsBubbleTimeline: this.localBubble,
|
2026-01-06 16:22:52 +02:00
|
|
|
supportsBookmarkFolders: this.bookmarks,
|
|
|
|
|
},
|
|
|
|
|
)
|
2022-08-12 00:50:08 +03:00
|
|
|
}
|
2022-08-11 21:56:30 +03:00
|
|
|
return filterNavigation(
|
|
|
|
|
[
|
2026-01-06 16:22:52 +02:00
|
|
|
...Object.entries({ ...TIMELINES })
|
2022-08-11 21:56:30 +03:00
|
|
|
.filter(([k]) => this.pinnedItems.has(k))
|
|
|
|
|
.map(([k, v]) => ({ ...v, name: k })),
|
|
|
|
|
...this.lists.filter((k) => this.pinnedItems.has(k.name)),
|
2025-01-27 13:17:16 +02:00
|
|
|
...this.bookmarks.filter((k) => this.pinnedItems.has(k.name)),
|
2026-01-06 16:22:52 +02:00
|
|
|
...Object.entries({ ...ROOT_ITEMS })
|
2022-08-11 21:56:30 +03:00
|
|
|
.filter(([k]) => this.pinnedItems.has(k))
|
2026-01-06 16:22:52 +02:00
|
|
|
.map(([k, v]) => ({ ...v, name: k })),
|
2022-08-11 21:56:30 +03:00
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
hasChats: this.pleromaChatMessagesAvailable,
|
2023-04-06 18:14:49 -04:00
|
|
|
hasAnnouncements: this.supportsAnnouncements,
|
2026-02-05 00:28:45 +02:00
|
|
|
supportsBubbleTimeline: this.localBubble,
|
2025-06-24 17:01:17 +03:00
|
|
|
supportsBookmarkFolders: this.bookmarks,
|
2022-08-11 21:56:30 +03:00
|
|
|
isFederating: this.federating,
|
2026-02-05 01:28:56 +02:00
|
|
|
isPrivate: this.privateMode,
|
2026-01-06 16:22:52 +02:00
|
|
|
currentUser: this.currentUser,
|
|
|
|
|
},
|
2022-08-12 01:26:19 +03:00
|
|
|
).slice(0, this.limit)
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
|
|
|
|
},
|
2022-08-11 21:56:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default NavPanel
|