mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix placeholders
This commit is contained in:
parent
2028446d03
commit
71c666ebfe
@ -20,6 +20,10 @@ struct ContentItem: Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
static var placeholders: [Self] {
|
||||
(0 ..< 9).map { i in .init(id: String(i)) }
|
||||
}
|
||||
|
||||
var video: Video!
|
||||
var playlist: ChannelPlaylist!
|
||||
var channel: Channel!
|
||||
|
@ -37,11 +37,7 @@ struct HorizontalCells: View {
|
||||
}
|
||||
|
||||
var contentItems: [ContentItem] {
|
||||
items.isEmpty ? placeholders : items
|
||||
}
|
||||
|
||||
var placeholders: [ContentItem] {
|
||||
(0 ..< 9).map { _ in .init() }
|
||||
items.isEmpty ? ContentItem.placeholders : items
|
||||
}
|
||||
|
||||
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
||||
|
@ -48,11 +48,7 @@ struct VerticalCells<Header: View>: View {
|
||||
}
|
||||
|
||||
var contentItems: [ContentItem] {
|
||||
items.isEmpty ? (allowEmpty ? items : placeholders) : items.sorted { $0 < $1 }
|
||||
}
|
||||
|
||||
var placeholders: [ContentItem] {
|
||||
(0 ..< 9).map { _ in .init() }
|
||||
items.isEmpty ? (allowEmpty ? items : ContentItem.placeholders) : items.sorted { $0 < $1 }
|
||||
}
|
||||
|
||||
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
||||
|
@ -80,7 +80,7 @@ struct VideoBanner: View {
|
||||
if !inChannelView, !video.isLocal || video.localStreamIsRemoteURL {
|
||||
ChannelLinkView(channel: video.channel) {
|
||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||
if let url = video.channel.thumbnailURLOrCached {
|
||||
if let url = video.channel.thumbnailURLOrCached, video != .fixture {
|
||||
ThumbnailView(url: url)
|
||||
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
||||
.clipShape(Circle())
|
||||
|
@ -169,7 +169,8 @@ struct VideoCell: View {
|
||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||
if !inChannelView,
|
||||
let video,
|
||||
let url = video.channel.thumbnailURLOrCached
|
||||
let url = video.channel.thumbnailURLOrCached,
|
||||
video != .fixture
|
||||
{
|
||||
ChannelLinkView(channel: video.channel) {
|
||||
ThumbnailView(url: url)
|
||||
@ -271,7 +272,9 @@ struct VideoCell: View {
|
||||
if !channelOnThumbnail, !inChannelView {
|
||||
ChannelLinkView(channel: video.channel) {
|
||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||
if let url = video.channel.thumbnailURLOrCached {
|
||||
if let url = video.channel.thumbnailURLOrCached,
|
||||
video != .fixture
|
||||
{
|
||||
ThumbnailView(url: url)
|
||||
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
||||
.clipShape(Circle())
|
||||
@ -297,7 +300,8 @@ struct VideoCell: View {
|
||||
if channelOnThumbnail,
|
||||
!inChannelView,
|
||||
let video,
|
||||
let url = video.channel.thumbnailURLOrCached
|
||||
let url = video.channel.thumbnailURLOrCached,
|
||||
video != .fixture
|
||||
{
|
||||
ChannelLinkView(channel: video.channel) {
|
||||
ThumbnailView(url: url)
|
||||
|
@ -71,6 +71,7 @@ struct ContentItemView: View {
|
||||
@ViewBuilder func placeholderItem() -> some View {
|
||||
if listingStyle == .cells {
|
||||
PlaceholderCell()
|
||||
.id(item.id)
|
||||
} else {
|
||||
PlaceholderListItem()
|
||||
#if os(tvOS)
|
||||
|
Loading…
Reference in New Issue
Block a user