| 1 | import SwiftUI |
| 2 | |
| 3 | /// Shared by task detail, Needs you and Finished today. |
| 4 | struct TaskConfirmationSheet: View { |
| 5 | @Bindable var model: TaskDetailModel |
| 6 | let confirmation: TaskConfirmation |
| 7 | var body: some View { |
| 8 | ScrollView { VStack(alignment: .leading, spacing: 18) { |
| 9 | // COPY APPROVED: Luna, 2026-11-26 (cancel title and detail). |
| 10 | Text(EquipoStrings.text(confirmation.action == .cancel ? "native.task.cancel_confirm" : confirmation.action == .undoMerge ? "native.task.undo_confirm" : "work.decide.adopt_ask")) |
| 11 | .font(.title2.bold()) |
| 12 | if confirmation.action == .cancel { |
| 13 | Text(EquipoStrings.text("native.task.cancel_detail")) |
| 14 | } else if confirmation.action == .undoMerge { |
| 15 | // COPY APPROVED (Luna via controller, 2026-11-26). |
| 16 | Text(EquipoStrings.text("native.task.undo_detail")) |
| 17 | } else if let task = model.task { |
| 18 | Text(task.title).font(.headline) |
| 19 | FactsView(facts: TaskReport(task, needsYou: !task.needsYou.isEmpty).facts.filter { $0.label != EquipoStrings.text("fact.branch") }, wide: false) |
| 20 | TaskReviewSummary(task: task) |
| 21 | if task.checks != "passed" { Text(EquipoStrings.text("work.decide.unchecked_ask")).font(.headline) } |
| 22 | if !task.branch.isEmpty { detail(EquipoStrings.text("work.details.branch"), task.branch) } |
| 23 | if !task.candidateSha.isEmpty { detail(EquipoStrings.text("work.details.commit"), task.candidateSha) } |
| 24 | } |
| 25 | Button(confirmation.action.title, role: confirmation.action == .cancel ? .destructive : nil) { |
| 26 | Task { await model.confirm() } |
| 27 | }.buttonStyle(.borderedProminent).accessibilityIdentifier("task-confirm") |
| 28 | Button(EquipoStrings.text("chat.card.not_now"), role: .cancel) { model.confirmation = nil } |
| 29 | }.padding(24) }.frame(minWidth: 280, maxWidth: 540, minHeight: 320, idealHeight: 560, alignment: .leading) |
| 30 | .presentationDetents(confirmation.action == .merge ? [.large] : [.medium, .large]) |
| 31 | } |
| 32 | private func detail(_ label: String, _ value: String) -> some View { |
| 33 | VStack(alignment: .leading, spacing: 4) { |
| 34 | Text(label).font(Typo.factLabel).foregroundStyle(Palette.secondary) |
| 35 | Text(verbatim: value).font(.system(.caption, design: .monospaced)).textSelection(.enabled) |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |