feat: 메인 라이브
- 라이브 예약중 UI 적용
This commit is contained in:
		@@ -12,87 +12,153 @@ struct LiveReservationItemView: View {
 | 
			
		||||
    
 | 
			
		||||
    let item: GetRoomListResponse
 | 
			
		||||
    
 | 
			
		||||
    @State var dateDic: [String: String] = [:]
 | 
			
		||||
    
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack(alignment: .leading, spacing: 13.3) {
 | 
			
		||||
            HStack(spacing: 20) {
 | 
			
		||||
                ZStack(alignment: .topLeading) {
 | 
			
		||||
                    KFImage(URL(string: item.coverImageUrl))
 | 
			
		||||
                        .cancelOnDisappear(true)
 | 
			
		||||
                        .downsampling(
 | 
			
		||||
                            size: CGSize(
 | 
			
		||||
                                width: 80,
 | 
			
		||||
                                height: 116
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
                        .resizable()
 | 
			
		||||
                        .scaledToFill()
 | 
			
		||||
                        .frame(width: 80, height: 116, alignment: .top)
 | 
			
		||||
                        .cornerRadius(4.7)
 | 
			
		||||
                        .clipped()
 | 
			
		||||
                }
 | 
			
		||||
        HStack(spacing: 16) {
 | 
			
		||||
            ZStack(alignment: .topLeading) {
 | 
			
		||||
                KFImage(URL(string: item.creatorProfileImage))
 | 
			
		||||
                    .cancelOnDisappear(true)
 | 
			
		||||
                    .resizable()
 | 
			
		||||
                    .scaledToFill()
 | 
			
		||||
                    .frame(width: 100, height: 100, alignment: .top)
 | 
			
		||||
                    .cornerRadius(16)
 | 
			
		||||
                    .clipped()
 | 
			
		||||
                
 | 
			
		||||
                HStack(alignment: .top, spacing: 0) {
 | 
			
		||||
                    VStack(alignment: .leading, spacing: 0) {
 | 
			
		||||
                        Text(item.beginDateTime)
 | 
			
		||||
                            .font(.custom(Font.medium.rawValue, size: 9.3))
 | 
			
		||||
                            .foregroundColor(Color(hex: "ffd300"))
 | 
			
		||||
                        
 | 
			
		||||
                        Text(item.creatorNickname)
 | 
			
		||||
                            .font(.custom(Font.medium.rawValue, size: 11.3))
 | 
			
		||||
                            .foregroundColor(Color(hex: "bbbbbb"))
 | 
			
		||||
                            .padding(.top, 10)
 | 
			
		||||
                        
 | 
			
		||||
                        Text(item.title)
 | 
			
		||||
                            .font(.custom(Font.medium.rawValue, size: 15.3))
 | 
			
		||||
                            .foregroundColor(Color(hex: "e2e2e2"))
 | 
			
		||||
                            .padding(.top, 4.3)
 | 
			
		||||
                        
 | 
			
		||||
                        Spacer()
 | 
			
		||||
                        
 | 
			
		||||
                        if item.isReservation {
 | 
			
		||||
                            Text("예약완료")
 | 
			
		||||
                                .font(.custom(Font.medium.rawValue, size: 11.3))
 | 
			
		||||
                                .foregroundColor(Color(hex: "d2d2d2"))
 | 
			
		||||
                                .padding(.horizontal, 7)
 | 
			
		||||
                                .padding(.vertical, 4)
 | 
			
		||||
                                .background(Color(hex: "533d89"))
 | 
			
		||||
                                .cornerRadius(10)
 | 
			
		||||
                        } else {
 | 
			
		||||
                            if item.price > 0 {
 | 
			
		||||
                                Text("\(item.price)캔")
 | 
			
		||||
                                    .font(.custom(Font.medium.rawValue, size: 12))
 | 
			
		||||
                                    .foregroundColor(
 | 
			
		||||
                                        Color(hex: "e2e2e2")
 | 
			
		||||
                                            .opacity(0.5)
 | 
			
		||||
                                    )
 | 
			
		||||
                                
 | 
			
		||||
                            } else {
 | 
			
		||||
                                Text("무료")
 | 
			
		||||
                                    .font(.custom(Font.medium.rawValue, size: 12))
 | 
			
		||||
                                    .foregroundColor(
 | 
			
		||||
                                        Color(hex: "e2e2e2")
 | 
			
		||||
                                            .opacity(0.5)
 | 
			
		||||
                                    )
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    
 | 
			
		||||
                    Spacer()
 | 
			
		||||
                    
 | 
			
		||||
                    if item.isPrivateRoom {
 | 
			
		||||
                        Image("ic_lock")
 | 
			
		||||
                            .resizable()
 | 
			
		||||
                            .frame(width: 20, height: 20)
 | 
			
		||||
                    }
 | 
			
		||||
                if item.isPrivateRoom {
 | 
			
		||||
                    Image("ic_lock")
 | 
			
		||||
                        .resizable()
 | 
			
		||||
                        .frame(width: 20, height: 20)
 | 
			
		||||
                        .padding(4)
 | 
			
		||||
                        .background(Color(hex: "333333").opacity(0.7))
 | 
			
		||||
                        .clipShape(Circle())
 | 
			
		||||
                        .padding(.leading, 4)
 | 
			
		||||
                        .padding(.top, 4)
 | 
			
		||||
                }
 | 
			
		||||
                .padding(.vertical, 6.7)
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            Divider()
 | 
			
		||||
                .frame(height: 1)
 | 
			
		||||
                .background(Color(hex: "909090").opacity(0.5))
 | 
			
		||||
            VStack(alignment: .leading, spacing: 8) {
 | 
			
		||||
                Text(item.creatorNickname)
 | 
			
		||||
                    .font(.custom(Font.preRegular.rawValue, size: 18))
 | 
			
		||||
                    .foregroundColor(.white)
 | 
			
		||||
                    .lineLimit(1)
 | 
			
		||||
                    .truncationMode(.tail)
 | 
			
		||||
                
 | 
			
		||||
                Text(item.title)
 | 
			
		||||
                    .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
			
		||||
                    .foregroundColor(Color(hex: "B0BEC5"))
 | 
			
		||||
                    .lineLimit(1)
 | 
			
		||||
                    .truncationMode(.tail)
 | 
			
		||||
                
 | 
			
		||||
                HStack(spacing: 4) {
 | 
			
		||||
                    Text("\(dateDic["dayOfWeek"] ?? "")")
 | 
			
		||||
                        .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(Color(hex: "78909C"))
 | 
			
		||||
                    
 | 
			
		||||
                    Text("|")
 | 
			
		||||
                        .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(Color(hex: "78909C"))
 | 
			
		||||
                    
 | 
			
		||||
                    Text("\(dateDic["time"] ?? "")")
 | 
			
		||||
                        .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(Color(hex: "98A2F6"))
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            Spacer()
 | 
			
		||||
            
 | 
			
		||||
            VStack(alignment: .trailing, spacing: 8) {
 | 
			
		||||
                VStack(spacing: 0) {
 | 
			
		||||
                    Text("\(dateDic["month"] ?? "")월")
 | 
			
		||||
                        .font(.custom(Font.preBold.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(.white)
 | 
			
		||||
                        .padding(.vertical, 6)
 | 
			
		||||
                        .frame(maxWidth: .infinity)
 | 
			
		||||
                        .background(Color(hex: "FF5C49"))
 | 
			
		||||
                        .cornerRadius(16, corners: [.topLeft, .topRight])
 | 
			
		||||
                    
 | 
			
		||||
                    Text("\(dateDic["day"] ?? "")")
 | 
			
		||||
                        .font(.custom(Font.preBold.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(Color(hex: "263238"))
 | 
			
		||||
                        .padding(.vertical, 6)
 | 
			
		||||
                        .frame(maxWidth: .infinity)
 | 
			
		||||
                        .background(Color(hex: "FFFFFF"))
 | 
			
		||||
                        .cornerRadius(16, corners: [.bottomLeft, .bottomRight])
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                if item.price > 0 {
 | 
			
		||||
                    HStack(spacing: 2) {
 | 
			
		||||
                        Image("ic_can_circle")
 | 
			
		||||
                            .resizable()
 | 
			
		||||
                            .frame(width: 12, height: 12)
 | 
			
		||||
                        
 | 
			
		||||
                        Text("\(item.price)")
 | 
			
		||||
                            .font(.custom(Font.preRegular.rawValue, size: 12))
 | 
			
		||||
                            .foregroundColor(.white)
 | 
			
		||||
                    }
 | 
			
		||||
                    .padding(4)
 | 
			
		||||
                    .frame(maxWidth: .infinity)
 | 
			
		||||
                    .background(Color(hex: "3b5ff1"))
 | 
			
		||||
                    .cornerRadius(4)
 | 
			
		||||
                } else {
 | 
			
		||||
                    Text("무료")
 | 
			
		||||
                        .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
			
		||||
                        .foregroundColor(Color(hex: "#263238"))
 | 
			
		||||
                        .padding(4)
 | 
			
		||||
                        .frame(maxWidth: .infinity)
 | 
			
		||||
                        .background(Color.white)
 | 
			
		||||
                        .cornerRadius(4)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            .frame(width: 55)
 | 
			
		||||
        }
 | 
			
		||||
        .frame(width: screenSize().width - 26.7, height: 130, alignment: .center)
 | 
			
		||||
        .padding(10)
 | 
			
		||||
        .background(Color(hex: "263238"))
 | 
			
		||||
        .cornerRadius(16)
 | 
			
		||||
        .onAppear {
 | 
			
		||||
            self.dateDic = parseUtcIsoLocalDateTime(item.beginDateTimeUtc)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    func parseUtcIsoLocalDateTime(_ utcString: String) -> [String: String] {
 | 
			
		||||
        // 1. 서버에서 내려온 포맷: "yyyy-MM-dd'T'HH:mm:ss"
 | 
			
		||||
        let utcFormatter = DateFormatter()
 | 
			
		||||
        utcFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
 | 
			
		||||
        utcFormatter.locale = Locale.current
 | 
			
		||||
        utcFormatter.timeZone = TimeZone(abbreviation: "UTC")
 | 
			
		||||
        
 | 
			
		||||
        // 2. 문자열 → Date 객체
 | 
			
		||||
        guard let date = utcFormatter.date(from: utcString) else {
 | 
			
		||||
            return [:]  // 파싱 실패 시 빈 딕셔너리 반환
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // 3~6. 출력용 Formatter (로컬 시간 기준)
 | 
			
		||||
        let localFormatter = DateFormatter()
 | 
			
		||||
        localFormatter.locale = Locale.current
 | 
			
		||||
        localFormatter.timeZone = TimeZone.current
 | 
			
		||||
        
 | 
			
		||||
        // 3. 월 (1~12)
 | 
			
		||||
        localFormatter.dateFormat = "M"
 | 
			
		||||
        let month = localFormatter.string(from: date)
 | 
			
		||||
        
 | 
			
		||||
        // 4. 일 (1~31)
 | 
			
		||||
        localFormatter.dateFormat = "d"
 | 
			
		||||
        let day = localFormatter.string(from: date)
 | 
			
		||||
        
 | 
			
		||||
        // 5. 요일 (예: "Mon", "목")
 | 
			
		||||
        localFormatter.dateFormat = "E"
 | 
			
		||||
        let dayOfWeek = localFormatter.string(from: date)
 | 
			
		||||
        
 | 
			
		||||
        // 6. 시간 (예: "AM 05:00")
 | 
			
		||||
        localFormatter.dateFormat = "a hh:mm"
 | 
			
		||||
        let time = localFormatter.string(from: date)
 | 
			
		||||
        
 | 
			
		||||
        return [
 | 
			
		||||
            "month": month,
 | 
			
		||||
            "day": day,
 | 
			
		||||
            "dayOfWeek": dayOfWeek,
 | 
			
		||||
            "time": time
 | 
			
		||||
        ]
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -103,6 +169,7 @@ struct LiveReservationItemView_Previews: PreviewProvider {
 | 
			
		||||
            title: "test",
 | 
			
		||||
            content: "testtest",
 | 
			
		||||
            beginDateTime: "2022.05.23 Mon 03:00 PM",
 | 
			
		||||
            beginDateTimeUtc: "2025-08-10T15:00:00",
 | 
			
		||||
            numberOfParticipate: 0,
 | 
			
		||||
            numberOfPeople: 5,
 | 
			
		||||
            coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user