oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1import SwiftUI
2
3struct TodaySection: View {
4 let session: EquipoSession
5 let now: Date
6 var openTask: (String) -> Void
7
8 var body: some View {
9 let today = NeedsToday(tasks: session.tasks, now: now, zone: .current)
10 if !today.running.isEmpty || !today.finished.isEmpty {
11 VStack(alignment: .leading, spacing: 12) {
12 Text(EquipoStrings.text("chat.day.today")).font(.title2.bold())
13 if !today.running.isEmpty {
14 // COPY APPROVED: Luna, 2026-11-26.
15 SectionTitle(text: EquipoStrings.text("native.needs.running_now"))
16 ForEach(today.running) { task in
17 Panel(padding: 14, spacing: 10) {
18 TodayTaskRow(task: task, now: now, running: true) { openTask(task.id) }
19 }
20 }
21 }
22 if !today.finished.isEmpty {
23 // COPY APPROVED: Luna, 2026-11-26.
24 SectionTitle(text: EquipoStrings.text("native.needs.finished_today"))
25 ForEach(today.finished) { task in
26 FinishedTodayRow(session: session, task: task, now: now, openTask: openTask)
27 }
28 }
29 }
30 }
31 }
32}
33
34private struct TodayTaskRow: View {
35 let task: ThinTask
36 let now: Date
37 let running: Bool
38 var open: () -> Void
39
40 var body: some View {
41 VStack(alignment: .leading, spacing: 10) {
42 TaskRowButton(task: task, needsYou: false,
43 status: running ? nil : NeedsToday.completionStatus(task, now: now, zone: .current, locale: .current), action: open)
44 if running {
45 if let pause = TaskPause(task, mine: false, now: now) { PauseLead(pause: pause) }
46 else if let step = NeedsToday.liveStep(task) {
47 VStack(alignment: .leading, spacing: 4) {
48 Text(Specialist(category: step.who).name).font(Typo.captionStrong)
49 if !step.headline.isEmpty { Text(step.headline).font(Typo.secondary).fixedSize(horizontal: false, vertical: true) }
50 }.foregroundStyle(Palette.secondary)
51 }
52 }
53 }
54 }
55}
56
57private struct FinishedTodayRow: View {
58 let task: ThinTask
59 let now: Date
60 var openTask: (String) -> Void
61 @State private var model: TaskDetailModel
62 init(session: EquipoSession, task: ThinTask, now: Date, openTask: @escaping (String) -> Void) {
63 self.task = task; self.now = now; self.openTask = openTask
64 _model = State(initialValue: TaskDetailModel(session: session, taskID: task.id))
65 }
66 var body: some View {
67 @Bindable var model = model
68 Panel(padding: 14, spacing: 10) {
69 TodayTaskRow(task: task, now: now, running: false) { openTask(task.id) }
70 if model.rules.available.contains(.undoMerge) {
71 RosterButton(title: TaskAction.undoMerge.title) {
72 Task { await model.perform(.undoMerge) }
73 }.disabled(model.busy).accessibilityIdentifier("today-undo-" + task.id)
74 }
75 if let failure = model.failure {
76 Text(failure).font(Typo.secondary).foregroundStyle(Palette.negative)
77 }
78 if let reverted = model.revertedTask {
79 Button(reverted.title) { openTask(reverted.id) }
80 }
81 }
82 .task(id: task.revision) { await model.load() }
83 .sheet(item: $model.confirmation) { TaskConfirmationSheet(model: model, confirmation: $0) }
84 }
85}
86