edit chat list

This commit is contained in:
cheykrym 2025-10-21 18:34:27 +03:00
parent 7c8940da5b
commit 49ac88c23c
2 changed files with 22 additions and 13 deletions

View File

@ -108,14 +108,16 @@ struct ChatsTab: View {
HStack(alignment: .top, spacing: 8) {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.orange)
Text(message)
.font(.subheadline)
.foregroundColor(.orange)
Spacer(minLength: 0)
Button(action: { viewModel.refresh() }) {
Text(NSLocalizedString("Обновить", comment: ""))
.font(.subheadline)
}
// Button(action: triggerChatsReload) {
// Text(NSLocalizedString("Обновить", comment: ""))
// .font(.subheadline)
// }
}
.padding(.vertical, 4)
}
@ -139,9 +141,10 @@ struct ChatsTab: View {
globalSearchContent
}
} else {
if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
errorState(message: message)
} else if viewModel.chats.isEmpty {
// if let message = viewModel.errorMessage, viewModel.chats.isEmpty {
// errorState(message: message)
// } else
if viewModel.chats.isEmpty {
emptyState
} else {
@ -296,9 +299,11 @@ struct ChatsTab: View {
private var globalSearchContent: some View {
if isGlobalSearchLoading {
globalSearchLoadingRow
} else if let error = globalSearchError {
globalSearchErrorRow(message: error)
} else if globalSearchResults.isEmpty {
} else
// if let error = globalSearchError {
// globalSearchErrorRow(message: error)
// } else
if globalSearchResults.isEmpty {
globalSearchEmptyRow
} else {
ForEach(globalSearchResults) { user in
@ -341,7 +346,7 @@ struct ChatsTab: View {
.font(.body)
.multilineTextAlignment(.center)
.foregroundColor(.primary)
Button(action: { viewModel.loadInitialChats(force: true) }) {
Button(action: triggerChatsReload) {
Text(NSLocalizedString("Повторить", comment: ""))
.font(.headline)
}
@ -359,7 +364,7 @@ struct ChatsTab: View {
Text(NSLocalizedString("Пока что у вас нет чатов", comment: ""))
.font(.body)
.foregroundColor(.secondary)
Button(action: { viewModel.refresh() }) {
Button(action: triggerChatsReload) {
Text(NSLocalizedString("Обновить", comment: ""))
}
.buttonStyle(.bordered)
@ -381,6 +386,10 @@ struct ChatsTab: View {
.listRowSeparator(.hidden)
}
private func triggerChatsReload() {
viewModel.loadInitialChats(force: true)
}
@ViewBuilder
private func chatRowItem(for chat: PrivateChatListItem) -> some View {
Button {