콘텐츠 메인 - Api 분리
This commit is contained in:
@@ -19,7 +19,7 @@ struct ContentMainView: View {
|
||||
RefreshableScrollView(
|
||||
refreshing: $viewModel.isLoading,
|
||||
action: {
|
||||
viewModel.getMain()
|
||||
viewModel.refresh()
|
||||
}
|
||||
) {
|
||||
LazyVStack(alignment: .leading, spacing: 0) {
|
||||
@@ -29,46 +29,28 @@ struct ContentMainView: View {
|
||||
.padding(.bottom, 26.7)
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
if viewModel.newContentUploadCreatorList.count > 0 {
|
||||
ContentMainNewContentCreatorView(items: viewModel.newContentUploadCreatorList)
|
||||
if !viewModel.isLoading {
|
||||
ContentMainNewContentCreatorView()
|
||||
.padding(.bottom, 26.7)
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
if viewModel.bannerList.count > 0 {
|
||||
ContentMainBannerView(items: viewModel.bannerList)
|
||||
|
||||
ContentMainBannerView()
|
||||
.padding(.bottom, 40)
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
if viewModel.orderList.count > 0 {
|
||||
ContentMainMyStashView(items: viewModel.orderList)
|
||||
|
||||
ContentMainMyStashView()
|
||||
.padding(.bottom, 40)
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
ContentMainNewContentView(
|
||||
themes: viewModel.themeList,
|
||||
items: viewModel.newContentList,
|
||||
selectTheme: { viewModel.selectedTheme = $0 },
|
||||
selectedTheme: $viewModel.selectedTheme
|
||||
)
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
if let contentRanking = viewModel.contentRanking {
|
||||
ContentMainRankingView(
|
||||
sorts: viewModel.contentRankingSortList,
|
||||
item: contentRanking,
|
||||
selectSort: { viewModel.selectedContentRankingSort = $0 },
|
||||
selectedSort: $viewModel.selectedContentRankingSort
|
||||
)
|
||||
|
||||
ContentMainNewContentView()
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
ContentMainRankingView()
|
||||
.padding(.top, 40)
|
||||
.padding(.horizontal, 13.3)
|
||||
.animation(nil)
|
||||
}
|
||||
|
||||
if viewModel.curationList.count > 0 {
|
||||
ContentMainCurationView(items: viewModel.curationList)
|
||||
|
||||
ContentMainCurationView()
|
||||
.padding(.top, 40)
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
@@ -100,28 +82,6 @@ struct ContentMainView: View {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.getMain()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user