mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Search UI fixes
This commit is contained in:
@@ -90,7 +90,7 @@ struct ChannelVideosView: View {
|
||||
var subscriptionToolbarItemPlacement: ToolbarItemPlacement {
|
||||
#if os(iOS)
|
||||
if horizontalSizeClass == .regular {
|
||||
return .primaryAction
|
||||
return .primaryAction // swiftlint:disable:this implicit_return
|
||||
}
|
||||
#endif
|
||||
|
||||
|
13
Shared/Views/LazyView.swift
Normal file
13
Shared/Views/LazyView.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct LazyView<Content: View>: View {
|
||||
let build: () -> Content
|
||||
init(_ build: @autoclosure @escaping () -> Content) {
|
||||
self.build = build
|
||||
}
|
||||
|
||||
var body: Content {
|
||||
build()
|
||||
}
|
||||
}
|
@@ -26,7 +26,6 @@ struct SearchView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.searchable(text: $queryText)
|
||||
.onAppear {
|
||||
state.changeQuery { query in
|
||||
query.query = queryText
|
||||
@@ -35,7 +34,7 @@ struct SearchView: View {
|
||||
query.duration = searchDuration
|
||||
}
|
||||
}
|
||||
.onChange(of: queryText) { queryText in
|
||||
.onChange(of: state.query.query) { queryText in
|
||||
state.changeQuery { query in query.query = queryText }
|
||||
}
|
||||
.onChange(of: searchSortOrder) { order in
|
||||
@@ -48,10 +47,14 @@ struct SearchView: View {
|
||||
state.changeQuery { query in query.duration = duration }
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.navigationTitle("Search")
|
||||
.navigationTitle(navigationTitle)
|
||||
#endif
|
||||
}
|
||||
|
||||
var navigationTitle: String {
|
||||
state.query.query.isEmpty ? "Search" : "Search: \"\(state.query.query)\""
|
||||
}
|
||||
|
||||
var searchFiltersActive: Bool {
|
||||
searchDate != nil || searchDuration != nil
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ struct VideoContextMenuView: View {
|
||||
var openChannelButton: some View {
|
||||
Button("\(video.author) Channel") {
|
||||
navigationState.openChannel(video.channel)
|
||||
navigationState.tabSelection = .channel(video.channel.id)
|
||||
navigationState.sidebarSectionChanged.toggle()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user