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