Add cancel task confirmation dialog
- Add L10n strings for cancel confirmation - Add confirmation dialog to ResidenceDetailView - Fix AllTasksView cancel dialog (was using archive strings) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,8 @@ struct ResidenceDetailView: View {
|
||||
@State private var selectedTaskForComplete: TaskResponse?
|
||||
@State private var selectedTaskForArchive: TaskResponse?
|
||||
@State private var showArchiveConfirmation = false
|
||||
@State private var selectedTaskForCancel: TaskResponse?
|
||||
@State private var showCancelConfirmation = false
|
||||
|
||||
@State private var hasAppeared = false
|
||||
@State private var showReportAlert = false
|
||||
@@ -144,6 +146,21 @@ struct ResidenceDetailView: View {
|
||||
Text("Are you sure you want to archive \"\(task.title)\"? You can unarchive it later from archived tasks.")
|
||||
}
|
||||
}
|
||||
.alert(L10n.Tasks.cancelTask, isPresented: $showCancelConfirmation) {
|
||||
Button(L10n.Common.no, role: .cancel) {
|
||||
selectedTaskForCancel = nil
|
||||
}
|
||||
Button(L10n.Common.yes, role: .destructive) {
|
||||
if let task = selectedTaskForCancel {
|
||||
taskViewModel.cancelTask(id: task.id) { _ in
|
||||
loadResidenceTasks()
|
||||
}
|
||||
selectedTaskForCancel = nil
|
||||
}
|
||||
}
|
||||
} message: {
|
||||
Text(L10n.Tasks.cancelConfirm)
|
||||
}
|
||||
.sheet(isPresented: $showingUpgradePrompt) {
|
||||
UpgradePromptView(triggerKey: upgradeTriggerKey.isEmpty ? "add_11th_task" : upgradeTriggerKey, isPresented: $showingUpgradePrompt)
|
||||
}
|
||||
@@ -489,9 +506,8 @@ private struct TasksSectionContainer: View {
|
||||
showEditTask = true
|
||||
},
|
||||
onCancelTask: { task in
|
||||
taskViewModel.cancelTask(id: task.id) { _ in
|
||||
reloadTasks()
|
||||
}
|
||||
selectedTaskForCancel = task
|
||||
showCancelConfirmation = true
|
||||
},
|
||||
onUncancelTask: { taskId in
|
||||
taskViewModel.uncancelTask(id: taskId) { _ in
|
||||
|
||||
Reference in New Issue
Block a user