From 6a2671dad0a9886bb5b2284ab1d1b3a409204f46 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Sat, 22 Feb 2025 11:21:52 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=ED=99=88=20=ED=83=AD=20-=20=EC=BD=98=ED=85=90?= =?UTF-8?q?=EC=B8=A0=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Main/V2/Home/ContentMainTabHomeView.swift | 460 +++++++++--------- 1 file changed, 241 insertions(+), 219 deletions(-) diff --git a/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift b/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift index 8eff786..e7e4046 100644 --- a/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift +++ b/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift @@ -13,225 +13,226 @@ struct ContentMainTabHomeView: View { var body: some View { BaseView(isLoading: $viewModel.isLoading) { - ScrollView(.vertical, showsIndicators: false) { - VStack(alignment: .leading, spacing: 0) { - HStack(spacing: 0) { - Text("콘텐츠 마켓") - .font(.custom(Font.bold.rawValue, size: 21.3)) - .foregroundColor(Color.button) - - Spacer() - - Image("ic_content_keep") - .onTapGesture { - AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist)) - } - } - .padding(.horizontal, 13.3) - - if let notice = viewModel.noticeItem { - ContentMainTabHomeNoticeView(notice: notice) { - AppState.shared - .setAppStep(step: .noticeDetail(notice: $0)) + ZStack(alignment: .bottomTrailing) { + ScrollView(.vertical, showsIndicators: false) { + VStack(alignment: .leading, spacing: 0) { + HStack(spacing: 0) { + Text("콘텐츠 마켓") + .font(.custom(Font.bold.rawValue, size: 21.3)) + .foregroundColor(Color.button) + + Spacer() + + Image("ic_content_keep") + .onTapGesture { + AppState.shared.setAppStep(step: .myBox(currentTab: .orderlist)) + } } - .padding(.top, 15) .padding(.horizontal, 13.3) - } - - if viewModel.bannerList.count > 0 { - ContentMainBannerViewV2(bannerList: viewModel.bannerList) - .padding(.top, 30) - .padding(.horizontal, 13.3) - } - - HStack(spacing: 0) { - Image("ic_title_search_black") - Text("채널명을 입력해 보세요") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color.gray55) - .keyboardType(.default) - .padding(.horizontal, 13.3) - - Spacer() - } - .padding(.horizontal, 21.3) - .frame(height: 50) - .frame(maxWidth: .infinity) - .background(Color.gray22) - .overlay( - RoundedRectangle(cornerRadius: 6.7) - .strokeBorder(lineWidth: 1) - .foregroundColor(Color.graybb) - ) - .padding(.top, 30) - .padding(.horizontal, 13.3) - .onTapGesture { - UserDefaults.set("", forKey: .searchChannel) - AppState.shared.setAppStep(step: .searchChannel) - } - - VStack(spacing: 13.3) { - HStack(spacing: 0) { - ContentMainTabCategoryView( - imageName: "ic_category_series", - title: "시리즈", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .SERIES - ) - ) - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_content", - title: "단편", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .CONTENT - ) - ) - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_audio_book", - title: "오디오북", - onClick: { - viewModel.errorMessage = "준비중입니다." - viewModel.isShowPopup = true - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_alarm", - title: "모닝콜", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .ALARM - ) - ) - } - ) - .frame(maxWidth: .infinity) - } - - HStack(spacing: 0) { - ContentMainTabCategoryView( - imageName: "ic_category_asmr", - title: "ASMR", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .ASMR - ) - ) - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_replay", - title: "다시듣기", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .REPLAY - ) - ) - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_audio_toon", - title: "오디오툰", - onClick: { - viewModel.errorMessage = "준비중입니다." - viewModel.isShowPopup = true - } - ) - .frame(maxWidth: .infinity) - - ContentMainTabCategoryView( - imageName: "ic_category_free", - title: "무료", - onClick: { - AppState.shared - .setAppStep( - step: .contentMain( - startTab: .FREE - ) - ) - } - ) - .frame(maxWidth: .infinity) - } - } - .padding(.vertical, 13.3) - .background(Color.gray22) - .cornerRadius(5.3) - .padding(.top, 30) - .padding(.horizontal, 13.3) - - if let response = viewModel.rankCreatorResponse { - ContentMainTabHomeRankCreatorView(response: response) - .padding(.top, 30) - .padding(.horizontal, 13.3) - } - - if !viewModel.rankSeriesList.isEmpty { - ContentMainTabHomeRankSeriesView(seriesList: viewModel.rankSeriesList) - .padding(.top, 30) - .padding(.horizontal, 13.3) - } - - if !viewModel.rankSortTypeList.isEmpty { - ContentMainTabRankContentView( - title: "인기 단편", - isMore: true, - onClickMore: { - AppState.shared.setAppStep(step: .contentRankingAll) - }, - sortList: !viewModel.rankSortTypeList.isEmpty ? - viewModel.rankSortTypeList : - [], - onClickSort: { viewModel.getContentRanking(sort: $0) }, - contentList: viewModel.rankContentList - ) - .padding(.top, 30) - } - - if viewModel.eventBannerList.count > 0 { - SectionEventBannerView(items: viewModel.eventBannerList) - .padding(.top, 30) - } - - if !viewModel.contentRankCreatorList.isEmpty { - ContentByChannelView( - title: "채널별 인기 콘텐츠", - creatorList: viewModel.contentRankCreatorList, - contentList: viewModel.salesCountRankContentList, - onClickCreator: { - viewModel.getPopularContentByCreator(creatorId: $0) + if let notice = viewModel.noticeItem { + ContentMainTabHomeNoticeView(notice: notice) { + AppState.shared + .setAppStep(step: .noticeDetail(notice: $0)) } + .padding(.top, 15) + .padding(.horizontal, 13.3) + } + + if viewModel.bannerList.count > 0 { + ContentMainBannerViewV2(bannerList: viewModel.bannerList) + .padding(.top, 30) + .padding(.horizontal, 13.3) + } + + HStack(spacing: 0) { + Image("ic_title_search_black") + + Text("채널명을 입력해 보세요") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.gray55) + .keyboardType(.default) + .padding(.horizontal, 13.3) + + Spacer() + } + .padding(.horizontal, 21.3) + .frame(height: 50) + .frame(maxWidth: .infinity) + .background(Color.gray22) + .overlay( + RoundedRectangle(cornerRadius: 6.7) + .strokeBorder(lineWidth: 1) + .foregroundColor(Color.graybb) ) .padding(.top, 30) - } - - Text(""" + .padding(.horizontal, 13.3) + .onTapGesture { + UserDefaults.set("", forKey: .searchChannel) + AppState.shared.setAppStep(step: .searchChannel) + } + + VStack(spacing: 13.3) { + HStack(spacing: 0) { + ContentMainTabCategoryView( + imageName: "ic_category_series", + title: "시리즈", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .SERIES + ) + ) + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_content", + title: "단편", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .CONTENT + ) + ) + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_audio_book", + title: "오디오북", + onClick: { + viewModel.errorMessage = "준비중입니다." + viewModel.isShowPopup = true + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_alarm", + title: "모닝콜", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .ALARM + ) + ) + } + ) + .frame(maxWidth: .infinity) + } + + HStack(spacing: 0) { + ContentMainTabCategoryView( + imageName: "ic_category_asmr", + title: "ASMR", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .ASMR + ) + ) + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_replay", + title: "다시듣기", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .REPLAY + ) + ) + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_audio_toon", + title: "오디오툰", + onClick: { + viewModel.errorMessage = "준비중입니다." + viewModel.isShowPopup = true + } + ) + .frame(maxWidth: .infinity) + + ContentMainTabCategoryView( + imageName: "ic_category_free", + title: "무료", + onClick: { + AppState.shared + .setAppStep( + step: .contentMain( + startTab: .FREE + ) + ) + } + ) + .frame(maxWidth: .infinity) + } + } + .padding(.vertical, 13.3) + .background(Color.gray22) + .cornerRadius(5.3) + .padding(.top, 30) + .padding(.horizontal, 13.3) + + if let response = viewModel.rankCreatorResponse { + ContentMainTabHomeRankCreatorView(response: response) + .padding(.top, 30) + .padding(.horizontal, 13.3) + } + + if !viewModel.rankSeriesList.isEmpty { + ContentMainTabHomeRankSeriesView(seriesList: viewModel.rankSeriesList) + .padding(.top, 30) + .padding(.horizontal, 13.3) + } + + if !viewModel.rankSortTypeList.isEmpty { + ContentMainTabRankContentView( + title: "인기 단편", + isMore: true, + onClickMore: { + AppState.shared.setAppStep(step: .contentRankingAll) + }, + sortList: !viewModel.rankSortTypeList.isEmpty ? + viewModel.rankSortTypeList : + [], + onClickSort: { viewModel.getContentRanking(sort: $0) }, + contentList: viewModel.rankContentList + ) + .padding(.top, 30) + } + + if viewModel.eventBannerList.count > 0 { + SectionEventBannerView(items: viewModel.eventBannerList) + .padding(.top, 30) + } + + if !viewModel.contentRankCreatorList.isEmpty { + ContentByChannelView( + title: "채널별 인기 콘텐츠", + creatorList: viewModel.contentRankCreatorList, + contentList: viewModel.salesCountRankContentList, + onClickCreator: { + viewModel.getPopularContentByCreator(creatorId: $0) + } + ) + .padding(.top, 30) + } + + Text(""" - 회사명 : 주식회사 소다라이브 - 대표자 : 이재형 @@ -246,13 +247,34 @@ struct ContentMainTabHomeView: View { - 대표 이메일 : sodalive.official@gmail.com """) - .font(.custom(Font.medium.rawValue, size: 11)) - .foregroundColor(Color.gray77) - .padding(.top, 30) - .padding(.horizontal, 13.3) + .font(.custom(Font.medium.rawValue, size: 11)) + .foregroundColor(Color.gray77) + .padding(.top, 30) + .padding(.horizontal, 13.3) + } + .onAppear { + viewModel.fetchData() + } } - .onAppear { - viewModel.fetchData() + + 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) + } } } .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {