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:
Trey t
2026-01-25 10:46:13 -06:00
parent 49f4cf168f
commit 09be5fa444
4 changed files with 47 additions and 9 deletions

View File

@@ -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