change chat list

This commit is contained in:
cheykrym 2025-10-08 05:03:46 +03:00
parent 0359616c8f
commit aa4b871c41

View File

@ -56,10 +56,6 @@ struct ChatsTab: View {
private var content: some View { private var content: some View {
if viewModel.isInitialLoading && viewModel.chats.isEmpty { if viewModel.isInitialLoading && viewModel.chats.isEmpty {
loadingState loadingState
} else if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
errorState(message: message)
} else if viewModel.chats.isEmpty {
emptyState
} else { } else {
chatList chatList
} }
@ -73,7 +69,7 @@ struct ChatsTab: View {
// .padding(.vertical, 8) // .padding(.vertical, 8)
// } // }
// .background(Color(UIColor.systemBackground)) // .background(Color(UIColor.systemBackground))
if let message = viewModel.errorMessage { if let message = viewModel.errorMessage {
Section { Section {
HStack(alignment: .top, spacing: 8) { HStack(alignment: .top, spacing: 8) {
@ -110,12 +106,19 @@ struct ChatsTab: View {
globalSearchContent globalSearchContent
} }
} else { } else {
ForEach(viewModel.chats) { chat in if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
chatRowItem(for: chat) errorState(message: message)
} } else if viewModel.chats.isEmpty {
emptyState
if viewModel.isLoadingMore { } else {
loadingMoreRow
ForEach(viewModel.chats) { chat in
chatRowItem(for: chat)
}
if viewModel.isLoadingMore {
loadingMoreRow
}
} }
} }
} }