The card window recomposes into three componentized panes (body, comments, attributes) with two mounts — beside or body-over-comments at ~3:2 — behind View ▸ Comments Beside Body. View ▸ Show Comments is one persisted app-wide bit, no content-derived auto-show; File ▸ Add Comment flips it on and focuses the composer. The thread renders author lines, edited markers, card-subset Markdown bodies, and read-only Quick Look chips under a count header with the sort- direction control. The composer edits comments/.draft/ on the slow cadence (blur, close, quit, ~30s interval), Escape only moves focus, ⌘↩ posts. Inline edit is a body-edit session in miniature: 700ms debounce, Save/⌘↩ commits, Cancel and Escape revert to session-start bytes, close flushes. File drops within either authoring surface carve out of the window-wide card default into that surface's attachments/; paperclips cover the no-drag path. Close flush runs inline flush, then draft save, then the comments/.trash purge; open sweeps crash residue. Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
111 lines
6.0 KiB
Swift
111 lines
6.0 KiB
Swift
import SwiftUI
|
|
|
|
// MARK: - The shared shape
|
|
|
|
/// The shape behind every menu row this milestone ships **before** the window that answers it.
|
|
///
|
|
/// 11-command-nexus.md's own contract runs both directions: "a command absent here doesn't exist, and
|
|
/// adding one means adding a row here first" — so once a row *is* in the Nexus, shipping the window
|
|
/// behind it is a validation-and-action change, not a menu change. `FutureCommand` below is that
|
|
/// reading, applied: the row exists now, stably titled and stably chorded — `NSUserKeyEquivalents`
|
|
/// already resolves it, so a user can remap it today — with validation pinned to `false` and the
|
|
/// action a no-op until the milestone named at the call site fills both in. That milestone's whole
|
|
/// diff then reads as "flip `.disabled`, fill the closure" rather than "add a menu item", which is
|
|
/// also why every call site below carries the codebase's `mN-` marker for a component still owed.
|
|
///
|
|
/// **The title never moves once a row ships**, disabled or not: a command wired live later must not
|
|
/// gain a second spelling on the way (04-interactions.md ▸ Configurable bindings — "toggles keep one
|
|
/// stable title, checkmark state only" — which applies to a row that has not started ticking yet
|
|
/// exactly as it does to one that has).
|
|
///
|
|
/// There was a `FutureToggleCommand` beside this — a disabled `Toggle` for a checkmark row — and it
|
|
/// went with the last of its call sites (Raw Source, `RawSourceCommand`). Every row still owed is a
|
|
/// plain command; a future checkmark row brings its scaffold back with it rather than keeping an
|
|
/// unused one warm.
|
|
struct FutureCommand: View {
|
|
let title: String
|
|
var key: KeyEquivalent?
|
|
var modifiers: EventModifiers = .command
|
|
|
|
var body: some View {
|
|
Button(title) {
|
|
// No-op: the milestone named at the call site wires this in.
|
|
}
|
|
.keyboardShortcut(key.map { KeyboardShortcut($0, modifiers: modifiers) })
|
|
.disabled(true)
|
|
}
|
|
}
|
|
|
|
// File ▸ Save as Template was the scaffold here and is now live, beside the command it mirrors
|
|
// (`SaveAsTemplateCommand`, in `AppCommands.swift` next to `DuplicateBoardCommand`, whose flush →
|
|
// cancellable copy → banner sequence it repeats with a different destination). The diff this file
|
|
// predicts, once more: the title did not move, the chord stayed absent, the validation and the
|
|
// action filled in — the last of them being 09's carve-out from the read-only lock, which is why it
|
|
// could not simply borrow Duplicate's predicate.
|
|
//
|
|
// File ▸ Add Attachment… (⇧⌘A) was the scaffold here and is now live, beside the focused value it
|
|
// reads (`AddAttachmentCommand`, in `CardAttachments.swift`) — the diff this file predicts: the
|
|
// title and the chord did not move, the validation and the action filled in. The attachment row's
|
|
// context menu (Open / Remove / Reveal in Finder) shipped with it, on the row view that now exists.
|
|
|
|
// MARK: - Edit ▸ Find Next / Find Previous
|
|
|
|
/// Edit ▸ Find Next / Find Previous (⌘G / ⇧⌘G) — the card window's find bar stepping,
|
|
/// "disabled in the board window — board search is a live filter, not a cursor"
|
|
/// (11-command-nexus.md).
|
|
///
|
|
// m6-card-window: joins `FindCommand` in the Edit menu once the card window's find-in-text exists
|
|
// (05-card-window.md). Both rows are unconditionally disabled here rather than reading `boardStore`
|
|
// to prove "board window" disables them: there is no card-window find session anywhere yet for
|
|
// either validation branch to check.
|
|
struct FindSteppingCommands: View {
|
|
var body: some View {
|
|
FutureCommand(title: "Find Next", key: "g", modifiers: .command)
|
|
FutureCommand(title: "Find Previous", key: "g", modifiers: [.shift, .command])
|
|
}
|
|
}
|
|
|
|
// MARK: - View ▸ Edit Body / Raw Source / History
|
|
|
|
/// View ▸ Edit Body (⌘E) / Raw Source (⌥⌘E) / History — the card window's three view-state rows
|
|
/// (11-command-nexus.md).
|
|
///
|
|
/// **Edit Body and Raw Source are both live** (`EditBodyCommand`, `RawSourceCommand`, each beside the
|
|
/// focused value it reads): the body column's Preview/Edit toggle, and the window-level outlet whose
|
|
/// toggling-off *applies*. Each diff was the one `FutureCommand` promises — the title and the chord
|
|
/// did not move, the validation and the action filled in — and the pair also carries the clause that
|
|
/// joins them, "Edit Body disables while Raw Source is active" (05-card-window.md).
|
|
///
|
|
// m7-git: History is a plain command that focuses the sidebar's History section, and disables
|
|
// outright on mode `none` / repo-nested boards once that section exists (05-card-window.md,
|
|
// 07-sync-collab.md). It remains unconditionally disabled here — the sidebar reserves the section's
|
|
// place (`CardWindowView.historySlot`) but draws nothing, so there is still no surface to focus.
|
|
/// The comments pane's two rows join them (11-command-nexus.md lists Show Comments and Comments
|
|
/// Beside Body between Edit Body and Raw Source): both are live, both are app-wide persisted bits,
|
|
/// and both are scoped to the card window (`ShowCommentsCommand`, `CommentsBesideBodyCommand`).
|
|
struct CardViewCommands: View {
|
|
var body: some View {
|
|
EditBodyCommand()
|
|
ShowCommentsCommand()
|
|
CommentsBesideBodyCommand()
|
|
RawSourceCommand()
|
|
FutureCommand(title: "History")
|
|
}
|
|
}
|
|
|
|
// MARK: - Board ▸ Pull / Push
|
|
|
|
/// Board ▸ Pull / Push — no default chord, remote-backed boards only (11-command-nexus.md;
|
|
/// 07-sync-collab.md: "also Board-menu items").
|
|
///
|
|
// m7-git: menu-bar twins of the board popover's own Pull/Push buttons (07-sync-collab.md).
|
|
// Validation will be remote-mode plus 06's abnormal-state pause ("disabled during 06's
|
|
// abnormal-state pause ... and on an unresolvable remote" — 11-command-nexus.md). Unconditionally
|
|
// disabled here: there is no remote model, no popover twin, and no git mode to validate against yet.
|
|
struct RemoteCommands: View {
|
|
var body: some View {
|
|
FutureCommand(title: "Pull")
|
|
FutureCommand(title: "Push")
|
|
}
|
|
}
|