diff options
| author | Fuwn <[email protected]> | 2026-03-24 07:57:46 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-03-24 07:57:46 +0000 |
| commit | 021e6f20a376797df32db4e4121eb4766903a995 (patch) | |
| tree | f73c6047e6f462a17c1be1a1f3369c7ea79af024 /Sora/Views/Post/Grid | |
| parent | Refine settings language and structure (diff) | |
| download | sora-testing-021e6f20a376797df32db4e4121eb4766903a995.tar.xz sora-testing-021e6f20a376797df32db4e4121eb4766903a995.zip | |
Refocus navigation around core content
Diffstat (limited to 'Sora/Views/Post/Grid')
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridSearchHistoryView.swift | 1 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 96 |
2 files changed, 15 insertions, 82 deletions
diff --git a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift index 13baa41..bc7c52a 100644 --- a/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift +++ b/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift @@ -10,6 +10,7 @@ struct PostGridSearchHistoryView: View { selectedTab: $selectedTab, isPresented: $isPresented, allowBookmarking: true, + showsSettingsButton: false, title: "Search History", emptyMessage: "No History", emptyIcon: "magnifyingglass", diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 23f7c00..330e294 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -6,6 +6,7 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length @EnvironmentObject var settings: SettingsManager @EnvironmentObject var manager: BooruManager @State private var isSearchHistoryPresented = false + @State private var isSettingsPresented = false @Binding var selectedTab: Int @State private var isSearchablePresented = false @State private var suppressNextSearchSubmit = false @@ -296,10 +297,16 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length } #endif + PlatformSpecificToolbarItem { + Button(action: { Task { isSearchHistoryPresented.toggle() } }) { + Label("Search History", systemImage: "clock.arrow.circlepath") + } + } + #if !os(macOS) - PlatformSpecificToolbarItem { - Button(action: { Task { isSearchHistoryPresented.toggle() } }) { - Label("Search History", systemImage: "clock.arrow.circlepath") + ToolbarItem(placement: .topBarTrailing) { + Button(action: { isSettingsPresented = true }) { + Label("Settings", systemImage: "gear") } } @@ -345,60 +352,6 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length ToolbarItem(placement: .topBarTrailing) { ProgressView() } } #endif - - #if os(macOS) - let placement = ToolbarItemPlacement.navigation - #else - let placement = ToolbarItemPlacement.topBarLeading - #endif - - if initialTag == nil { - PlatformSpecificToolbarItem(placement: placement) { - Menu { - ForEach( - Array(manager.searchHistory.enumerated().filter { $0.offset < manager.historyIndex }), - id: \.offset - ) { offset, query in - Button(action: { - manager.historyIndex = offset - }) { - Text(query.tags.isEmpty ? "No Tags" : query.tags.joined(separator: " ")) - } - } - } label: { - Label("Previous Search", systemImage: "chevron.left") - } primaryAction: { - withAnimation { - manager.goBackInHistory() - } - } - .disabled(!manager.canGoBackInHistory) - .id("previousSearchMenu") - } - - PlatformSpecificToolbarItem(placement: placement) { - Menu { - ForEach( - Array(manager.searchHistory.enumerated().filter { $0.offset > manager.historyIndex }), - id: \.offset - ) { offset, query in - Button(action: { - manager.historyIndex = offset - }) { - Text(query.tags.isEmpty ? "No Tags" : query.tags.joined(separator: " ")) - } - } - } label: { - Label("Next Search", systemImage: "chevron.right") - } primaryAction: { - withAnimation { - manager.goForwardInHistory() - } - } - .disabled(!manager.canGoForwardInHistory) - .id("nextSearchMenu") - } - } } .navigationTitle(initialTag != nil ? initialTag! : "Posts") .refreshable { @@ -428,31 +381,10 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length isPresented: $isSearchHistoryPresented ) } - #if os(iOS) - .gesture( - DragGesture() - .onEnded { value in - if initialTag == nil { - if value.startLocation.x < 50, value.translation.width > 100 { - withAnimation { - manager.goBackInHistory() - } - - debugPrint("ContentView: Swipe left, \(manager.searchHistory)") - } - - if value.startLocation.x > (UIScreen.main.bounds.width - 50), - value.translation.width < -100 - { - withAnimation { - manager.goForwardInHistory() - } - - debugPrint("ContentView: Swipe right, \(manager.searchHistory)") - } - } - } - ) + #if !os(macOS) + .sheet(isPresented: $isSettingsPresented) { + SettingsView() + } #endif } |