summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-02-28 03:27:07 -0800
committerFuwn <[email protected]>2025-02-28 03:27:07 -0800
commitd4fd7e8d5f75f1ac7718aac6c1299c3ff740de75 (patch)
treedfd4776c3a1bbe3b448310f9572d5949c80695a5 /Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift
parentfeat: Development commit (diff)
downloadsora-testing-d4fd7e8d5f75f1ac7718aac6c1299c3ff740de75.tar.xz
sora-testing-d4fd7e8d5f75f1ac7718aac6c1299c3ff740de75.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift39
1 files changed, 39 insertions, 0 deletions
diff --git a/Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift b/Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift
new file mode 100644
index 0000000..5e0b7ce
--- /dev/null
+++ b/Sora/Views/Post/Grid/PostGridSearchHistoryItemView.swift
@@ -0,0 +1,39 @@
+import SwiftUI
+
+struct PostGridSearchHistoryItemView: View {
+ @EnvironmentObject var settings: SettingsManager
+ var query: BooruSearchQuery
+
+ var body: some View {
+ #if os(macOS)
+ HStack {
+ VStack(alignment: .leading) {
+ Text(query.tags.joined(separator: ", ").lowercased())
+
+ Spacer()
+
+ Text("On \(query.searchedAt.formatted()) from \(query.provider.rawValue)")
+ .font(.caption)
+ .foregroundStyle(Color.secondary)
+ }
+
+ Spacer()
+
+ Button {
+ settings.removeSearchHistoryEntry(withID: query.id)
+ } label: {
+ Image(systemName: "trash")
+ }
+ }
+ .padding()
+ #else
+ VStack(alignment: .leading) {
+ Text(query.tags.joined(separator: ", ").lowercased())
+
+ Text("On \(query.searchedAt.formatted()) from \(query.provider.rawValue)")
+ .font(.caption)
+ .foregroundStyle(Color.secondary)
+ }
+ #endif
+ }
+}