// // ContentMainView.swift // SodaLive // // Created by klaus on 2023/08/09. // import SwiftUI import RefreshableScrollView struct ContentMainView: View { @StateObject var viewModel = ContentMainViewModel() var body: some View { ZStack(alignment: .bottomTrailing) { Color.black.ignoresSafeArea() RefreshableScrollView( refreshing: $viewModel.isLoading, action: { viewModel.refresh() } ) { VStack(alignment: .leading, spacing: 0) { Text("콘텐츠 마켓") .font(.custom(Font.bold.rawValue, size: 21.3)) .foregroundColor(Color(hex: "3bb9f1")) .padding(.bottom, 26.7) .padding(.horizontal, 13.3) if !viewModel.isLoading { ContentMainNewContentCreatorView() .padding(.bottom, 26.7) .padding(.horizontal, 13.3) ContentMainBannerView() .padding(.bottom, 26.7) .padding(.horizontal, 13.3) HStack(spacing: 13.3) { VStack(spacing: 2.7) { HStack(spacing: 2.7) { Image("ic_short_play") Text("숏플") .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color(hex: "dd158d")) } Text("짧지만 꼴릿한 이야기") .font(.custom(Font.light.rawValue, size: 10)) .foregroundColor(Color(hex: "dd158d")) } .padding(.vertical, 10) .frame(maxWidth: .infinity) .background(Color(hex: "ffecf7")) .cornerRadius(2.6) .onTapGesture { AppState.shared.setAppStep( step: .contentAllByTheme(themeId: 11) ) } VStack(spacing: 2.7) { HStack(spacing: 2.7) { Image("ic_thumb_play_blue") Text("라이브 다시듣기") .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color(hex: "0057ff")) } Text("놓쳤던 라이브 다시듣기") .font(.custom(Font.light.rawValue, size: 10)) .foregroundColor(Color(hex: "0057ff")) } .padding(.vertical, 10) .frame(maxWidth: .infinity) .background(Color(hex: "ecf9ff")) .cornerRadius(2.6) .onTapGesture { AppState.shared.setAppStep( step: .contentAllByTheme(themeId: 7) ) } } .padding(.bottom, 40) .padding(.horizontal, 13.3) ContentMainMyStashView() .padding(.horizontal, 13.3) ContentMainNewContentView() .padding(.horizontal, 13.3) ContentMainRankingView() .padding(.top, 40) .padding(.horizontal, 13.3) .animation(nil) ContentMainCurationView() .padding(.top, 40) .padding(.bottom, 20) } } .padding(.vertical, 13.3) } if UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue { HStack(spacing: 5) { Image("ic_thumb_play") .resizable() .frame(width: 20, height: 20) Text("콘텐츠 업로드") .font(.custom(Font.bold.rawValue, size: 13.3)) .foregroundColor(.white) } .padding(13.3) .background(Color(hex: "3bb9f1")) .cornerRadius(44) .padding(.trailing, 16.7) .padding(.bottom, 16.7) .onTapGesture { AppState.shared.setAppStep(step: .createContent) } } if viewModel.isLoading { LoadingView() } } } } struct ContentMainView_Previews: PreviewProvider { static var previews: some View { ContentMainView() } }