detail: always show the subtasks group so add is reachable
All checks were successful
CI / ci (push) Successful in 8m38s

Render the subtasks group on every task, not just ones that already
have children, so the inline add field is available from the start.
Hide the done/total count until there's at least one subtask.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-23 11:03:12 +02:00
parent 11f9649dd7
commit 3db553da85

View File

@@ -266,8 +266,8 @@ private fun DetailBody(
} }
// Subtasks — a genuine group: a connected grouped run whose first // Subtasks — a genuine group: a connected grouped run whose first
// segment is the expand/collapse toggle. // segment is the expand/collapse toggle. Always shown (even with no
if (detail.subtasks.isNotEmpty()) { // subtasks yet) so the add field is reachable on any task.
add { add {
SubtasksGroup( SubtasksGroup(
subtasks = detail.subtasks, subtasks = detail.subtasks,
@@ -279,7 +279,6 @@ private fun DetailBody(
) )
} }
} }
}
cards.forEachIndexed { index, card -> cards.forEachIndexed { index, card ->
if (index > 0) Spacer(Modifier.height(gap)) if (index > 0) Spacer(Modifier.height(gap))
card() card()
@@ -326,12 +325,15 @@ private fun SubtasksGroup(
style = MaterialTheme.typography.titleMedium, style = MaterialTheme.typography.titleMedium,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
) )
// No count until there's something to count.
if (subtasks.isNotEmpty()) {
Text( Text(
text = "$done / ${subtasks.size}", text = "$done / ${subtasks.size}",
style = MaterialTheme.typography.labelLarge, style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
) )
Spacer(Modifier.width(8.dp)) Spacer(Modifier.width(8.dp))
}
Icon( Icon(
imageVector = Icons.Rounded.ExpandMore, imageVector = Icons.Rounded.ExpandMore,
contentDescription = null, contentDescription = null,