mirror of
https://github.com/jellyfin/Swiftfin.git
synced 2024-11-23 05:59:51 +00:00
Fix Episode Selector Images (#1047)
This commit is contained in:
parent
936245e414
commit
329cf0d45f
@ -20,46 +20,60 @@ extension SeriesEpisodeSelector {
|
||||
|
||||
let episode: BaseItemDto
|
||||
|
||||
var body: some View {
|
||||
PosterButton(
|
||||
item: episode,
|
||||
type: .landscape
|
||||
)
|
||||
.content {
|
||||
let content: String = if episode.isUnaired {
|
||||
episode.airDateLabel ?? L10n.noOverviewAvailable
|
||||
@ViewBuilder
|
||||
private var imageOverlay: some View {
|
||||
ZStack {
|
||||
if episode.userData?.isPlayed ?? false {
|
||||
WatchedIndicator(size: 45)
|
||||
} else {
|
||||
episode.overview ?? L10n.noOverviewAvailable
|
||||
if (episode.userData?.playbackPositionTicks ?? 0) > 0 {
|
||||
LandscapePosterProgressBar(
|
||||
title: episode.progressLabel ?? L10n.continue,
|
||||
progress: (episode.userData?.playedPercentage ?? 0) / 100
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var episodeContent: String {
|
||||
if episode.isUnaired {
|
||||
episode.airDateLabel ?? L10n.noOverviewAvailable
|
||||
} else {
|
||||
episode.overview ?? L10n.noOverviewAvailable
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Button {
|
||||
guard let mediaSource = episode.mediaSources?.first else { return }
|
||||
router.route(to: \.videoPlayer, OnlineVideoPlayerManager(item: episode, mediaSource: mediaSource))
|
||||
} label: {
|
||||
ZStack {
|
||||
Color.clear
|
||||
|
||||
ImageView(episode.imageSource(.primary, maxWidth: 500))
|
||||
.failure {
|
||||
SystemImageContentView(systemName: episode.systemImage)
|
||||
}
|
||||
|
||||
imageOverlay
|
||||
}
|
||||
.posterStyle(.landscape)
|
||||
}
|
||||
.buttonStyle(.card)
|
||||
.posterShadow()
|
||||
|
||||
SeriesEpisodeSelector.EpisodeContent(
|
||||
subHeader: episode.episodeLocator ?? .emptyDash,
|
||||
header: episode.displayTitle,
|
||||
content: content
|
||||
content: episodeContent
|
||||
)
|
||||
.onSelect {
|
||||
router.route(to: \.item, episode)
|
||||
}
|
||||
}
|
||||
.imageOverlay {
|
||||
ZStack {
|
||||
if episode.userData?.isPlayed ?? false {
|
||||
WatchedIndicator(size: 45)
|
||||
} else {
|
||||
if (episode.userData?.playbackPositionTicks ?? 0) > 0 {
|
||||
LandscapePosterProgressBar(
|
||||
title: episode.progressLabel ?? L10n.continue,
|
||||
progress: (episode.userData?.playedPercentage ?? 0) / 100
|
||||
)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onSelect {
|
||||
guard let mediaSource = episode.mediaSources?.first else { return }
|
||||
router.route(to: \.videoPlayer, OnlineVideoPlayerManager(item: episode, mediaSource: mediaSource))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,34 +41,42 @@ extension SeriesEpisodeSelector {
|
||||
}
|
||||
}
|
||||
|
||||
private var episodeContent: String {
|
||||
if episode.isUnaired {
|
||||
episode.airDateLabel ?? L10n.noOverviewAvailable
|
||||
} else {
|
||||
episode.overview ?? L10n.noOverviewAvailable
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
PosterButton(
|
||||
item: episode,
|
||||
type: .landscape
|
||||
)
|
||||
.content {
|
||||
let content: String = if episode.isUnaired {
|
||||
episode.airDateLabel ?? L10n.noOverviewAvailable
|
||||
} else {
|
||||
episode.overview ?? L10n.noOverviewAvailable
|
||||
VStack(alignment: .leading) {
|
||||
Button {
|
||||
guard let mediaSource = episode.mediaSources?.first else { return }
|
||||
mainRouter.route(to: \.videoPlayer, OnlineVideoPlayerManager(item: episode, mediaSource: mediaSource))
|
||||
} label: {
|
||||
ZStack {
|
||||
Color.clear
|
||||
|
||||
ImageView(episode.imageSource(.primary, maxWidth: 500))
|
||||
.failure {
|
||||
SystemImageContentView(systemName: episode.systemImage)
|
||||
}
|
||||
|
||||
overlayView
|
||||
}
|
||||
.posterStyle(.landscape)
|
||||
}
|
||||
|
||||
SeriesEpisodeSelector.EpisodeContent(
|
||||
subHeader: episode.episodeLocator ?? .emptyDash,
|
||||
header: episode.displayTitle,
|
||||
content: content
|
||||
content: episodeContent
|
||||
)
|
||||
.onSelect {
|
||||
router.route(to: \.item, episode)
|
||||
}
|
||||
}
|
||||
.imageOverlay {
|
||||
overlayView
|
||||
}
|
||||
.onSelect {
|
||||
guard let mediaSource = episode.mediaSources?.first else { return }
|
||||
mainRouter.route(to: \.videoPlayer, OnlineVideoPlayerManager(item: episode, mediaSource: mediaSource))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user