summaryrefslogtreecommitdiff
path: root/Sora/Views/Bookmarks/BookmarksView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-02-28 03:33:21 -0800
committerFuwn <[email protected]>2025-02-28 03:33:21 -0800
commite084ee2714c76f9081d4c57d07dec7ddd21783c2 (patch)
treec0798a5d409bd320d89905952475298ee8bec79f /Sora/Views/Bookmarks/BookmarksView.swift
parentfeat: Development commit (diff)
downloadsora-testing-e084ee2714c76f9081d4c57d07dec7ddd21783c2.tar.xz
sora-testing-e084ee2714c76f9081d4c57d07dec7ddd21783c2.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Bookmarks/BookmarksView.swift')
-rw-r--r--Sora/Views/Bookmarks/BookmarksView.swift73
1 files changed, 0 insertions, 73 deletions
diff --git a/Sora/Views/Bookmarks/BookmarksView.swift b/Sora/Views/Bookmarks/BookmarksView.swift
deleted file mode 100644
index 6c356b9..0000000
--- a/Sora/Views/Bookmarks/BookmarksView.swift
+++ /dev/null
@@ -1,73 +0,0 @@
-import SwiftUI
-
-struct BookmarksView: View {
- @EnvironmentObject var settings: SettingsManager
- @EnvironmentObject var manager: BooruManager
- @Binding var selectedTab: Int
- @State private var bookmarksSearchText: String = ""
-
- var filteredBookmarks: [SettingsBookmark] {
- guard !bookmarksSearchText.isEmpty else {
- return settings.bookmarks
- }
-
- return settings.bookmarks
- .filter { bookmark in
- bookmark.tags.joined(separator: " ").lowercased().contains(bookmarksSearchText.lowercased())
- }
- }
-
- var body: some View {
- NavigationStack {
- VStack {
- if settings.bookmarks.isEmpty {
- ContentUnavailableView(
- "No Bookmarks",
- systemImage: "bookmark",
- description: Text("Tap the bookmark button on a search page to add a bookmark.")
- )
- } else {
- List {
- if filteredBookmarks.isEmpty, !bookmarksSearchText.isEmpty {
- Text("No bookmarks match your search")
- }
-
- 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()
- }
- }) {
- BookmarksListItemView(bookmark: bookmark)
- }
- #if os(macOS)
- .buttonStyle(.plain)
- #endif
- }
- .onDelete(perform: settings.removeBookmark)
- }
- #if os(macOS)
- .listStyle(.plain)
- #endif
- }
- }
- }
- .navigationTitle("Bookmarks")
- .searchable(text: $bookmarksSearchText)
- }
-}
-
-#Preview {
- BookmarksView(selectedTab: .constant(1))
- .environmentObject(SettingsManager())
- .environmentObject(BooruManager(.yandere))
-}