From 92fba712f8fbab42818e198f21c307050a912738 Mon Sep 17 00:00:00 2001 From: Alan Wizemann Date: Fri, 24 Apr 2026 13:44:41 +0200 Subject: [PATCH] M8: custom detents for ScarfGo sheets (permission, cron editor) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .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) --- scarf/Scarf iOS/Chat/ChatView.swift | 6 ++++++ scarf/Scarf iOS/Cron/CronListView.swift | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/scarf/Scarf iOS/Chat/ChatView.swift b/scarf/Scarf iOS/Chat/ChatView.swift index 72beea8..0731f5b 100644 --- a/scarf/Scarf iOS/Chat/ChatView.swift +++ b/scarf/Scarf iOS/Chat/ChatView.swift @@ -78,6 +78,12 @@ struct ChatView: View { 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) } } diff --git a/scarf/Scarf iOS/Cron/CronListView.swift b/scarf/Scarf iOS/Cron/CronListView.swift index a0c6f76..a798324 100644 --- a/scarf/Scarf iOS/Cron/CronListView.swift +++ b/scarf/Scarf iOS/Cron/CronListView.swift @@ -87,11 +87,18 @@ struct CronListView: View { CronEditorView(initial: job, title: "Edit cron job") { edited in 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) { CronEditorView(initial: nil, title: "New cron job") { created in Task { await vm.upsert(created) } } + .presentationDetents([.large]) + .presentationDragIndicator(.visible) } } }