M8: custom detents for ScarfGo sheets (permission, cron editor)

.medium is neither/nor — too tall to peek, too short to commit to.
Research recommends custom detents calibrated per sheet.

- Permission sheet: `[.height(220), .large]`. 220pt shows the prompt
  + first ~3 options without forcing the user to drag; `large` is
  there for edge-case prompts with many options.
- Cron editor: `[.large]` only. Cron editing is a focused task with
  a ~6-field form; peek detent is a distraction.

`.presentationDragIndicator(.visible)` on both so users know they
can drag the sheet without having to try + fail first.

No other sheets in the app today. The Forget-server confirmation
uses confirmationDialog (system-owned — no detents needed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alan Wizemann
2026-04-24 13:44:41 +02:00
parent 8282b1d604
commit 92fba712f8
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -78,6 +78,12 @@ struct ChatView: View {
optionId: optionId optionId: optionId
) )
} }
// Custom detents `.medium` is either too tall (empty
// space above) or too short (options clipped). A 220pt
// peek shows the prompt + first ~3 options; users can
// drag to large for long option lists.
.presentationDetents([.height(220), .large])
.presentationDragIndicator(.visible)
} }
} }
+7
View File
@@ -87,11 +87,18 @@ struct CronListView: View {
CronEditorView(initial: job, title: "Edit cron job") { edited in CronEditorView(initial: job, title: "Edit cron job") { edited in
Task { await vm.upsert(edited) } Task { await vm.upsert(edited) }
} }
// Cron editor is a Form with ~6 fields; .large gives room
// without cramping. No peek detent editing cron jobs is
// a focused task, not something users want to half-see.
.presentationDetents([.large])
.presentationDragIndicator(.visible)
} }
.sheet(isPresented: $showingNewJob) { .sheet(isPresented: $showingNewJob) {
CronEditorView(initial: nil, title: "New cron job") { created in CronEditorView(initial: nil, title: "New cron job") { created in
Task { await vm.upsert(created) } Task { await vm.upsert(created) }
} }
.presentationDetents([.large])
.presentationDragIndicator(.visible)
} }
} }
} }