mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix images layout
This commit is contained in:
parent
79512d4cbf
commit
f7dd88a6cb
@ -32,6 +32,7 @@ struct ChapterView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
||||||
|
Group {
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
CachedAsyncImage(url: chapter.image) { image in
|
CachedAsyncImage(url: chapter.image) { image in
|
||||||
image
|
image
|
||||||
@ -46,6 +47,8 @@ struct ChapterView: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
@ -54,7 +57,6 @@ struct ChapterView: View {
|
|||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private var thumbnailWidth: Double {
|
private var thumbnailWidth: Double {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -73,6 +73,7 @@ struct VideoBanner: View {
|
|||||||
|
|
||||||
@ViewBuilder private var smallThumbnail: some View {
|
@ViewBuilder private var smallThumbnail: some View {
|
||||||
let url = video?.thumbnailURL(quality: .medium)
|
let url = video?.thumbnailURL(quality: .medium)
|
||||||
|
Group {
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
CachedAsyncImage(url: url) { image in
|
CachedAsyncImage(url: url) { image in
|
||||||
image
|
image
|
||||||
@ -80,13 +81,6 @@ struct VideoBanner: View {
|
|||||||
} placeholder: {
|
} placeholder: {
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
|
||||||
#else
|
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
WebImage(url: url)
|
WebImage(url: url)
|
||||||
.resizable()
|
.resizable()
|
||||||
@ -94,6 +88,8 @@ struct VideoBanner: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
@ -102,7 +98,6 @@ struct VideoBanner: View {
|
|||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private var thumbnailWidth: Double {
|
private var thumbnailWidth: Double {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
|
@ -429,9 +429,6 @@ struct VideoCell: View {
|
|||||||
} placeholder: {
|
} placeholder: {
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
|
||||||
.frame(minHeight: 320)
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
WebImage(url: url)
|
WebImage(url: url)
|
||||||
.resizable()
|
.resizable()
|
||||||
@ -443,12 +440,11 @@ struct VideoCell: View {
|
|||||||
guard let url = url else { return }
|
guard let url = url else { return }
|
||||||
thumbnails.insertUnloadable(url)
|
thumbnails.insertUnloadable(url)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(minHeight: 320)
|
.frame(minHeight: 320)
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||||
.modifier(AspectRatioModifier())
|
.modifier(AspectRatioModifier())
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ struct ChannelCell: View {
|
|||||||
.opacity(0.6)
|
.opacity(0.6)
|
||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Group {
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
CachedAsyncImage(url: channel.thumbnailURL) { image in
|
CachedAsyncImage(url: channel.thumbnailURL) { image in
|
||||||
image
|
image
|
||||||
@ -52,9 +54,10 @@ struct ChannelCell: View {
|
|||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
.frame(width: 88, height: 88)
|
.frame(width: 88, height: 88)
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
}
|
|
||||||
|
|
||||||
DetailBadge(text: channel.name, style: .prominent)
|
DetailBadge(text: channel.name, style: .prominent)
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ struct ChannelPlaylistCell: View {
|
|||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Group {
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
CachedAsyncImage(url: playlist.thumbnailURL) { image in
|
CachedAsyncImage(url: playlist.thumbnailURL) { image in
|
||||||
image
|
image
|
||||||
@ -52,9 +53,11 @@ struct ChannelPlaylistCell: View {
|
|||||||
Rectangle().fill(Color("PlaceholderColor"))
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
.frame(width: 165, height: 88)
|
.frame(width: 165, height: 88)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
}
|
|
||||||
Group {
|
Group {
|
||||||
DetailBadge(text: playlist.title, style: .prominent)
|
DetailBadge(text: playlist.title, style: .prominent)
|
||||||
.lineLimit(2)
|
.lineLimit(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user