Some UI Fixes

This commit is contained in:
Thomas Ricouard 2023-01-03 20:36:57 +01:00
parent ca9ce92053
commit dcccc459c2
3 changed files with 35 additions and 22 deletions

View file

@ -90,12 +90,14 @@ struct StatusEditorMediaView: View {
@ViewBuilder
private func makeImageMenu(container: StatusEditorViewModel.ImageContainer) -> some View {
Button {
editingContainer = container
} label: {
Label(container.mediaAttachement?.description?.isEmpty == false ?
"Edit description" : "Add description",
systemImage: "pencil.line")
if !viewModel.mode.isEditing {
Button {
editingContainer = container
} label: {
Label(container.mediaAttachement?.description?.isEmpty == false ?
"Edit description" : "Add description",
systemImage: "pencil.line")
}
}
Button(role: .destructive) {
withAnimation {

View file

@ -7,6 +7,15 @@ extension StatusEditorViewModel {
case edit(status: Status)
case quote(status: Status)
var isEditing: Bool {
switch self {
case .edit:
return true
default:
return false
}
}
var replyToStatus: Status? {
switch self {
case let .replyTo(status):

View file

@ -251,24 +251,26 @@ public struct StatusRowView: View {
}
if account.account?.id == viewModel.status.account.id {
Button {
Task {
if viewModel.isPinned {
await viewModel.unPin()
} else {
await viewModel.pin()
Section("Your post") {
Button {
Task {
if viewModel.isPinned {
await viewModel.unPin()
} else {
await viewModel.pin()
}
}
} label: {
Label(viewModel.isPinned ? "Unpin": "Pin", systemImage: viewModel.isPinned ? "pin.fill" : "pin")
}
Button {
routeurPath.presentedSheet = .editStatusEditor(status: viewModel.status)
} label: {
Label("Edit", systemImage: "pencil")
}
Button(role: .destructive) { Task { await viewModel.delete() } } label: {
Label("Delete", systemImage: "trash")
}
} label: {
Label(viewModel.isPinned ? "Unpin": "Pin", systemImage: viewModel.isPinned ? "pin.fill" : "pin")
}
Button {
routeurPath.presentedSheet = .editStatusEditor(status: viewModel.status)
} label: {
Label("Edit", systemImage: "pencil")
}
Button(role: .destructive) { Task { await viewModel.delete() } } label: {
Label("Delete", systemImage: "trash")
}
}
}