From aa4b871c41a835bf8b490b32e8949daa10302382 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Wed, 8 Oct 2025 05:03:46 +0300 Subject: [PATCH] change chat list --- yobble/Views/Tab/ChatsTab.swift | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) 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 + } } } }