diff options
Diffstat (limited to 'Sora/Views/BookmarkMenuButtonView.swift')
| -rw-r--r-- | Sora/Views/BookmarkMenuButtonView.swift | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Sora/Views/BookmarkMenuButtonView.swift b/Sora/Views/BookmarkMenuButtonView.swift index c46894d..91009d0 100644 --- a/Sora/Views/BookmarkMenuButtonView.swift +++ b/Sora/Views/BookmarkMenuButtonView.swift @@ -39,6 +39,7 @@ struct BookmarkMenuButtonView: View { }) { Label(folder.name, systemImage: "folder") } + .disabled(isBookmarkedInFolder(folderId: folder.id)) } let topLevelFolders = settings.folders @@ -62,6 +63,7 @@ struct BookmarkMenuButtonView: View { }) { Text(folder.shortName) } + .disabled(isBookmarkedInFolder(folderId: folder.id)) } } label: { Text(topLevelName) @@ -98,4 +100,11 @@ struct BookmarkMenuButtonView: View { settings.bookmarks.append(newBookmark) } } + + private func isBookmarkedInFolder(folderId: UUID) -> Bool { + settings.bookmarks.contains { bookmark in + bookmark.folder == folderId && Set(bookmark.tags) == Set(tags) + && bookmark.provider == provider + } + } } |