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 video: Video!
|
||||||
var playlist: ChannelPlaylist!
|
var playlist: ChannelPlaylist!
|
||||||
var channel: Channel!
|
var channel: Channel!
|
||||||
|
@ -37,11 +37,7 @@ struct HorizontalCells: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var contentItems: [ContentItem] {
|
var contentItems: [ContentItem] {
|
||||||
items.isEmpty ? placeholders : items
|
items.isEmpty ? ContentItem.placeholders : items
|
||||||
}
|
|
||||||
|
|
||||||
var placeholders: [ContentItem] {
|
|
||||||
(0 ..< 9).map { _ in .init() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
||||||
|
@ -48,11 +48,7 @@ struct VerticalCells<Header: View>: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var contentItems: [ContentItem] {
|
var contentItems: [ContentItem] {
|
||||||
items.isEmpty ? (allowEmpty ? items : placeholders) : items.sorted { $0 < $1 }
|
items.isEmpty ? (allowEmpty ? items : ContentItem.placeholders) : items.sorted { $0 < $1 }
|
||||||
}
|
|
||||||
|
|
||||||
var placeholders: [ContentItem] {
|
|
||||||
(0 ..< 9).map { _ in .init() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
func loadMoreContentItemsIfNeeded(current item: ContentItem) {
|
||||||
|
@ -80,7 +80,7 @@ struct VideoBanner: View {
|
|||||||
if !inChannelView, !video.isLocal || video.localStreamIsRemoteURL {
|
if !inChannelView, !video.isLocal || video.localStreamIsRemoteURL {
|
||||||
ChannelLinkView(channel: video.channel) {
|
ChannelLinkView(channel: video.channel) {
|
||||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||||
if let url = video.channel.thumbnailURLOrCached {
|
if let url = video.channel.thumbnailURLOrCached, video != .fixture {
|
||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
|
@ -169,7 +169,8 @@ struct VideoCell: View {
|
|||||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||||
if !inChannelView,
|
if !inChannelView,
|
||||||
let video,
|
let video,
|
||||||
let url = video.channel.thumbnailURLOrCached
|
let url = video.channel.thumbnailURLOrCached,
|
||||||
|
video != .fixture
|
||||||
{
|
{
|
||||||
ChannelLinkView(channel: video.channel) {
|
ChannelLinkView(channel: video.channel) {
|
||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
@ -271,7 +272,9 @@ struct VideoCell: View {
|
|||||||
if !channelOnThumbnail, !inChannelView {
|
if !channelOnThumbnail, !inChannelView {
|
||||||
ChannelLinkView(channel: video.channel) {
|
ChannelLinkView(channel: video.channel) {
|
||||||
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
HStack(spacing: Constants.channelDetailsStackSpacing) {
|
||||||
if let url = video.channel.thumbnailURLOrCached {
|
if let url = video.channel.thumbnailURLOrCached,
|
||||||
|
video != .fixture
|
||||||
|
{
|
||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
.frame(width: Constants.channelThumbnailSize, height: Constants.channelThumbnailSize)
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
@ -297,7 +300,8 @@ struct VideoCell: View {
|
|||||||
if channelOnThumbnail,
|
if channelOnThumbnail,
|
||||||
!inChannelView,
|
!inChannelView,
|
||||||
let video,
|
let video,
|
||||||
let url = video.channel.thumbnailURLOrCached
|
let url = video.channel.thumbnailURLOrCached,
|
||||||
|
video != .fixture
|
||||||
{
|
{
|
||||||
ChannelLinkView(channel: video.channel) {
|
ChannelLinkView(channel: video.channel) {
|
||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
|
@ -71,6 +71,7 @@ struct ContentItemView: View {
|
|||||||
@ViewBuilder func placeholderItem() -> some View {
|
@ViewBuilder func placeholderItem() -> some View {
|
||||||
if listingStyle == .cells {
|
if listingStyle == .cells {
|
||||||
PlaceholderCell()
|
PlaceholderCell()
|
||||||
|
.id(item.id)
|
||||||
} else {
|
} else {
|
||||||
PlaceholderListItem()
|
PlaceholderListItem()
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
Loading…
Reference in New Issue
Block a user