ready to merge and ready to discard as states

This commit is contained in:
Ian Gulliver
2026-10-19 17:53:54 -07:00
parent fb79919ebb
commit 2bb527aca0
11 changed files with 394 additions and 293 deletions
+6 -5
View File
@@ -98,16 +98,17 @@ private struct ProjectBlock: View {
}
}
private func nested(_ active: [ByreTask]) -> [(task: ByreTask, depth: Int)] {
@MainActor
private func nested(_ store: Store, _ active: [ByreTask]) -> [(task: ByreTask, depth: Int)] {
let ids = Set(active.map(\.id))
var out: [(task: ByreTask, depth: Int)] = []
func add(_ task: ByreTask, _ depth: Int) {
out.append((task, depth))
for child in active.filter({ $0.parentTaskId == task.id }).reversed() {
for child in store.byRank(active.filter({ $0.parentTaskId == task.id }).reversed()) {
add(child, depth + 1)
}
}
for task in active where task.parentTaskId == nil || !ids.contains(task.parentTaskId!) {
for task in store.byRank(active.filter { $0.parentTaskId == nil || !ids.contains($0.parentTaskId!) }) {
add(task, 0)
}
return out
@@ -125,7 +126,7 @@ private struct TaskRows: View {
.padding(.vertical, 6)
} else {
VStack(alignment: .leading, spacing: 0) {
ForEach(nested(active), id: \.task.id) { row in
ForEach(nested(store, active), id: \.task.id) { row in
TaskRow(task: row.task, depth: row.depth)
}
}
@@ -197,7 +198,7 @@ private struct TaskRow: View {
}
Text(ts.label)
.font(Fonts.font(11))
.foregroundStyle(ts.kind == .answer ? Palette.warn : Palette.muted)
.foregroundStyle(ts.needsYou ? Palette.warn : Palette.muted)
.help(ts.title)
}
}