36 lines
982 B
Swift
36 lines
982 B
Swift
import SwiftUI
|
|
|
|
struct MainContentAudioBannerSection: View {
|
|
let items: [AudioBannerResponse]
|
|
let onTapBanner: (AudioBannerResponse) -> Void
|
|
|
|
var body: some View {
|
|
BannerCarouselSection(
|
|
items: items,
|
|
id: fallbackId,
|
|
imageUrl: { $0.imageUrl },
|
|
action: onTapBanner
|
|
)
|
|
}
|
|
|
|
private func fallbackId(for item: AudioBannerResponse, index: Int) -> String {
|
|
if let eventItem = item.eventItem {
|
|
return "content-banner-\(index)-event-\(eventItem.id)"
|
|
}
|
|
|
|
if let creatorId = item.creatorId {
|
|
return "content-banner-\(index)-creator-\(creatorId)"
|
|
}
|
|
|
|
if let seriesId = item.seriesId {
|
|
return "content-banner-\(index)-series-\(seriesId)"
|
|
}
|
|
|
|
if let link = item.link, !link.isEmpty {
|
|
return "content-banner-\(index)-link-\(link)"
|
|
}
|
|
|
|
return "content-banner-\(index)-image-\(item.imageUrl)"
|
|
}
|
|
}
|