From 72f860e0e171f6aac4e7d896e7a571147dbcb5c5 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 22:52:33 -0500 Subject: feat: add search and recent queries Implements: https://todo.sr.ht/~ccleberg/hutch/47 Implements: https://todo.sr.ht/~ccleberg/hutch/48 --- Hutch/Views/Search/RecentSearchSuggestions.swift | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Hutch/Views/Search/RecentSearchSuggestions.swift (limited to 'Hutch/Views/Search/RecentSearchSuggestions.swift') 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() + } + } + } + } +} -- cgit v1.2.3