77 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  EventPopupDialogView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/11.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
import Kingfisher
 | 
						|
 | 
						|
struct EventPopupDialogView: View {
 | 
						|
    
 | 
						|
    let eventPopup: EventItem
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        VStack(spacing: 13.3) {
 | 
						|
            KFImage(URL(string: eventPopup.popupImageUrl!))
 | 
						|
                .cancelOnDisappear(true)
 | 
						|
                .downsampling(
 | 
						|
                    size: CGSize(
 | 
						|
                        width: screenSize().width,
 | 
						|
                        height: screenSize().width
 | 
						|
                    )
 | 
						|
                )
 | 
						|
                .resizable()
 | 
						|
                .frame(width: screenSize().width, height: screenSize().width)
 | 
						|
                .scaledToFill()
 | 
						|
                .cornerRadius(16.7, corners: [.topLeft, .topRight])
 | 
						|
                .onTapGesture {
 | 
						|
                    AppState
 | 
						|
                        .shared
 | 
						|
                        .setAppStep(
 | 
						|
                            step: .eventDetail(
 | 
						|
                                event: eventPopup
 | 
						|
                            )
 | 
						|
                        )
 | 
						|
                    AppState.shared.eventPopup = nil
 | 
						|
                }
 | 
						|
            
 | 
						|
            HStack(spacing: 0) {
 | 
						|
                Text("다시보지 않기")
 | 
						|
                    .font(.custom(Font.medium.rawValue, size: 14.7))
 | 
						|
                    .foregroundColor(Color(hex: "eeeeee"))
 | 
						|
                    .onTapGesture {
 | 
						|
                        UserDefaults.set(eventPopup.id, forKey: .notShowingEventPopupId)
 | 
						|
                        AppState.shared.eventPopup = nil
 | 
						|
                    }
 | 
						|
                
 | 
						|
                Spacer()
 | 
						|
                
 | 
						|
                Text("닫기")
 | 
						|
                    .font(.custom(Font.medium.rawValue, size: 14.7))
 | 
						|
                    .foregroundColor(Color(hex: "eeeeee"))
 | 
						|
                    .onTapGesture { AppState.shared.eventPopup = nil }
 | 
						|
            }
 | 
						|
            .padding(.horizontal, 26.7)
 | 
						|
            .padding(.bottom, 13.3)
 | 
						|
        }
 | 
						|
        .background(Color(hex: "222222"))
 | 
						|
        .cornerRadius(16.7, corners: [.topLeft, .topRight])
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct EventPopupDialogView_Previews: PreviewProvider {
 | 
						|
    static var previews: some View {
 | 
						|
        EventPopupDialogView(
 | 
						|
            eventPopup: EventItem(
 | 
						|
                id: 1,
 | 
						|
                thumbnailImageUrl: "",
 | 
						|
                detailImageUrl: "",
 | 
						|
                popupImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
 | 
						|
                link: ""
 | 
						|
            )
 | 
						|
        )
 | 
						|
    }
 | 
						|
}
 |