feat(staged): add timeline row context menu actions#668
Conversation
…ine rows Right-clicking a commit row in the BranchCard timeline now shows a context menu with a "Copy SHA" option that copies the full commit SHA to the clipboard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eline items Right-clicking any completed timeline item (commit, note, review, or project note) now shows a "New session referring to this" option that opens the new session dialog pre-filled with `Re: #<type>:<id>`. If the dialog is already open with user content, the hashtag reference is appended on a new line instead. For project-level notes, the reference is inserted into the project prompt input. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…g reference For project-level notes, await tick() before focusing the prompt input and use Selection/Range API to position the cursor at the end of the contenteditable element after the reference text is inserted. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract focusAtEnd() utility to reduce duplication between ProjectSection and HashtagInput cursor-positioning logic. - Lift context menu state from per-TimelineRow instances into a single TimelineContextMenu component rendered once per timeline. This eliminates N window-level click/keydown listeners (one per row) and replaces them with a single set of listeners. - Add viewport boundary clamping so the context menu never overflows off-screen (measures the menu element after render and adjusts position with an 8px margin). - Fix: right-clicking another row now correctly closes any existing context menu via the window oncontextmenu handler, since only one menu instance exists per timeline.
- Extract focusAtEndSync() for use in $effect where DOM is already
fresh, avoiding fire-and-forget async in synchronous effects.
focusAtEnd() now delegates to focusAtEndSync() after tick().
- Normalize hashtagRef assignment in BranchTimeline to consistently
use the derived `type` check (`type === 'commit'`) rather than
mixing data-availability checks (`commit.sha ?`) with type checks.
- Fix rAF race in TimelineContextMenu.open(): track pendingRaf and
cancel any in-flight animation frame before scheduling a new one,
preventing stale coordinates from clobbering on rapid right-clicks.
- Keep <svelte:window> listeners at top level with early-return guards
(Svelte disallows <svelte:window> inside {#if} blocks).
Right-clicking a commit row in the BranchCard timeline now shows a "Revert commit" option that runs `git revert --no-edit <sha>` to create a new commit undoing the selected commit's changes. Supports both local worktrees and remote workspaces. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4af648cf8b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| function handleContextMenu(e: MouseEvent) { | ||
| if (!hasContextMenu || !onContextMenu) return; | ||
| e.preventDefault(); | ||
| e.stopPropagation(); |
There was a problem hiding this comment.
Let right-click events reach window-level menu handlers
Because each BranchTimeline mounts its own TimelineContextMenu instance (apps/staged/src/lib/features/timeline/BranchTimeline.svelte:695), stopping propagation here prevents other open menus from seeing the new contextmenu event and closing. In projects with multiple branch cards, right-clicking a row in branch B after opening branch A’s menu can leave both menus open at once, which is a visible UI regression and makes actions ambiguous.
Useful? React with 👍 / 👎.
|
|
||
| /// Revert a commit by creating a new commit that undoes its changes. | ||
| pub fn revert_commit(worktree: &Path, commit_sha: &str) -> Result<(), GitError> { | ||
| cli::run(worktree, &["revert", "--no-edit", commit_sha])?; |
There was a problem hiding this comment.
Handle merge commits in revert command
This implementation always runs git revert --no-edit <sha>, which fails for merge commits because Git requires selecting a mainline parent (-m). The new context menu exposes “Revert commit” for any commit row, so branches containing merge commits will consistently hit a backend error instead of reverting. The same issue also exists in the workspace path (apps/staged/src-tauri/src/timeline.rs:475).
Useful? React with 👍 / 👎.
Summary