Link running TODO items to their task
This commit is contained in:
@@ -470,10 +470,7 @@ private struct TodoRow: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
Text(item.title)
|
title
|
||||||
.foregroundStyle(task.map { taskPalette[$0.color] } ?? Palette.text)
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
action
|
action
|
||||||
}
|
}
|
||||||
if !item.body.isEmpty {
|
if !item.body.isEmpty {
|
||||||
@@ -485,6 +482,25 @@ private struct TodoRow: View {
|
|||||||
.background(task != nil && task?.id == store.selectedTaskId ? Palette.accentTint : .clear, in: RoundedRectangle(cornerRadius: 6))
|
.background(task != nil && task?.id == store.selectedTaskId ? Palette.accentTint : .clear, in: RoundedRectangle(cornerRadius: 6))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var title: some View {
|
||||||
|
let text = Text(item.title)
|
||||||
|
.foregroundStyle(task.map { taskPalette[$0.color] } ?? Palette.text)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
if let task {
|
||||||
|
Button {
|
||||||
|
store.focusTask(task.id)
|
||||||
|
} label: {
|
||||||
|
text.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.help("Open \(task.name)")
|
||||||
|
} else {
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var action: some View {
|
private var action: some View {
|
||||||
if let task {
|
if let task {
|
||||||
|
|||||||
Reference in New Issue
Block a user