summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-24 07:57:46 +0000
committerFuwn <[email protected]>2026-03-24 07:57:46 +0000
commit021e6f20a376797df32db4e4121eb4766903a995 (patch)
treef73c6047e6f462a17c1be1a1f3369c7ea79af024 /Sora/Views/Post/Grid/PostGridView.swift
parentRefine settings language and structure (diff)
downloadsora-testing-021e6f20a376797df32db4e4121eb4766903a995.tar.xz
sora-testing-021e6f20a376797df32db4e4121eb4766903a995.zip
Refocus navigation around core content
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift96
1 files changed, 14 insertions, 82 deletions
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
}