Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Corner/UI/NewTaskField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ struct NewTaskField: View {
focused = false
onCancel?()
}
.onChange(of: focused) { wasFocused, isFocused in
// Perder el foco con el campo vacío = el usuario se
// arrepintió: avisar para que quien lo muestre lo retire
// (un campo vacío colgando no debe quedarse, SPEC §4.2).
if wasFocused, !isFocused, text.isEmpty { onCancel?() }
}
Comment on lines +38 to +43
.onAppear {
if autofocus { focused = true }
}
Expand Down
11 changes: 10 additions & 1 deletion Corner/UI/TaskGroupRows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ struct TaskGroupRows: View {
// si no, tocar "+" y no escribir nada dejaba el campo abierto sin
// manera de cerrarlo (SPEC §4.2).
onToggleExpand: (subtasks.isEmpty && !isExpanded) ? nil : { toggleExpanded() },
onAddSubtask: { withAnimation(.snappy) { _ = expanded.insert(task.id) } },
onAddSubtask: {
withAnimation(.snappy) {
// Segundo toque en un grupo abierto y vacío = cerrarlo.
if isExpanded, subtasks.isEmpty {
expanded.remove(task.id)
} else {
expanded.insert(task.id)
}
}
},
moveDestinations: Self.labeledDestinations(store.moveDestinations(),
excluding: task.assignedDay),
onMoveToDay: { day in withAnimation(.snappy) { store.move(task, to: day) } },
Expand Down
7 changes: 4 additions & 3 deletions docs/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ El panel se cierra cuando ocurre cualquiera de:
- **UI plegable:** el padre con subtareas muestra un chevron y un contador
"2/5". Expandir revela las subtareas indentadas + campo "Agregar paso…".
El estado expandido/colapsado es efímero (se colapsa al reabrir el panel).
El chevron también está disponible en un grupo **expandido pero aún vacío**,
y **Esc en su campo lo colapsa**: abrir el campo con "+" y no escribir nada
nunca deja una fila abierta sin forma de cerrarla.
Abrir el campo con "+" y no escribir nada **nunca deja una fila colgada**:
el grupo vacío se colapsa solo al perder el foco (clic en otra parte) o con
`Esc`, "+" vuelve a cerrarlo, y el chevron está disponible en cualquier
grupo expandido aunque no tenga subtareas todavía.
- **Crear la primera subtarea:** botón "+" visible al hacer hover sobre la tarea
(junto a la ✕), o clic derecho → "Agregar subtarea". Ambos expanden la fila y
el campo "Agregar paso…" toma el foco listo para escribir.
Expand Down
Loading