diff --git a/iphone/Maps/Tourism/Presentation/Components/LoadImg.swift b/iphone/Maps/Tourism/Presentation/Components/LoadImg.swift index 3946f288f5..a399f8f9c8 100644 --- a/iphone/Maps/Tourism/Presentation/Components/LoadImg.swift +++ b/iphone/Maps/Tourism/Presentation/Components/LoadImg.swift @@ -7,7 +7,7 @@ struct LoadImageView: View { @State var isError = false var body: some View { - if let urlString = url { + if let urlString = url, urlString != "" { ZStack(alignment: .center) { WebImage(url: URL(string: urlString)) .onSuccess(perform: { Image, data, cache in diff --git a/iphone/Maps/Tourism/Presentation/Home/Screens/Home/HorizontalPlaces.swift b/iphone/Maps/Tourism/Presentation/Home/Screens/Home/HorizontalPlaces.swift index 8fe497e5f2..d04e5b9ca6 100644 --- a/iphone/Maps/Tourism/Presentation/Home/Screens/Home/HorizontalPlaces.swift +++ b/iphone/Maps/Tourism/Presentation/Home/Screens/Home/HorizontalPlaces.swift @@ -45,57 +45,55 @@ struct Place: View { var body: some View { ZStack() { - LoadImageView(url: place.cover) - - VStack { - Spacer() - HStack() { - VStack(alignment: .leading) { - Text(place.name) - .font(.semiBold(size: 15)) - .foregroundColor(.white) - .lineLimit(2) - VerticalSpace(height: 4) - - HStack(alignment: .center) { - Text(String(format: "%.1f", place.rating ?? 0.0)) - .font(.semiBold(size: 15)) - .foregroundColor(.white) - Image(systemName: "star.fill") - .resizable() - .foregroundColor(Color.starYellow) - .frame(width: 10, height: 10) - } - } - .padding(12) - - Spacer() - } - .frame(width: width) - .background(SwiftUI.Color.black.opacity(0.5)) - } - - HStack { - Spacer() - VStack { - Button(action: { - onFavoriteChanged(!isFavorite) - }) { - Image(systemName: isFavorite ? "heart.fill" : "heart") - .foregroundColor(.white) - .padding(12) - .background(SwiftUI.Color.white.opacity(0.2)) - .clipShape(Circle()) - } - Spacer() - } - } - .padding(12) + // cover + LoadImageView(url: place.cover) .frame(width: width, height: height) } + .overlay( + // title and rating + HStack() { + VStack(alignment: .leading) { + Text(place.name) + .font(.semiBold(size: 15)) + .foregroundColor(.white) + .lineLimit(2) + VerticalSpace(height: 4) + + HStack(alignment: .center) { + Text(String(format: "%.1f", place.rating ?? 0.0)) + .font(.semiBold(size: 15)) + .foregroundColor(.white) + Image(systemName: "star.fill") + .resizable() + .foregroundColor(Color.starYellow) + .frame(width: 10, height: 10) + } + } + .padding(12) + + Spacer() + } + .frame(width: width) + .background(SwiftUI.Color.black.opacity(0.5)), + alignment: .bottom + ) + .overlay( + // favorite button + Button(action: { + onFavoriteChanged(!isFavorite) + }) { + Image(systemName: isFavorite ? "heart.fill" : "heart") + .foregroundColor(.white) + .padding(12) + .background(SwiftUI.Color.white.opacity(0.2)) + .clipShape(Circle()) + } + .padding(12), + alignment: .topTrailing + ) .frame(width: width, height: height) .clipShape(RoundedRectangle(cornerRadius: 16)) - .contentShape(Rectangle()) // Add this line + .contentShape(Rectangle()) .onTapGesture(perform: onPlaceClick) } }