diff --git a/SodaLive/Sources/Content/All/ContentNewAllItemView.swift b/SodaLive/Sources/Content/All/ContentNewAllItemView.swift index 4ef7d25..fdedffb 100644 --- a/SodaLive/Sources/Content/All/ContentNewAllItemView.swift +++ b/SodaLive/Sources/Content/All/ContentNewAllItemView.swift @@ -15,40 +15,43 @@ struct ContentNewAllItemView: View { @State var width: CGFloat = 0 var body: some View { - VStack(alignment: .leading, spacing: 8) { - KFImage(URL(string: item.coverImageUrl)) - .resizable() - .scaledToFill() - .frame(width: width, height: width, alignment: .top) - .cornerRadius(2.7) - - Text(item.title) - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "d2d2d2")) - .frame(width: width, alignment: .leading) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .lineLimit(2) - - HStack(spacing: 5.3) { - KFImage(URL(string: item.creatorProfileImageUrl)) + NavigationLink { + ContentDetailView(contentId: item.contentId) + } label: { + VStack(alignment: .leading, spacing: 8) { + KFImage(URL(string: item.coverImageUrl)) .resizable() .scaledToFill() - .frame(width: 21.3, height: 21.3) - .clipShape(Circle()) - .onTapGesture { AppState.shared.setAppStep(step: .creatorDetail(userId: item.creatorId)) } + .frame(width: width, height: width, alignment: .top) + .cornerRadius(2.7) - Text(item.creatorNickname) - .font(.custom(Font.medium.rawValue, size: 12)) - .foregroundColor(Color(hex: "777777")) - .lineLimit(1) + Text(item.title) + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "d2d2d2")) + .frame(width: width, alignment: .leading) + .multilineTextAlignment(.leading) + .fixedSize(horizontal: false, vertical: true) + .lineLimit(2) + + HStack(spacing: 5.3) { + KFImage(URL(string: item.creatorProfileImageUrl)) + .resizable() + .scaledToFill() + .frame(width: 21.3, height: 21.3) + .clipShape(Circle()) + .onTapGesture { AppState.shared.setAppStep(step: .creatorDetail(userId: item.creatorId)) } + + Text(item.creatorNickname) + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "777777")) + .lineLimit(1) + } + .padding(.bottom, 10) + } + .frame(width: width) + .onAppear { + width = (screenSize().width - 40) / 2 } - .padding(.bottom, 10) - } - .frame(width: width) - .onTapGesture { AppState.shared.setAppStep(step: .contentDetail(contentId: item.contentId)) } - .onAppear { - width = (screenSize().width - 40) / 2 } } } diff --git a/SodaLive/Sources/Content/All/ContentNewAllView.swift b/SodaLive/Sources/Content/All/ContentNewAllView.swift index 376528a..5bfa116 100644 --- a/SodaLive/Sources/Content/All/ContentNewAllView.swift +++ b/SodaLive/Sources/Content/All/ContentNewAllView.swift @@ -17,63 +17,65 @@ struct ContentNewAllView: View { ] var body: some View { - BaseView(isLoading: $viewModel.isLoading) { - VStack(spacing: 0) { - DetailNavigationBar(title: "새로운 콘텐츠") - - Text("※ 최근 2주간 등록된 새로운 콘텐츠 입니다.") - .font(.custom(Font.medium.rawValue, size: 14.7)) - .foregroundColor(Color(hex: "bbbbbb")) - .padding(.horizontal, 13.3) - .padding(.vertical, 8) - .frame(width: screenSize().width, alignment: .leading) - .background(Color(hex: "222222")) - .padding(.top, 13.3) - - ContentMainNewContentThemeView( - themes: viewModel.themeList, - selectTheme: { - viewModel.selectedTheme = $0 - }, - selectedTheme: $viewModel.selectedTheme - ).padding(.top, 13.3) - - HStack(spacing: 0) { - Text("전체") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "e2e2e2")) + NavigationView { + BaseView(isLoading: $viewModel.isLoading) { + VStack(spacing: 0) { + DetailNavigationBar(title: "새로운 콘텐츠") - Text("\(viewModel.totalCount)") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "ff5c49")) - .padding(.leading, 8) + Text("※ 최근 2주간 등록된 새로운 콘텐츠 입니다.") + .font(.custom(Font.medium.rawValue, size: 14.7)) + .foregroundColor(Color(hex: "bbbbbb")) + .padding(.horizontal, 13.3) + .padding(.vertical, 8) + .frame(width: screenSize().width, alignment: .leading) + .background(Color(hex: "222222")) + .padding(.top, 13.3) - Text("개") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "e2e2e2")) - .padding(.leading, 2) + ContentMainNewContentThemeView( + themes: viewModel.themeList, + selectTheme: { + viewModel.selectedTheme = $0 + }, + selectedTheme: $viewModel.selectedTheme + ).padding(.top, 13.3) - Spacer() - } - .padding(.vertical, 13.3) - .padding(.horizontal, 20) - - ScrollView(.vertical, showsIndicators: false) { - LazyVGrid(columns: columns, spacing: 13.3) { - ForEach(0.. 0 { - HStack(spacing: 8) { - Image("ic_can") + VStack(spacing: 8) { + Text("\(viewModel.dateString)") + .font(.custom(Font.bold.rawValue, size: 14.7)) + .foregroundColor(Color(hex: "eeeeee")) + + Text("※ 인기 콘텐츠의 순위는 매주 업데이트됩니다.") + .font(.custom(Font.light.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "bbbbbb")) + } + .padding(.vertical, 8) + .frame(width: screenSize().width - 26.7) + .background(Color(hex: "222222")) + .padding(.top, 13.3) + + ContentMainRankingSortView( + sorts: viewModel.contentRankingSortList, + selectSort: { viewModel.selectedContentRankingSort = $0 }, + selectedSort: $viewModel.selectedContentRankingSort + ) + .frame(width: screenSize().width - 26.7) + .padding(.vertical, 16.7) + + ScrollView(.vertical, showsIndicators: false) { + LazyVStack(spacing: 20) { + ForEach(0.. 0 { + HStack(spacing: 8) { + Image("ic_can") + .resizable() + .frame(width: 17, height: 17) + + Text("\(item.price)") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "909090")) + } + } else { + Text("무료") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "ffffff")) + .padding(.horizontal, 5.3) + .padding(.vertical, 2.7) + .background(Color(hex: "cf5c37")) + .cornerRadius(2.6) + } + } + .frame(height: 66.7) + .contentShape(Rectangle()) + .onAppear { + if index == viewModel.contentRankingItemList.count - 1 { + viewModel.getContentRanking() + } } - } else { - Text("무료") - .font(.custom(Font.medium.rawValue, size: 12)) - .foregroundColor(Color(hex: "ffffff")) - .padding(.horizontal, 5.3) - .padding(.vertical, 2.7) - .background(Color(hex: "cf5c37")) - .cornerRadius(2.6) - } - } - .frame(height: 66.7) - .contentShape(Rectangle()) - .onTapGesture { - AppState - .shared - .setAppStep(step: .contentDetail(contentId: item.contentId)) - } - .onAppear { - if index == viewModel.contentRankingItemList.count - 1 { - viewModel.getContentRanking() } } } } + .padding(13.3) } - .padding(13.3) - } - - if viewModel.isLoading { - LoadingView() - } - } - .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() + + if viewModel.isLoading { + LoadingView() } } - } - .onAppear { - viewModel.getContentRankingSortType() - viewModel.getContentRanking() + .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.getContentRankingSortType() + viewModel.getContentRanking() + } } } } diff --git a/SodaLive/Sources/Content/ContentListView.swift b/SodaLive/Sources/Content/ContentListView.swift index 89e8914..4242b62 100644 --- a/SodaLive/Sources/Content/ContentListView.swift +++ b/SodaLive/Sources/Content/ContentListView.swift @@ -13,148 +13,147 @@ struct ContentListView: View { @StateObject var viewModel = ContentListViewModel() var body: some View { - BaseView(isLoading: $viewModel.isLoading) { - VStack(spacing: 0) { - HStack(spacing: 0) { - Button { - AppState.shared.back() - } label: { - Image("ic_back") - .resizable() - .frame(width: 20, height: 20) - - Text("콘텐츠 전체보기") - .font(.custom(Font.bold.rawValue, size: 18.3)) - .foregroundColor(Color(hex: "eeeeee")) - } - - Spacer() - } - .padding(.horizontal, 13.3) - .frame(height: 50) - .background(Color.black) - - if userId == UserDefaults.int(forKey: .userId) { - Text("새로운 콘텐츠 등록하기") - .font(.custom(Font.bold.rawValue, size: 15)) - .foregroundColor(Color(hex: "eeeeee")) - .padding(.vertical, 17) - .frame(maxWidth: .infinity) - .background(Color(hex: "9970ff")) - .cornerRadius(5.3) - .padding(.top, 13.3) - .padding(.horizontal, 13.3) - .onTapGesture { AppState.shared.setAppStep(step: .createContent) } - } - - HStack(spacing: 13.3) { - Spacer() - - Text("최신순") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor( - Color(hex: "e2e2e2") - .opacity(viewModel.sort == .NEWEST ? 1 : 0.5) - ) - .onTapGesture { - if viewModel.sort != .NEWEST { - viewModel.sort = .NEWEST - } - } - - Text("높은 가격순") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor( - Color(hex: "e2e2e2") - .opacity(viewModel.sort == .PRICE_HIGH ? 1 : 0.5) - ) - .onTapGesture { - if viewModel.sort != .PRICE_HIGH { - viewModel.sort = .PRICE_HIGH - } - } - - Text("낮은 가격순") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor( - Color(hex: "e2e2e2") - .opacity(viewModel.sort == .PRICE_LOW ? 1 : 0.5) - ) - .onTapGesture { - if viewModel.sort != .PRICE_LOW { - viewModel.sort = .PRICE_LOW - } - } - } - .padding(.vertical, 13.3) - .padding(.horizontal, 20) - .background(Color(hex: "161616")) - .padding(.top, 13.3) - - HStack(spacing: 0) { - Text("전체") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "e2e2e2")) - - Text("\(viewModel.totalCount)") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "ff5c49")) - .padding(.leading, 8) - - Text("개") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "e2e2e2")) - .padding(.leading, 2) - - Spacer() - } - .padding(.vertical, 13.3) - .padding(.horizontal, 20) - - ScrollViewReader { reader in - ScrollView(.vertical, showsIndicators: false) { - LazyVStack(spacing: 10.7) { - ScrollerToTop(reader: reader, scrollOnChange: $viewModel.scrollToTop) + NavigationView { + BaseView(isLoading: $viewModel.isLoading) { + VStack(spacing: 0) { + HStack(spacing: 0) { + Button { + AppState.shared.back() + } label: { + Image("ic_back") + .resizable() + .frame(width: 20, height: 20) - ForEach(0.. @StateObject private var viewModel = ContentDetailViewModel() @State private var isShowOrderView = false @@ -24,7 +26,11 @@ struct ContentDetailView: View { VStack(spacing: 0) { HStack(spacing: 0) { Button { - AppState.shared.back() + if presentationMode.wrappedValue.isPresented { + presentationMode.wrappedValue.dismiss() + } else { + AppState.shared.back() + } } label: { Image("ic_back") .resizable() @@ -151,6 +157,8 @@ struct ContentDetailView: View { Spacer() } + .navigationTitle("") + .navigationBarBackButtonHidden() .onAppear { viewModel.contentId = contentId AppState.shared.pushAudioContentId = 0 diff --git a/SodaLive/Sources/MyPage/OrderList/OrderListAllView.swift b/SodaLive/Sources/MyPage/OrderList/OrderListAllView.swift index e6fdecc..1b1fb40 100644 --- a/SodaLive/Sources/MyPage/OrderList/OrderListAllView.swift +++ b/SodaLive/Sources/MyPage/OrderList/OrderListAllView.swift @@ -12,88 +12,89 @@ struct OrderListAllView: View { @StateObject var viewModel = OrderListAllViewModel() var body: some View { - BaseView(isLoading: $viewModel.isLoading) { - VStack(spacing: 0) { - HStack(spacing: 0) { - Button { - AppState.shared.back() - } label: { - Image("ic_back") - .resizable() - .frame(width: 20, height: 20) - - Text("구매목록") - .font(.custom(Font.bold.rawValue, size: 18.3)) - .foregroundColor(Color(hex: "eeeeee")) - } - - Spacer() - } - .padding(.horizontal, 13.3) - .frame(height: 50) - .background(Color.black) - - HStack(spacing: 0) { - Text("총 ") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) - - Text("\(viewModel.totalCount)") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "dd4500")) - - Text(" 개") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) - - Spacer() - } - .padding(.horizontal, 13.3) - .padding(.top, 13.3) - - ScrollViewReader { reader in - ScrollView(.vertical, showsIndicators: false) { - LazyVStack(spacing: 10.7) { - ScrollerToTop(reader: reader, scrollOnChange: $viewModel.scrollToTop) + NavigationView { + BaseView(isLoading: $viewModel.isLoading) { + VStack(spacing: 0) { + HStack(spacing: 0) { + Button { + AppState.shared.back() + } label: { + Image("ic_back") + .resizable() + .frame(width: 20, height: 20) - ForEach(0..