diff options
| author | Fuwn <[email protected]> | 2025-06-16 07:57:09 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-16 07:57:09 -0700 |
| commit | 1a1e23980ab058ee7cca0c323df0d2f01b4b645e (patch) | |
| tree | f570a0134e2743f1a3582d42d1ff96de9fe23413 /Sora/Views/Post/Grid/PostGridView.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-1a1e23980ab058ee7cca0c323df0d2f01b4b645e.tar.xz sora-testing-1a1e23980ab058ee7cca0c323df0d2f01b4b645e.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 11e4d2c..4e283aa 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -221,15 +221,41 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length #endif PlatformSpecificToolbarItem(placement: .navigation) { - Button(action: { manager.goBackInHistory() }) { + 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: { + manager.goBackInHistory() } .disabled(!manager.canGoBackInHistory) } PlatformSpecificToolbarItem(placement: .navigation) { - Button(action: { manager.goForwardInHistory() }) { + 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: { + manager.goForwardInHistory() } .disabled(!manager.canGoForwardInHistory) } |