Add list views for channels, playlists and placeholders

This commit is contained in:
Arkadiusz Fal
2022-12-13 11:40:08 +01:00
parent d38a507be5
commit 1cd2dbe5f7
11 changed files with 332 additions and 43 deletions

View File

@@ -9,28 +9,77 @@ struct ContentItemView: View {
Group {
switch item.contentType {
case .video:
if listingStyle == .cells {
VideoCell(video: item.video)
} else {
PlayerQueueRow(item: .init(item.video))
.contextMenu {
VideoContextMenuView(video: item.video)
}
#if os(tvOS)
.padding(.horizontal, 30)
#endif
#if !os(tvOS)
Divider()
#endif
}
case .playlist:
ChannelPlaylistCell(playlist: item.playlist)
videoItem(item.video)
case .channel:
ChannelCell(channel: item.channel)
channelItem(item.channel)
case .playlist:
playlistItem(item.playlist)
default:
PlaceholderCell()
placeholderItem()
}
}
}
@ViewBuilder func videoItem(_ video: Video) -> some View {
if listingStyle == .cells {
VideoCell(video: video)
} else {
PlayerQueueRow(item: .init(video))
.contextMenu {
VideoContextMenuView(video: video)
}
#if os(tvOS)
.padding(.horizontal, 30)
#endif
#if !os(tvOS)
Divider()
#endif
}
}
@ViewBuilder func playlistItem(_ playlist: ChannelPlaylist) -> some View {
if listingStyle == .cells {
ChannelPlaylistCell(playlist: playlist)
} else {
ChannelPlaylistListItem(playlist: playlist)
#if os(tvOS)
.padding(.horizontal, 30)
#endif
#if !os(tvOS)
Divider()
#endif
}
}
@ViewBuilder func channelItem(_ channel: Channel) -> some View {
if listingStyle == .cells {
ChannelCell(channel: channel)
} else {
ChannelListItem(channel: channel)
#if os(tvOS)
.padding(.horizontal, 30)
#endif
#if !os(tvOS)
Divider()
#endif
}
}
@ViewBuilder func placeholderItem() -> some View {
if listingStyle == .cells {
PlaceholderCell()
} else {
PlaceholderListItem()
#if os(tvOS)
.padding(.horizontal, 30)
#endif
#if !os(tvOS)
Divider()
#endif
}
}
}