better handling of bookmarks

This commit is contained in:
Henry Jameson 2025-06-24 17:01:17 +03:00
commit 187d43a4e5
4 changed files with 18 additions and 5 deletions

View file

@ -117,6 +117,8 @@ const NavPanel = {
return filterNavigation( return filterNavigation(
Object Object
.entries({ ...TIMELINES }) .entries({ ...TIMELINES })
// do not show in timeliens list since it's in a better place now
.filter(([key]) => key !== 'bookmarks')
.map(([k, v]) => ({ ...v, name: k })), .map(([k, v]) => ({ ...v, name: k })),
{ {
hasChats: this.pleromaChatMessagesAvailable, hasChats: this.pleromaChatMessagesAvailable,
@ -124,7 +126,6 @@ const NavPanel = {
isFederating: this.federating, isFederating: this.federating,
isPrivate: this.privateMode, isPrivate: this.privateMode,
currentUser: this.currentUser, currentUser: this.currentUser,
supportsBookmarkFolders: this.bookmarkFolders,
supportsBubbleTimeline: this.bubbleTimeline supportsBubbleTimeline: this.bubbleTimeline
} }
) )
@ -140,8 +141,8 @@ const NavPanel = {
isFederating: this.federating, isFederating: this.federating,
isPrivate: this.privateMode, isPrivate: this.privateMode,
currentUser: this.currentUser, currentUser: this.currentUser,
supportsBookmarkFolders: this.bookmarkFolders, supportsBubbleTimeline: this.bubbleTimeline,
supportsBubbleTimeline: this.bubbleTimeline supportsBookmarkFolders: this.bookmarkFolders
} }
) )
}, },

View file

@ -15,8 +15,9 @@ export const filterNavigation = (list = [], {
if ((!currentUser || !currentUser.locked) && set.has('lockedUser')) return false if ((!currentUser || !currentUser.locked) && set.has('lockedUser')) return false
if (!hasChats && set.has('chats')) return false if (!hasChats && set.has('chats')) return false
if (!hasAnnouncements && set.has('announcements')) return false if (!hasAnnouncements && set.has('announcements')) return false
if (!supportsBookmarkFolders && set.has('supportsBookmarkFolders')) return false
if (!supportsBubbleTimeline && set.has('supportsBubbleTimeline')) return false if (!supportsBubbleTimeline && set.has('supportsBubbleTimeline')) return false
if (!supportsBookmarkFolders && set.has('supportsBookmarkFolders')) return false
if (supportsBookmarkFolders && set.has('!supportsBookmarkFolders')) return false
return true return true
}) })
} }

View file

@ -41,11 +41,11 @@ export const TIMELINES = {
label: 'nav.twkn', label: 'nav.twkn',
criteria: ['!private', 'federating'] criteria: ['!private', 'federating']
}, },
// bookmarks are still technically a timeline so we should show it in the dropdown
bookmarks: { bookmarks: {
route: 'bookmarks', route: 'bookmarks',
icon: 'bookmark', icon: 'bookmark',
label: 'nav.bookmarks', label: 'nav.bookmarks',
criteria: ['supportsBookmarkFolders']
}, },
favorites: { favorites: {
routeObject: { name: 'user-profile', query: { tab: 'favorites' } }, routeObject: { name: 'user-profile', query: { tab: 'favorites' } },
@ -60,6 +60,15 @@ export const TIMELINES = {
} }
export const ROOT_ITEMS = { export const ROOT_ITEMS = {
bookmarks: {
route: 'bookmarks',
icon: 'bookmark',
label: 'nav.bookmarks',
// shows bookmarks entry in a better suited location
// hides it when bookmark folders are supported since
// we show custom component instead of it
criteria: ['!supportsBookmarkFolders']
},
interactions: { interactions: {
route: 'interactions', route: 'interactions',
icon: 'bell', icon: 'bell',

View file

@ -84,6 +84,7 @@ const NavPanel = {
isPrivate: this.privateMode, isPrivate: this.privateMode,
currentUser: this.currentUser, currentUser: this.currentUser,
supportsBubbleTimeline: this.bubbleTimeline, supportsBubbleTimeline: this.bubbleTimeline,
supportsBookmarkFolders: this.bookmarks
}) })
} }
return filterNavigation( return filterNavigation(
@ -103,6 +104,7 @@ const NavPanel = {
hasChats: this.pleromaChatMessagesAvailable, hasChats: this.pleromaChatMessagesAvailable,
hasAnnouncements: this.supportsAnnouncements, hasAnnouncements: this.supportsAnnouncements,
supportsBubbleTimeline: this.bubbleTimeline, supportsBubbleTimeline: this.bubbleTimeline,
supportsBookmarkFolders: this.bookmarks,
isFederating: this.federating, isFederating: this.federating,
isPrivate: this.privateMode, isPrivate: this.privateMode,
currentUser: this.currentUser currentUser: this.currentUser