diff --git a/docs/adr/0031-full-app-for-note-windows.md b/docs/adr/0031-full-app-for-note-windows.md new file mode 100644 index 00000000..18490526 --- /dev/null +++ b/docs/adr/0031-full-app-for-note-windows.md @@ -0,0 +1,30 @@ +--- +type: ADR +id: "0031" +title: "Full App instance for secondary note windows" +status: active +date: 2026-03-31 +--- + +## Context + +Laputa supports opening a note in a secondary window ("Open in New Window"). The original implementation used a dedicated `NoteWindow` component — a thin shell that rendered only the editor, duplicating some App-level logic (vault loading, settings, keyboard shortcuts) in a simplified but diverging form. As the main App gained features (properties editing, zoom, command palette, keyboard shortcuts), the `NoteWindow` shell fell behind, requiring ongoing maintenance to keep parity. + +## Decision + +**Remove `NoteWindow` and render the full `App` component in secondary note windows.** The window type is detected at startup via URL query parameters (`?window=note&path=...&vault=...`). When in note-window mode, the App initialises with panels hidden (sidebar collapsed, inspector collapsed) and auto-opens the target note once vault entries load. The window title is kept in sync with the active note title via the Tauri window API. + +## Options considered + +- **Keep `NoteWindow` shell** (status quo): lower initial bundle weight per window, but divergence grows with every main-App feature. Rejected — maintenance cost dominates. +- **Full `App` instance with URL-param mode** (chosen): complete feature parity for free; single code path for all window types. Trade-off: slightly heavier startup for secondary windows (full vault load), acceptable given local filesystem speed. +- **IPC-driven secondary window (no vault reload)**: secondary window subscribes to primary window's vault state via Tauri events. Maximum efficiency, avoids double vault reads. Deferred — requires significant IPC plumbing; can be layered on top later without changing the rendering model. + +## Consequences + +- Removes ~163 lines (`NoteWindow.tsx` deleted entirely) +- Secondary note windows get full feature parity: all keyboard shortcuts, properties panel, zoom, command palette, diff mode, raw editor +- `useLayoutPanels` gains an `initialInspectorCollapsed` option to support the hidden-panel initial state +- A new `src/utils/windowMode.ts` utility encapsulates URL-param detection — single source of truth for window-type logic +- Vault is loaded independently in each note window (no shared state with the main window); writes go to the same filesystem so eventual consistency is maintained via file-watching +- Triggers re-evaluation if: multiple simultaneous note windows cause measurable vault-read contention, or if IPC-driven shared-state windows become a product requirement diff --git a/docs/adr/0032-status-bar-for-git-actions.md b/docs/adr/0032-status-bar-for-git-actions.md new file mode 100644 index 00000000..9d01e146 --- /dev/null +++ b/docs/adr/0032-status-bar-for-git-actions.md @@ -0,0 +1,29 @@ +--- +type: ADR +id: "0032" +title: "Git actions (Changes, Pulse, Commit) in status bar, not sidebar" +status: active +date: 2026-03-31 +--- + +## Context + +The Laputa sidebar originally surfaced git-related affordances — a "Changes" nav item (visible when modified files > 0), a "Pulse" nav item, and a "Commit & Push" button — alongside the note-type navigation filters and sections. This mixed two concerns in the sidebar: **navigation** (where to go) and **git status / actions** (what changed, what to do). As the sidebar grew, the git items created visual noise and made the nav hierarchy harder to scan. + +## Decision + +**Move Changes, Pulse, and Commit & Push out of the sidebar and into the bottom status bar.** The status bar shows a GitDiff icon with an orange count badge for modified files; a Pulse icon sits next to it. Commit & Push is accessible via an icon button beside the Changes indicator. The sidebar now contains only navigation items (filters and type sections). + +## Options considered + +- **Keep git items in sidebar** (status quo): familiar placement, visible at all times. Rejected — mixes navigation and action concerns; sidebar becomes harder to scan. +- **Status bar** (chosen): consistent with app conventions (build number, sync status, vault switcher already live there); persistent but unobtrusive; follows macOS app patterns where status/action items live at window bottom. +- **Toolbar / breadcrumb bar**: would require a new chrome layer or polluting the per-note breadcrumb with global git state. Rejected. + +## Consequences + +- Sidebar props `modifiedCount`, `onCommitPush`, `isGitVault` removed; sidebar renders navigation-only +- `StatusBar` gains `onClickPending`, `onClickPulse`, `onCommitPush`, `isGitVault` props +- Sidebar tests for Changes/Pulse/Commit button removed; StatusBar tests extended +- Users find Commit & Push in the status bar (same location as sync indicators) rather than bottom of sidebar — small discoverability change, offset by status bar being always visible regardless of sidebar collapsed state +- Triggers re-evaluation if: user research shows git actions are hard to discover in the status bar diff --git a/docs/adr/README.md b/docs/adr/README.md index 08711c47..d2bda2aa 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -86,3 +86,5 @@ proposed → active → superseded | [0028](0028-cli-agent-only-no-api-key.md) | CLI agent only — no direct Anthropic API key | active | | [0029](0029-domain-command-builder-pattern.md) | Domain command builder pattern for useCommandRegistry | active | | [0030](0030-rust-commands-module-split.md) | Rust commands/ module split by domain | active | +| [0031](0031-full-app-for-note-windows.md) | Full App instance for secondary note windows | active | +| [0032](0032-status-bar-for-git-actions.md) | Git actions (Changes, Pulse, Commit) in status bar, not sidebar | active |