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