diff options
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) } |