Fix Collection/Episode Item Empty Image and Cleanup (#1046)

This commit is contained in:
Ethan Pippin 2024-04-24 21:54:48 -06:00 committed by GitHub
parent 3ba922b4bd
commit 2a9d7c7d17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 5 deletions

View File

@ -73,7 +73,7 @@ struct ChannelLibraryView: View {
// MARK: item view
private func narrowChannelView(channel: ChannelProgram) -> some View {
private func compactChannelView(channel: ChannelProgram) -> some View {
CompactChannelView(channel: channel.channel)
.onSelect {
guard let mediaSource = channel.channel.mediaSources?.first else { return }
@ -84,7 +84,7 @@ struct ChannelLibraryView: View {
}
}
private func wideChannelView(channel: ChannelProgram) -> some View {
private func detailedChannelView(channel: ChannelProgram) -> some View {
DetailedChannelView(channel: channel)
.onSelect {
guard let mediaSource = channel.channel.mediaSources?.first else { return }
@ -102,9 +102,9 @@ struct ChannelLibraryView: View {
) { channel in
switch channelDisplayType {
case .grid:
narrowChannelView(channel: channel)
compactChannelView(channel: channel)
case .list:
wideChannelView(channel: channel)
detailedChannelView(channel: channel)
}
}
.onReachedBottomEdge(offset: .offset(300)) {

View File

@ -68,7 +68,7 @@ extension ChannelLibraryView {
private func programLabel(for program: BaseItemDto) -> some View {
HStack(alignment: .top) {
AlternateLayoutView(alignment: .leading) {
Text(Date(timeIntervalSince1970: 0), style: .time)
Text("00:00 AAA")
.monospacedDigit()
} content: {
if let startDate = program.startDate {

View File

@ -6,6 +6,7 @@
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import BlurHashKit
import JellyfinAPI
import SwiftUI
@ -24,6 +25,17 @@ extension CollectionItemView {
VStack(alignment: .center) {
ImageView(viewModel.item.imageSource(.backdrop, maxWidth: 600))
.placeholder { source in
if let blurHash = source.blurHash {
BlurHashView(blurHash: blurHash, size: .Square(length: 8))
} else {
Color.secondarySystemFill
.opacity(0.75)
}
}
.failure {
SystemImageContentView(systemName: viewModel.item.systemImage)
}
.posterStyle(.landscape, contentMode: .fill)
.frame(maxHeight: 300)
.posterShadow()

View File

@ -6,6 +6,7 @@
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import BlurHashKit
import JellyfinAPI
import SwiftUI
@ -24,6 +25,17 @@ extension EpisodeItemView {
VStack(alignment: .center) {
ImageView(viewModel.item.imageSource(.primary, maxWidth: 600))
.placeholder { source in
if let blurHash = source.blurHash {
BlurHashView(blurHash: blurHash, size: .Square(length: 8))
} else {
Color.secondarySystemFill
.opacity(0.75)
}
}
.failure {
SystemImageContentView(systemName: viewModel.item.systemImage)
}
.frame(maxHeight: 300)
.posterStyle(.landscape)
.posterShadow()