mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Model improvements
This commit is contained in:
@@ -27,6 +27,7 @@ struct SearchView: View {
|
||||
@EnvironmentObject<SearchModel> private var state
|
||||
private var favorites = FavoritesModel.shared
|
||||
|
||||
@Default(.recentlyOpened) private var recentlyOpened
|
||||
@Default(.saveRecents) private var saveRecents
|
||||
|
||||
private var videos = [Video]()
|
||||
@@ -287,11 +288,11 @@ struct SearchView: View {
|
||||
VStack {
|
||||
List {
|
||||
Section(header: Text("Recents")) {
|
||||
if recentItems.isEmpty {
|
||||
if recentlyOpened.isEmpty {
|
||||
Text("Search history is empty")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
ForEach(recentItems) { item in
|
||||
ForEach(recentlyOpened, id: \.tag) { item in
|
||||
recentItemButton(item)
|
||||
}
|
||||
}
|
||||
@@ -347,7 +348,6 @@ struct SearchView: View {
|
||||
item.type == .channel ? RecentsModel.symbolSystemImage(item.title) :
|
||||
"list.and.film"
|
||||
Label(item.title, systemImage: systemImage)
|
||||
.lineLimit(1)
|
||||
}
|
||||
.contextMenu {
|
||||
removeButton(item)
|
||||
@@ -391,10 +391,6 @@ struct SearchView: View {
|
||||
searchDate != .any || searchDuration != .any
|
||||
}
|
||||
|
||||
private var recentItems: [RecentItem] {
|
||||
Defaults[.recentlyOpened].reversed()
|
||||
}
|
||||
|
||||
private var searchSortOrderPicker: some View {
|
||||
Picker("Sort", selection: $searchSortOrder) {
|
||||
ForEach(SearchQuery.SortOrder.allCases) { sortOrder in
|
||||
|
Reference in New Issue
Block a user