feat(content): 콘텐츠 탭 당겨서 새로고침을 추가한다
This commit is contained in:
@@ -17,11 +17,10 @@ struct MainContentRecommendationView: View {
|
||||
Color.black
|
||||
.ignoresSafeArea()
|
||||
|
||||
if viewModel.isLoading && viewModel.recommendations == nil {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
if viewModel.isLoading && !viewModel.hasLoaded {
|
||||
loadingContent
|
||||
} else if viewModel.shouldShowEmptyState {
|
||||
MainContentAudioEmptyStateView(message: viewModel.emptyStateMessage)
|
||||
emptyContent
|
||||
} else {
|
||||
ScrollView(showsIndicators: false) {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s24) {
|
||||
@@ -81,6 +80,9 @@ struct MainContentRecommendationView: View {
|
||||
}
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
@@ -94,4 +96,30 @@ struct MainContentRecommendationView: View {
|
||||
autohideIn: 2
|
||||
)
|
||||
}
|
||||
|
||||
private var loadingContent: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(showsIndicators: false) {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var emptyContent: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(showsIndicators: false) {
|
||||
MainContentAudioEmptyStateView(message: viewModel.emptyStateMessage)
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user