diff options
| author | Fuwn <[email protected]> | 2025-02-21 01:53:31 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-21 01:53:35 -0800 |
| commit | 617370e834db97c2c6ce5c5bbd3825fcad013b7f (patch) | |
| tree | 8d20d45c0cb1169d8c08509e106d0d57b0d71c72 /Sora/Views/BookmarksView.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-617370e834db97c2c6ce5c5bbd3825fcad013b7f.tar.xz sora-testing-617370e834db97c2c6ce5c5bbd3825fcad013b7f.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/BookmarksView.swift')
| -rw-r--r-- | Sora/Views/BookmarksView.swift | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/Sora/Views/BookmarksView.swift b/Sora/Views/BookmarksView.swift deleted file mode 100644 index 7c206ac..0000000 --- a/Sora/Views/BookmarksView.swift +++ /dev/null @@ -1,72 +0,0 @@ -import SwiftUI - -struct BookmarksView: View { - @EnvironmentObject var settings: Settings - @EnvironmentObject var manager: BooruManager - @Binding var selectedTab: Int - @State private var bookmarksSearchText: String = "" - - var filteredBookmarks: [Bookmark] { - guard !bookmarksSearchText.isEmpty else { - return settings.bookmarks - } - - return settings.bookmarks - .filter { $0.tags.joined(separator: " ").lowercased().contains(bookmarksSearchText.lowercased()) } - } - - var body: some View { - NavigationStack { - if settings.bookmarks.isEmpty { - VStack { - Spacer() - - Text("There are no bookmarks yet. Add a bookmark by tapping the bookmark button in the bottom left corner of a search page.") - .padding() - - Spacer() - } - } else { - List { - if filteredBookmarks.isEmpty { - Text("No bookmarks found.") - } - - ForEach(filteredBookmarks, id: \.self) { bookmark in - Button(action: { - let previousProvider = settings.preferredBooru - - settings.preferredBooru = bookmark.provider - manager.searchText = bookmark.tags.joined(separator: " ") - selectedTab = 0 - - if previousProvider == settings.preferredBooru { - manager.performSearch() - } - }) { - let badgeView = Text(bookmark.provider.rawValue.capitalized) - - HStack { - Text(bookmark.tags.joined(separator: ", ")) - .foregroundStyle(.primary) - - Text(bookmark.createdAt.formatted()) - .foregroundColor(.secondary) - } - .badge(badgeView) - } - } - .onDelete(perform: settings.removeBookmark) - } - } - } - .navigationTitle("Bookmarks") - .searchable(text: $bookmarksSearchText) - } -} - -#Preview { - BookmarksView(selectedTab: .constant(1)) - .environmentObject(Settings()) - .environmentObject(BooruManager(.yandere)) -} |