summaryrefslogtreecommitdiff
path: root/Sora/Views
diff options
context:
space:
mode:
Diffstat (limited to 'Sora/Views')
-rw-r--r--Sora/Views/BookmarksView.swift21
-rw-r--r--Sora/Views/GenericItemView.swift10
-rw-r--r--Sora/Views/Post/Grid/PostGridSearchHistoryView.swift21
3 files changed, 41 insertions, 11 deletions
diff --git a/Sora/Views/BookmarksView.swift b/Sora/Views/BookmarksView.swift
index fa9ca5d..ccef3f1 100644
--- a/Sora/Views/BookmarksView.swift
+++ b/Sora/Views/BookmarksView.swift
@@ -5,6 +5,7 @@ struct BookmarksView: View {
@EnvironmentObject var manager: BooruManager
@Binding var selectedTab: Int
@State private var bookmarksSearchText: String = ""
+ @State private var isShowingRemoveAllConfirmation = false
var filteredBookmarks: [SettingsBookmark] {
guard !bookmarksSearchText.isEmpty else {
@@ -58,14 +59,28 @@ struct BookmarksView: View {
}
.onDelete(perform: settings.removeBookmark)
}
- #if os(macOS)
- .listStyle(.plain)
- #endif
}
}
}
.navigationTitle("Bookmarks")
.searchable(text: $bookmarksSearchText)
+ .toolbar {
+ ToolbarItem {
+ Button(action: {
+ isShowingRemoveAllConfirmation = true
+ }) {
+ Label("Remove All Bookmarks", systemImage: "trash")
+ }
+ }
+ }
+ .confirmationDialog(
+ "Are you sure you want to remove all bookmarks? This action cannot be undone.",
+ isPresented: $isShowingRemoveAllConfirmation
+ ) {
+ Button("Remove All Bookmarks") {
+ settings.bookmarks.removeAll()
+ }
+ }
}
}
diff --git a/Sora/Views/GenericItemView.swift b/Sora/Views/GenericItemView.swift
index 34ce88a..ec8deaa 100644
--- a/Sora/Views/GenericItemView.swift
+++ b/Sora/Views/GenericItemView.swift
@@ -16,17 +16,17 @@ struct GenericItemView<T: ItemViewModel>: View {
Text("On \(item.date.formatted()) from \(item.provider.rawValue)")
.font(.caption)
.foregroundStyle(Color.secondary)
- }
-
- Spacer()
+ Spacer()
+ }
+ }
+ .contextMenu {
Button {
removeAction(item.id)
} label: {
- Image(systemName: "trash")
+ Label("Remove", systemImage: "trash")
}
}
- .padding()
#else
VStack(alignment: .leading) {
Text(item.tags.joined(separator: ", ").lowercased())
diff --git a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
index e306839..30f7808 100644
--- a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
+++ b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
@@ -6,6 +6,7 @@ struct PostGridSearchHistoryView: View {
@State private var searchText: String = ""
@Binding var selectedTab: Int
@Binding var isPresented: Bool
+ @State private var isShowingRemoveAllConfirmation = false
var filteredHistory: [BooruSearchQuery] {
guard !searchText.isEmpty else {
@@ -64,14 +65,28 @@ struct PostGridSearchHistoryView: View {
}
.onDelete(perform: settings.removeSearchHistoryEntry)
}
- #if os(macOS)
- .listStyle(.plain)
- #endif
}
}
}
.navigationTitle("Search History")
.searchable(text: $searchText)
+ .toolbar {
+ ToolbarItem {
+ Button(action: {
+ isShowingRemoveAllConfirmation = true
+ }) {
+ Label("Remove All Search History", systemImage: "trash")
+ }
+ }
+ }
+ .confirmationDialog(
+ "Are you sure you want to remove all searches? This action cannot be undone.",
+ isPresented: $isShowingRemoveAllConfirmation
+ ) {
+ Button("Remove All Searches") {
+ settings.bookmarks.removeAll()
+ }
+ }
}
}