feat(chat): 대화 탭 당겨서 새로고침을 추가한다
This commit is contained in:
@@ -54,16 +54,10 @@ struct MainChatView: View {
|
||||
|
||||
@ViewBuilder
|
||||
private var chatListContent: some View {
|
||||
if viewModel.isLoading && viewModel.rooms.isEmpty {
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
.tint(Color.soda400)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
if viewModel.isLoading && !viewModel.hasLoaded {
|
||||
loadingContent
|
||||
} else if viewModel.shouldShowEmptyState {
|
||||
Text(I18n.MainChat.emptyStateMessage)
|
||||
.appFont(size: 16, weight: .medium)
|
||||
.foregroundColor(Color.gray500)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
emptyContent
|
||||
} else {
|
||||
ScrollView(showsIndicators: false) {
|
||||
LazyVStack(spacing: 0) {
|
||||
@@ -85,6 +79,39 @@ struct MainChatView: View {
|
||||
}
|
||||
.padding(.top, 0)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var loadingContent: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(showsIndicators: false) {
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
.tint(Color.soda400)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var emptyContent: some View {
|
||||
GeometryReader { geometry in
|
||||
ScrollView(showsIndicators: false) {
|
||||
Text(I18n.MainChat.emptyStateMessage)
|
||||
.appFont(size: 16, weight: .medium)
|
||||
.foregroundColor(Color.gray500)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(minHeight: geometry.size.height)
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user