edit loading

This commit is contained in:
cheykrym 2025-10-26 02:47:58 +03:00
parent 0a7d519567
commit 128ed5723a

View File

@ -25,18 +25,6 @@ struct BlockedUsersView: View {
emptyState emptyState
} else { } else {
usersSection usersSection
if isLoading {
Section {
ProgressView()
.frame(maxWidth: .infinity, alignment: .center)
}
} else if let errorMessage = errorMessageDown {
Text(errorMessage)
.foregroundColor(.red)
.frame(maxWidth: .infinity, alignment: .center)
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
}
} }
} }
.navigationTitle(NSLocalizedString("Заблокированные", comment: "")) .navigationTitle(NSLocalizedString("Заблокированные", comment: ""))
@ -92,44 +80,59 @@ struct BlockedUsersView: View {
private var usersSection: some View { private var usersSection: some View {
Section(header: Text(NSLocalizedString("Заблокированные", comment: ""))) { Section(header: Text(NSLocalizedString("Заблокированные", comment: ""))) {
ForEach(blockedUsers) { ForEach(blockedUsers) { user in
user in userRow(user)
HStack(spacing: 12) { }
Circle() if isLoading {
.fill(Color.accentColor.opacity(0.15)) ProgressView()
.frame(width: 44, height: 44) .frame(maxWidth: .infinity, alignment: .center)
.overlay( .listRowBackground(Color.clear)
Text(user.initials) .listRowSeparator(.hidden)
.font(.headline) } else if let errorMessage = errorMessageDown {
.foregroundColor(.accentColor) Text(errorMessage)
) .foregroundColor(.red)
VStack(alignment: .leading, spacing: 4) { .frame(maxWidth: .infinity, alignment: .center)
Text(user.displayName) .listRowBackground(Color.clear)
.font(.body) .listRowSeparator(.hidden)
if let handle = user.handle { }
Text(handle) }
.font(.caption) }
.foregroundColor(.secondary)
} private func userRow(_ user: BlockedUser) -> some View {
} HStack(spacing: 12) {
Spacer() Circle()
.fill(Color.accentColor.opacity(0.15))
.frame(width: 44, height: 44)
.overlay(
Text(user.initials)
.font(.headline)
.foregroundColor(.accentColor)
)
VStack(alignment: .leading, spacing: 4) {
Text(user.displayName)
.font(.body)
if let handle = user.handle {
Text(handle)
.font(.caption)
.foregroundColor(.secondary)
} }
.padding(.vertical, 0) }
.swipeActions(edge: .trailing) { Spacer()
Button(role: .destructive) { }
pendingUnblock = user .padding(.vertical, 0)
showUnblockConfirmation = true .swipeActions(edge: .trailing) {
} label: { Button(role: .destructive) {
Label(NSLocalizedString("Разблокировать", comment: ""), systemImage: "person.crop.circle.badge.xmark") pendingUnblock = user
} showUnblockConfirmation = true
.disabled(removingUserIds.contains(user.id)) } label: {
} Label(NSLocalizedString("Разблокировать", comment: ""), systemImage: "person.crop.circle.badge.xmark")
.onAppear { }
if user.id == blockedUsers.last?.id { .disabled(removingUserIds.contains(user.id))
Task { }
await loadBlockedUsers() .onAppear {
} if user.id == blockedUsers.last?.id {
} Task {
await loadBlockedUsers()
} }
} }
} }