Show the phone's task list in the Mac's right pane from a list button

This commit is contained in:
Ian Gulliver
2026-10-22 10:31:49 -07:00
parent b54a1a04b3
commit 406f67a1a0
5 changed files with 94 additions and 65 deletions
+66
View File
@@ -215,6 +215,72 @@ private func rowIndent(_ task: ByreTask, _ depth: Int) -> CGFloat {
task.parentTaskId != nil ? 20 * CGFloat(depth - 1) : 0
}
struct TaskList: View {
@Environment(Store.self) private var store
@Environment(Overlays.self) private var overlays
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
ForEach(store.projects, id: \.id) { project in
let active = (store.tasks[project.id] ?? []).filter { $0.status == .active }
Button {
store.sheet = nil
store.focusProject(project.id)
} label: {
HStack(alignment: .firstTextBaseline, spacing: 6) {
Text(project.name)
.font(Fonts.font(13, weight: 700))
Text(project.defaultBranch)
.font(Fonts.font(11))
.foregroundStyle(Palette.muted)
Spacer(minLength: 0)
Image(systemName: "chevron.right")
.font(Fonts.font(11))
.foregroundStyle(Palette.muted)
}
.padding(.horizontal, 10)
.padding(.top, 16)
.padding(.bottom, 6)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
if active.isEmpty {
Text("No active tasks.")
.foregroundStyle(Palette.muted)
.padding(.horizontal, 10)
.padding(.vertical, 6)
}
TaskRows(active: active)
}
}
.padding(.horizontal, 8)
.padding(.bottom, 16)
}
.safeAreaInset(edge: .top, spacing: 0) {
HStack {
Spacer(minLength: 0)
Button("New task") {
overlays.openSwitcher(store)
}
.buttonStyle(WebButtonStyle())
.onGeometryChange(for: CGRect.self) { g in
g.frame(in: .named("window"))
} action: { frame in
overlays.pickerFrame = frame
}
}
.padding(.horizontal, 16)
.padding(.vertical, 6)
.background(Palette.bg)
.overlay(alignment: .bottom) {
Rectangle().fill(Palette.border).frame(height: 1)
}
}
.background(Palette.bg)
}
}
struct TaskRows: View {
let active: [ByreTask]
@Environment(Store.self) private var store