Files
sodalive-ios/SodaLive/Sources/Live/Reservation/Complete/LiveReservationCompleteView.swift

208 lines
11 KiB
Swift

//
// LiveReservationCompleteView.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import SwiftUI
struct LiveReservationCompleteView: View {
let reservationCompleteData: MakeLiveReservationResponse
var body: some View {
BaseView {
VStack(spacing: 0) {
DetailNavigationBar(title: I18n.LiveReservation.Complete.title) {
AppState.shared.setAppStep(step: .main)
}
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
Text(I18n.LiveReservation.Complete.completedMessage)
.appFont(size: 20, weight: .bold)
.foregroundColor(Color(hex: "a285eb"))
.frame(width: screenSize().width - 26.7, alignment: .leading)
.padding(.top, 20)
Image("img_compleate_book")
.resizable()
.scaledToFit()
.frame(width: 233.25)
.padding(.top, 16.7)
.padding(.bottom, 26.7)
Text(I18n.LiveReservation.Complete.reservationInfoTitle)
.appFont(size: 16.7, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 53.4, alignment: .leading)
VStack(spacing: 6.7) {
HStack(spacing: 26.7) {
Text(I18n.LiveReservation.Complete.channelLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.nickname)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text(I18n.LiveReservation.Complete.purchaseDetailLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.title)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text(I18n.LiveReservation.Complete.reservationDateLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
let beginDateText = reservationCompleteData.beginDateTimeUtc
.parseUtcIsoDate()?
.convertDateFormat(dateFormat: "yyyy.MM.dd E hh:mm a")
?? reservationCompleteData.beginDateTimeUtc
Text(beginDateText)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text(I18n.LiveReservation.Complete.liveCostLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.price)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
}
.padding(.top, 16.7)
Rectangle()
.frame(width: screenSize().width, height: 6.7)
.foregroundColor(Color(hex: "232323"))
.padding(.vertical, 20)
Text(I18n.LiveReservation.Complete.paymentInfoTitle)
.appFont(size: 16.7, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 53.4, alignment: .leading)
VStack(spacing: 13.3) {
HStack(spacing: 0) {
Text(I18n.LiveReservation.Complete.ownedCanLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.haveCan)")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
Text(I18n.LiveReservation.Complete.canSuffix)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 0) {
Text(I18n.LiveReservation.Complete.paymentCanLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.useCan)")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
Text(I18n.LiveReservation.Complete.canSuffix)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 0) {
Text(I18n.LiveReservation.Complete.remainingCanLabel)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.remainingCan)")
.appFont(size: 15.3, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
Text(I18n.LiveReservation.Complete.canSuffix)
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
}
.padding(.top, 20)
HStack(spacing: 13.3) {
Text(I18n.LiveReservation.Complete.goHome)
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color(hex: "9970ff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff").opacity(0.2))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
)
.onTapGesture {
AppState.shared.setAppStep(step: .main)
}
Text(I18n.LiveReservation.Complete.goReservationList)
.appFont(size: 18.3, weight: .bold)
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff"))
.cornerRadius(10)
.onTapGesture {
AppState.shared.setAppStep(step: .liveReservation)
}
}
.padding(.vertical, 26.7)
}
}
}
}
}
}
struct LiveReservationCompleteView_Previews: PreviewProvider {
static var previews: some View {
LiveReservationCompleteView(
reservationCompleteData: MakeLiveReservationResponse(
reservationId: 10,
nickname: "김상담",
title: "여자들이 좋아하는 남자 스타일은?",
beginDateTimeUtc: "2021-07-09T05:00:00",
price: "무료",
haveCan: 100,
useCan: 0,
remainingCan: 100
)
)
}
}