iPad: more keyboard shortcuts, a New-chat button, and hover polish

Round out the Mac-parity keyboard/pointer affordances on the iPad split view.

Keyboard shortcuts (hidden buttons in SplitRootView carry them):
- ⌘N — start a new chat: select Home and focus the composer (also defaults the
  project). A one-shot Bool binding threads Home→StartChatComposer and is
  consumed on use, so it grabs focus on ⌘N but never on a later Home appearance
  (handles both "already on Home" via onChange and "switched from a session"
  via onAppear).
- ⌘1–4 — jump to Home / Projects / To-dos / Settings.
- ⌘R — refresh sessions.
- ⌘. — interrupt a running session (Mac's "stop"; otherwise only in the ⋯ menu).

UI:
- A visible "New chat" (compose) button in the sidebar toolbar runs the same
  action, so touch users get the affordance too (gated on control scope).

Hover (pointer):
- .hoverEffect on the transcript tool-call / tool-block rows and the Home
  in-progress session rows (native List rows already hover).

Verified in the iPad simulator: the New-chat action scrolls to + focuses the
composer with the project defaulted. Builds clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
2026-07-04 01:18:35 -07:00
co-authored by Claude Opus 4.8
parent fb7aeffcf0
commit 005776685d
5 changed files with 75 additions and 6 deletions
@@ -5,11 +5,16 @@ import NucleicProtocol
/// composer). Picks a project, types a prompt, optionally toggles Auto.
struct StartChatComposer: View {
@EnvironmentObject var store: RemoteStore
/// A one-shot request from the iPad `Cmd+N` shortcut to focus the prompt so a keyboard user can
/// start typing a new chat immediately. Consumed (reset to false) once handled, so it never
/// steals focus on a later Home appearance. `.constant(false)` for the iPhone/compact path.
var focusNewChat: Binding<Bool> = .constant(false)
@State private var projectID: ProjectID?
@State private var draft = ""
@State private var auto = false
@State private var model: String?
@State private var effort = MobileEfforts.fallback
@FocusState private var draftFocused: Bool
// Advanced options (the Mac new-session sheet's base branch + worktree fields).
@State private var showOptions = false
@State private var baseBranch = ""
@@ -79,6 +84,7 @@ struct StartChatComposer: View {
.lineLimit(1...5)
.orchestraGlow(active: MobileEfforts.isOrchestra(effort) && controlled)
.keyboardDismissable()
.focused($draftFocused)
Button {
if let project = selected {
let branch = baseBranch.trimmingCharacters(in: .whitespaces)
@@ -107,6 +113,18 @@ struct StartChatComposer: View {
effort = levels.last ?? MobileEfforts.fallback
}
}
// A Cmd+N (iPad) focuses the prompt so the keyboard user can type a new chat immediately.
// onAppear handles the case where Cmd+N switched to Home from a session (composer just
// mounted); onChange handles Cmd+N while Home is already on screen. Consumed either way.
.onAppear { consumeFocusRequest() }
.onChange(of: focusNewChat.wrappedValue) { consumeFocusRequest() }
}
private func consumeFocusRequest() {
guard focusNewChat.wrappedValue else { return }
if projectID == nil { projectID = store.dashboard.projects.first?.id }
draftFocused = true
focusNewChat.wrappedValue = false
}
}