fix: editor usability and visual polish from UI scan

- Rule name is now an inline text field at the top of the editor; the
  pencil/rename button and alert are gone (it was unclear what the edit
  button did). Names are sanitized on commit: trimmed, falling back to
  the kind's default when emptied
- Day-of-week toggles fill the full row width with equal cells and
  >= 44pt tap targets
- 'Add Rule' commit button sits on a bar-material bottom inset so form
  content no longer collides with it while scrolling (found via
  computer-use scan; verified clean in a follow-up scan)
- Tests: 95 passing — new specs for the inline rename flow, day-toggle
  geometry, and name sanitization; three tests now scroll to reach
  bottom-of-form controls, matching real user behavior
- Spec §6 updated for the editor changes
This commit is contained in:
2026-06-12 15:44:25 -04:00
parent 0242e0a9d3
commit 4ee8f01d21
7 changed files with 86 additions and 36 deletions

View File

@@ -110,6 +110,20 @@ struct RuleDraftTests {
#expect(rule.hardMode)
}
@Test("Sanitizing trims whitespace and falls back to the kind default")
func sanitizedName() {
var draft = RuleDraft(kind: .schedule)
draft.name = " Deep Work "
#expect(draft.sanitized().name == "Deep Work")
draft.name = " "
#expect(draft.sanitized().name == "In the Zone")
var limitDraft = RuleDraft(kind: .timeLimit)
limitDraft.name = ""
#expect(limitDraft.sanitized().name == "Time Keeper")
}
@Test("Preset drafts copy the preset's schedule")
func presetDraft() throws {
let preset = try #require(