summaryrefslogtreecommitdiff
path: root/Hutch/Views/Search/RecentSearchSuggestions.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-12 22:52:33 -0500
committerChristian Cleberg <[email protected]>2026-04-12 22:52:33 -0500
commit72f860e0e171f6aac4e7d896e7a571147dbcb5c5 (patch)
treec62c9c9325292f65e6f72372a38b35760cc937b1 /Hutch/Views/Search/RecentSearchSuggestions.swift
parent576bb6c2432a15f5138771c06019b55fd2244e15 (diff)
downloadhutch-72f860e0e171f6aac4e7d896e7a571147dbcb5c5.tar.gz
hutch-72f860e0e171f6aac4e7d896e7a571147dbcb5c5.tar.bz2
hutch-72f860e0e171f6aac4e7d896e7a571147dbcb5c5.zip
feat: add search and recent queries
Implements: https://todo.sr.ht/~ccleberg/hutch/47 Implements: https://todo.sr.ht/~ccleberg/hutch/48
Diffstat (limited to 'Hutch/Views/Search/RecentSearchSuggestions.swift')
-rw-r--r--Hutch/Views/Search/RecentSearchSuggestions.swift26
1 files changed, 26 insertions, 0 deletions
diff --git a/Hutch/Views/Search/RecentSearchSuggestions.swift b/Hutch/Views/Search/RecentSearchSuggestions.swift
new file mode 100644
index 0000000..d40640e
--- /dev/null
+++ b/Hutch/Views/Search/RecentSearchSuggestions.swift
@@ -0,0 +1,26 @@
+import SwiftUI
+
+struct RecentSearchSuggestions: View {
+ let title: String
+ let entries: [ScopedSearchHistoryEntry]
+ let onSelect: (String) -> Void
+ let onClear: () -> Void
+
+ var body: some View {
+ if !entries.isEmpty {
+ Section(title) {
+ ForEach(entries) { entry in
+ Button {
+ onSelect(entry.query)
+ } label: {
+ Label(entry.query, systemImage: "clock.arrow.circlepath")
+ }
+ }
+
+ Button("Clear Recent Searches", role: .destructive) {
+ onClear()
+ }
+ }
+ }
+ }
+}