92 lines
3.8 KiB
Swift
92 lines
3.8 KiB
Swift
import SwiftUI
|
|
|
|
struct GiftCancelCompleteView: View {
|
|
let model: SentGiftDetailDisplayModel
|
|
@State private var isNavigating = false
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: SodaSpacing.s32) {
|
|
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
|
Text("취소 완료")
|
|
.appFont(.caption2)
|
|
.foregroundColor(.white)
|
|
.padding(.horizontal, SodaSpacing.s8)
|
|
.padding(.vertical, SodaSpacing.s4)
|
|
.background(Color.gray700)
|
|
.clipShape(RoundedRectangle(cornerRadius: SodaRadius.r4))
|
|
|
|
Text("선물 신청이 취소되었어요")
|
|
.appFont(.heading2)
|
|
.foregroundColor(.white)
|
|
.accessibilityAddTraits(.isHeader)
|
|
|
|
Text(completionMessage)
|
|
.appFont(.body6)
|
|
.foregroundColor(.gray300)
|
|
}
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
VStack(spacing: SodaSpacing.s12) {
|
|
GiftInfoSectionView(title: "취소 상세") {
|
|
if let creatorNickname {
|
|
GiftInfoRow(title: "크리에이터", value: creatorNickname)
|
|
}
|
|
GiftInfoRow(title: "선물 사이즈", value: model.sizeName)
|
|
GiftInfoRow(title: "카테고리", value: model.categoryName)
|
|
GiftInfoRow(title: "신청번호", value: model.applicationNo)
|
|
if let applicationDate = model.applicationDateText {
|
|
GiftInfoRow(title: "신청일", value: applicationDate)
|
|
}
|
|
if let canceledDate = model.canceledDateText {
|
|
GiftInfoRow(title: "취소일", value: canceledDate)
|
|
}
|
|
if let paidCan = model.paidCan {
|
|
GiftInfoRow(title: "환불 캔", value: String(paidCan))
|
|
}
|
|
}
|
|
|
|
inquiryButton
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.onAppear {
|
|
isNavigating = false
|
|
}
|
|
}
|
|
|
|
private var inquiryButton: some View {
|
|
Button {
|
|
guard !isNavigating else { return }
|
|
isNavigating = true
|
|
ServiceCenterInquiry.openTalk()
|
|
} label: {
|
|
Text("문의하기")
|
|
.appFont(.body2)
|
|
.foregroundColor(isNavigating ? .gray500 : .white)
|
|
.multilineTextAlignment(.center)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
.padding(.horizontal, SodaSpacing.s16)
|
|
.padding(.vertical, SodaSpacing.s12)
|
|
.frame(maxWidth: .infinity, minHeight: SodaSpacing.s48)
|
|
.overlay(Capsule().strokeBorder(Color.gray800))
|
|
.contentShape(Capsule())
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(isNavigating)
|
|
}
|
|
|
|
private var creatorNickname: String? {
|
|
guard let nickname = model.recipientCreatorNickname?.trimmingCharacters(in: .whitespacesAndNewlines),
|
|
!nickname.isEmpty else { return nil }
|
|
return nickname
|
|
}
|
|
|
|
private var completionMessage: String {
|
|
let recipient = creatorNickname.map { "\($0)에게 보내는 " } ?? ""
|
|
let applicationNo = model.applicationNo.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
let application = applicationNo.isEmpty ? "" : "(\(applicationNo))"
|
|
return "\(recipient)선물 신청\(application)이 취소되었습니다. 취소한 신청은 되돌릴 수 없으며, 다시 보내려면 새로 신청해 주세요."
|
|
}
|
|
}
|