mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
tvOS filters for all views
Vertical list for trending, popular, playlists, search Fix #413, #415
This commit is contained in:
@@ -17,7 +17,7 @@ struct HideShortsButtons: View {
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
.font(.caption2)
|
||||
.font(.caption)
|
||||
.imageScale(.small)
|
||||
#endif
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ struct ListingStyleButtons: View {
|
||||
} label: {
|
||||
Label(listingStyle.rawValue.capitalized, systemImage: listingStyle.systemImage)
|
||||
#if os(tvOS)
|
||||
.font(.caption2)
|
||||
.font(.caption)
|
||||
.imageScale(.small)
|
||||
#endif
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ struct PopularView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VerticalCells(items: videos)
|
||||
VerticalCells(items: videos) { if shouldDisplayHeader { header } }
|
||||
.onAppear {
|
||||
resource?.addObserver(store)
|
||||
resource?.loadIfNeeded()?
|
||||
@@ -116,6 +116,36 @@ struct PopularView: View {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var shouldDisplayHeader: Bool {
|
||||
#if os(tvOS)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
}
|
||||
|
||||
var header: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
ListingStyleButtons(listingStyle: $popularListingStyle)
|
||||
HideShortsButtons(hide: $hideShorts)
|
||||
|
||||
Button {
|
||||
resource?.load()
|
||||
.onFailure { self.error = $0 }
|
||||
.onSuccess { _ in self.error = nil }
|
||||
} label: {
|
||||
Label("Refresh", systemImage: "arrow.clockwise")
|
||||
.labelStyle(.iconOnly)
|
||||
.imageScale(.small)
|
||||
.font(.caption)
|
||||
}
|
||||
}
|
||||
.padding(.leading, 30)
|
||||
.padding(.bottom, 15)
|
||||
.padding(.trailing, 30)
|
||||
}
|
||||
}
|
||||
|
||||
struct PopularView_Previews: PreviewProvider {
|
||||
|
Reference in New Issue
Block a user