summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridSearchHistoryView.swift
blob: 13baa413449541a2ae08d16deddf5a47357757b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import SwiftUI

struct PostGridSearchHistoryView: View {
  @EnvironmentObject var settings: SettingsManager
  @Binding var selectedTab: Int
  @Binding var isPresented: Bool

  var body: some View {
    GenericListView(
      selectedTab: $selectedTab,
      isPresented: $isPresented,
      allowBookmarking: true,
      title: "Search History",
      emptyMessage: "No History",
      emptyIcon: "magnifyingglass",
      emptyDescription: "Recent searches will appear here.",
      removeAllMessage:
        "Are you sure you want to remove all searches? This action cannot be undone.",
      removeAllButtonText: "Remove All Searches",
      items: settings.searchHistory,
      removeAction: settings.removeSearchHistoryEntry,
      removeActionUUID: settings.removeSearchHistoryEntry
    ) { settings.searchHistory.removeAll() }
  }
}

#Preview {
  PostGridSearchHistoryView(
    selectedTab: .constant(0),
    isPresented: .constant(true)
  )
  .environmentObject(SettingsManager())
  .environmentObject(BooruManager(.safebooru))
}