fix(creator): 팬Talk 답글 수정을 확인한다
This commit is contained in:
@@ -20,7 +20,7 @@ struct CreatorChannelFanTalkListItem: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.leading, 50)
|
||||
.background(alignment: .topLeading) {
|
||||
if fanTalk.creatorReplies.isEmpty == false {
|
||||
if fanTalk.latestCreatorReply != nil {
|
||||
GeometryReader { proxy in
|
||||
CreatorChannelFanTalkReplyConnector()
|
||||
.stroke(Color.gray800, style: StrokeStyle(lineWidth: 2, lineCap: .round, lineJoin: .round))
|
||||
@@ -29,7 +29,7 @@ struct CreatorChannelFanTalkListItem: View {
|
||||
}
|
||||
}
|
||||
|
||||
if fanTalk.creatorReplies.isEmpty == false {
|
||||
if fanTalk.latestCreatorReply != nil {
|
||||
replies
|
||||
.padding(.leading, 50)
|
||||
}
|
||||
@@ -95,7 +95,7 @@ struct CreatorChannelFanTalkListItem: View {
|
||||
|
||||
private var replies: some View {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
|
||||
ForEach(fanTalk.creatorReplies) { reply in
|
||||
if let reply = fanTalk.latestCreatorReply {
|
||||
replyCard(reply)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,21 @@ struct CreatorChannelFanTalkItemResponse: Decodable, Identifiable {
|
||||
let creatorReplies: [CreatorChannelFanTalkReplyResponse]
|
||||
|
||||
var id: Int { fanTalkId }
|
||||
|
||||
var latestCreatorReply: CreatorChannelFanTalkReplyResponse? {
|
||||
creatorReplies.max { lhs, rhs in
|
||||
switch (DateParser.parse(lhs.createdAtUtc), DateParser.parse(rhs.createdAtUtc)) {
|
||||
case let (lhsDate?, rhsDate?):
|
||||
return lhsDate < rhsDate
|
||||
case (nil, _?):
|
||||
return true
|
||||
case (_?, nil):
|
||||
return false
|
||||
case (nil, nil):
|
||||
return lhs.createdAtUtc < rhs.createdAtUtc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelFanTalkReplyResponse: Decodable, Identifiable {
|
||||
|
||||
Reference in New Issue
Block a user