Compare commits

..

No commits in common. "526a57b556f888024f8fc5c580c1c7c44a6b966d" and "9f6beecb49ced0f137982d55212dc8a5516ff2f9" have entirely different histories.

2 changed files with 49 additions and 57 deletions

View File

@ -94,6 +94,9 @@
}, },
"Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки." : { "Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки." : {
"comment" : "Описание необходимости подтверждения email" "comment" : "Описание необходимости подтверждения email"
},
"error" : {
}, },
"Fun Fest" : { "Fun Fest" : {
"comment" : "Fun Fest", "comment" : "Fun Fest",
@ -641,9 +644,6 @@
}, },
"Значение сохранено в буфере обмена." : { "Значение сохранено в буфере обмена." : {
"comment" : "Сообщение после копирования" "comment" : "Сообщение после копирования"
},
"Идет загрузка..." : {
}, },
"Идея" : { "Идея" : {
"comment" : "feedback category: idea", "comment" : "feedback category: idea",

View File

@ -25,6 +25,14 @@ struct BlockedUsersView: View {
emptyState emptyState
} else { } else {
usersSection usersSection
if isLoading {
Section {
ProgressView()
.frame(maxWidth: .infinity, alignment: .center)
}
} else if errorMessageDown != nil{
Text("error")
}
} }
} }
.navigationTitle(NSLocalizedString("Заблокированные", comment: "")) .navigationTitle(NSLocalizedString("Заблокированные", comment: ""))
@ -80,60 +88,44 @@ 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) { user in ForEach(blockedUsers) {
userRow(user) user in
} HStack(spacing: 12) {
if isLoading { Circle()
Text("Идет загрузка...") .fill(Color.accentColor.opacity(0.15))
.foregroundColor(.gray) .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)
Spacer() .swipeActions(edge: .trailing) {
} Button(role: .destructive) {
.padding(.vertical, 0) pendingUnblock = user
.swipeActions(edge: .trailing) { showUnblockConfirmation = true
Button(role: .destructive) { } label: {
pendingUnblock = user Label(NSLocalizedString("Разблокировать", comment: ""), systemImage: "person.crop.circle.badge.xmark")
showUnblockConfirmation = true }
} label: { .disabled(removingUserIds.contains(user.id))
Label(NSLocalizedString("Разблокировать", comment: ""), systemImage: "person.crop.circle.badge.xmark") }
} .onAppear {
.disabled(removingUserIds.contains(user.id)) if user.id == blockedUsers.last?.id {
} Task {
.onAppear { await loadBlockedUsers()
if user.id == blockedUsers.last?.id { }
Task { }
await loadBlockedUsers()
} }
} }
} }
@ -193,7 +185,7 @@ struct BlockedUsersView: View {
if offset == 0 { if offset == 0 {
loadError = message loadError = message
} }
// activeAlert = .error(message: message) activeAlert = .error(message: message)
errorMessageDown = message errorMessageDown = message
if AppConfig.DEBUG { print("[BlockedUsersView] load blocked users failed: \(error)") } if AppConfig.DEBUG { print("[BlockedUsersView] load blocked users failed: \(error)") }
} }