91 lines
3.3 KiB
Swift
91 lines
3.3 KiB
Swift
import SwiftUI
|
|
|
|
struct CreatorChannelFanTalkSection: View {
|
|
let fanTalk: CreatorChannelFanTalkSummaryResponse
|
|
let onSelectTab: (CreatorChannelTab) -> Void
|
|
|
|
var body: some View {
|
|
if let latestFanTalk = fanTalk.latestFanTalk {
|
|
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
|
SectionTitle(title: I18n.CreatorChannelHome.fanTalk) {
|
|
onSelectTab(.fanTalk)
|
|
}
|
|
|
|
CreatorChannelFanTalkCard(
|
|
totalCount: fanTalk.totalCount,
|
|
latestFanTalk: latestFanTalk
|
|
)
|
|
.padding(.horizontal, SodaSpacing.s14)
|
|
}
|
|
.padding(.top, SodaSpacing.s20)
|
|
}
|
|
}
|
|
}
|
|
|
|
private struct CreatorChannelFanTalkCard: View {
|
|
let totalCount: Int
|
|
let latestFanTalk: CreatorChannelFanTalkResponse
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
|
|
HStack(spacing: SodaSpacing.s4) {
|
|
Text("전체")
|
|
.appFont(size: 16, weight: .medium)
|
|
.foregroundColor(.white)
|
|
|
|
Text("\(totalCount)")
|
|
.appFont(size: 16, weight: .medium)
|
|
.foregroundColor(Color.gray500)
|
|
}
|
|
|
|
HStack(alignment: .center, spacing: SodaSpacing.s14) {
|
|
DownsampledKFImage(
|
|
url: URL(string: latestFanTalk.profileImageUrl),
|
|
size: CGSize(width: 28, height: 28)
|
|
)
|
|
.background(Color.white.opacity(0.9))
|
|
.clipShape(Circle())
|
|
|
|
Text(latestFanTalk.content)
|
|
.appFont(size: 14, weight: .regular)
|
|
.foregroundColor(.white)
|
|
.lineLimit(2)
|
|
.truncationMode(.tail)
|
|
.frame(maxWidth: .infinity, minHeight: 40, alignment: .leading)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
Image(systemName: "chevron.down")
|
|
.font(.system(size: 12, weight: .medium))
|
|
.foregroundColor(.white)
|
|
.frame(width: 18, height: 18)
|
|
}
|
|
}
|
|
.padding(SodaSpacing.s14)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.background(Color.gray900)
|
|
.clipShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
|
}
|
|
}
|
|
|
|
struct CreatorChannelFanTalkSection_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CreatorChannelFanTalkSection(
|
|
fanTalk: CreatorChannelFanTalkSummaryResponse(
|
|
totalCount: 23,
|
|
latestFanTalk: CreatorChannelFanTalkResponse(
|
|
fanTalkId: 1,
|
|
memberId: 10,
|
|
nickname: "팬 닉네임",
|
|
profileImageUrl: "https://picsum.photos/120/120",
|
|
content: "팬이 쓴 응원이 보이는 부분입니다. 두 줄까지만 보여주고 초과 시 말줄임 처리합니다.",
|
|
languageCode: "ko",
|
|
createdAtUtc: "2026-07-03T03:44:00Z"
|
|
)
|
|
),
|
|
onSelectTab: { _ in }
|
|
)
|
|
.background(Color.black)
|
|
.previewLayout(.sizeThatFits)
|
|
}
|
|
}
|