damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 297aaf86c6130516953f726ffcf5b1e073d2bbf8
parent f6dd060580f3cee7ff62b1050ffb36462b1df1b8
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 29 May 2023 14:31:54 -0700

carousel: only show blurhash when there is one images

Blurhash interacts strangely with carousel

Diffstat:
Mdamus/Components/ImageCarousel.swift | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/damus/Components/ImageCarousel.swift b/damus/Components/ImageCarousel.swift @@ -87,9 +87,12 @@ struct ImageCarousel: View { image_fill?.height ?? fillHeight } - func Placeholder(url: URL, geo_size: CGSize) -> some View { + func Placeholder(url: URL, geo_size: CGSize, num_urls: Int) -> some View { Group { - if let meta = state.events.lookup_img_metadata(url: url), + if num_urls > 1 { + // jb55: quick hack since carousel with multiple images looks horrible with blurhash background + Color.clear + } else if let meta = state.events.lookup_img_metadata(url: url), case .processed(let blurhash) = meta.state { Image(uiImage: blurhash) .resizable() @@ -141,7 +144,7 @@ struct ImageCarousel: View { } } .background { - Placeholder(url: url, geo_size: geo.size) + Placeholder(url: url, geo_size: geo.size, num_urls: urls.count) } .aspectRatio(contentMode: filling ? .fill : .fit) //.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)