Composer: Normalize error UI for media upload

This commit is contained in:
Thomas Ricouard 2023-02-23 19:53:16 +01:00
parent 3f17afa8ac
commit aad3e27748
1 changed files with 2 additions and 25 deletions

View File

@ -65,29 +65,7 @@ struct StatusEditorMediaView: View {
.frame(width: 150, height: 150)
.cornerRadius(8)
if container.error != nil {
VStack {
Text("status.editor.error.upload")
Button {
withAnimation {
viewModel.mediasImages.removeAll(where: { $0.id == container.id })
}
} label: {
VStack {
Text("action.delete")
}
}
.buttonStyle(.bordered)
Button {
Task {
await viewModel.upload(container: container)
}
} label: {
VStack {
Text("action.retry")
}
}
.buttonStyle(.bordered)
}
Text("status.editor.error.upload")
} else if container.mediaAttachment == nil {
ProgressView()
}
@ -157,8 +135,7 @@ struct StatusEditorMediaView: View {
private func makeErrorView(error: ServerError) -> some View {
ZStack {
placeholderView
Text("alert.error")
.foregroundColor(.red)
Text("status.editor.error.upload")
}
.alert("alert.error", isPresented: $isErrorDisplayed) {
Button("Ok", action: {})