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,28 +32,30 @@ struct ChapterView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
||||||
if #available(iOS 15, macOS 12, *) {
|
Group {
|
||||||
CachedAsyncImage(url: chapter.image) { image in
|
if #available(iOS 15, macOS 12, *) {
|
||||||
image
|
CachedAsyncImage(url: chapter.image) { image in
|
||||||
.resizable()
|
image
|
||||||
} placeholder: {
|
.resizable()
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
} placeholder: {
|
||||||
}
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
} else {
|
|
||||||
WebImage(url: chapter.image)
|
|
||||||
.resizable()
|
|
||||||
.placeholder {
|
|
||||||
ProgressView()
|
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
} else {
|
||||||
#if os(tvOS)
|
WebImage(url: chapter.image)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.resizable()
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.placeholder {
|
||||||
#else
|
ProgressView()
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
}
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.indicator(.activity)
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
#if os(tvOS)
|
||||||
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
|
#else
|
||||||
|
.frame(width: thumbnailWidth, height: 60)
|
||||||
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private var thumbnailWidth: Double {
|
private var thumbnailWidth: Double {
|
||||||
|
@ -73,35 +73,30 @@ 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)
|
||||||
if #available(iOS 15, macOS 12, *) {
|
Group {
|
||||||
CachedAsyncImage(url: url) { image in
|
if #available(iOS 15, macOS 12, *) {
|
||||||
image
|
CachedAsyncImage(url: url) { image in
|
||||||
.resizable()
|
image
|
||||||
} placeholder: {
|
.resizable()
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
} placeholder: {
|
||||||
}
|
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 {
|
|
||||||
WebImage(url: url)
|
|
||||||
.resizable()
|
|
||||||
.placeholder {
|
|
||||||
ProgressView()
|
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
} else {
|
||||||
#if os(tvOS)
|
WebImage(url: url)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.resizable()
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.placeholder {
|
||||||
#else
|
ProgressView()
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
}
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.indicator(.activity)
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
#if os(tvOS)
|
||||||
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
|
#else
|
||||||
|
.frame(width: thumbnailWidth, height: 60)
|
||||||
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private var thumbnailWidth: Double {
|
private var thumbnailWidth: Double {
|
||||||
|
@ -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)
|
|
||||||
.frame(minHeight: 320)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if os(tvOS)
|
||||||
|
.frame(minHeight: 320)
|
||||||
|
#endif
|
||||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||||
.modifier(AspectRatioModifier())
|
.modifier(AspectRatioModifier())
|
||||||
}
|
}
|
||||||
|
@ -38,23 +38,26 @@ struct ChannelCell: View {
|
|||||||
.opacity(0.6)
|
.opacity(0.6)
|
||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
if #available(iOS 15, macOS 12, *) {
|
|
||||||
CachedAsyncImage(url: channel.thumbnailURL) { image in
|
Group {
|
||||||
image
|
if #available(iOS 15, macOS 12, *) {
|
||||||
.resizable()
|
CachedAsyncImage(url: channel.thumbnailURL) { image in
|
||||||
} placeholder: {
|
image
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
.resizable()
|
||||||
}
|
} placeholder: {
|
||||||
} else {
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
WebImage(url: channel.thumbnailURL)
|
|
||||||
.resizable()
|
|
||||||
.placeholder {
|
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
} else {
|
||||||
.frame(width: 88, height: 88)
|
WebImage(url: channel.thumbnailURL)
|
||||||
.clipShape(Circle())
|
.resizable()
|
||||||
|
.placeholder {
|
||||||
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
}
|
||||||
|
.indicator(.activity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.frame(width: 88, height: 88)
|
||||||
|
.clipShape(Circle())
|
||||||
|
|
||||||
DetailBadge(text: channel.name, style: .prominent)
|
DetailBadge(text: channel.name, style: .prominent)
|
||||||
|
|
||||||
|
@ -38,23 +38,26 @@ struct ChannelPlaylistCell: View {
|
|||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
if #available(iOS 15, macOS 12, *) {
|
Group {
|
||||||
CachedAsyncImage(url: playlist.thumbnailURL) { image in
|
if #available(iOS 15, macOS 12, *) {
|
||||||
image
|
CachedAsyncImage(url: playlist.thumbnailURL) { image in
|
||||||
.resizable()
|
image
|
||||||
} placeholder: {
|
.resizable()
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
} placeholder: {
|
||||||
}
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
} else {
|
|
||||||
WebImage(url: playlist.thumbnailURL)
|
|
||||||
.resizable()
|
|
||||||
.placeholder {
|
|
||||||
Rectangle().fill(Color("PlaceholderColor"))
|
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
} else {
|
||||||
.frame(width: 165, height: 88)
|
WebImage(url: playlist.thumbnailURL)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
.resizable()
|
||||||
|
.placeholder {
|
||||||
|
Rectangle().fill(Color("PlaceholderColor"))
|
||||||
|
}
|
||||||
|
.indicator(.activity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.frame(width: 165, height: 88)
|
||||||
|
.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