66 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  LiveReservationStatusView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/11.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
 | 
						|
struct LiveReservationStatusView: View {
 | 
						|
    
 | 
						|
    @StateObject var viewModel = LiveReservationStatusViewModel()
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        BaseView(isLoading: $viewModel.isLoading) {
 | 
						|
            VStack(spacing: 0) {
 | 
						|
                DetailNavigationBar(title: "라이브 예약 현황")
 | 
						|
                
 | 
						|
                if viewModel.reservationStatusItems.count > 0 {
 | 
						|
                    ScrollView(.vertical, showsIndicators: false) {
 | 
						|
                        VStack(spacing: 13.3) {
 | 
						|
                            ForEach(viewModel.reservationStatusItems, id: \.self) { item in
 | 
						|
                                LiveReservationStatusItemView(item: item)
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        .padding(.vertical, 13.3)
 | 
						|
                    }
 | 
						|
                } else {
 | 
						|
                    Text("예약한 라이브가 없습니다.")
 | 
						|
                        .font(.custom(Font.medium.rawValue, size: 15))
 | 
						|
                        .foregroundColor(Color(hex: "bbbbbb"))
 | 
						|
                        .frame(maxHeight: .infinity)
 | 
						|
                }
 | 
						|
            }
 | 
						|
            .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
 | 
						|
                GeometryReader { geo in
 | 
						|
                    HStack {
 | 
						|
                        Spacer()
 | 
						|
                        Text(viewModel.errorMessage)
 | 
						|
                            .padding(.vertical, 13.3)
 | 
						|
                            .padding(.horizontal, 6.7)
 | 
						|
                            .frame(width: geo.size.width - 66.7, alignment: .center)
 | 
						|
                            .font(.custom(Font.medium.rawValue, size: 12))
 | 
						|
                            .background(Color(hex: "9970ff"))
 | 
						|
                            .foregroundColor(Color.white)
 | 
						|
                            .multilineTextAlignment(.leading)
 | 
						|
                            .fixedSize(horizontal: false, vertical: true)
 | 
						|
                            .cornerRadius(20)
 | 
						|
                            .padding(.top, 66.7)
 | 
						|
                        Spacer()
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            .onAppear {
 | 
						|
                viewModel.getLiveReservationStatus()
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct LiveReservationStatusView_Previews: PreviewProvider {
 | 
						|
    static var previews: some View {
 | 
						|
        LiveReservationStatusView()
 | 
						|
    }
 | 
						|
}
 |