Skip to content

Commit

Permalink
Staged Nodes can now checkout their parent branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonni committed Nov 1, 2023
1 parent 8feaf63 commit 1462129
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/renderer/src/components/GitGraph/ContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {uuid} from '#preload';
import {isDefined, uuid} from '#preload';
import {ListItemIcon, ListItemText, Menu, MenuItem, Tooltip} from '@mui/material';
import type {UUID} from '@syn-types/app';
import type {Branch} from '@syn-types/branch';
Expand Down Expand Up @@ -162,6 +162,15 @@ const ContextMenu = ({
};

const actions: Action[] = [
...node.data.parents
.map(parent => repoBranches.find(b => b.head === parent))
.filter(isDefined)
.map(branch => ({
icon: <GitBranch />,
name: `Checkout ${branch.scope}/${branch.ref}`,
disabled: !node.data.staged,
onClick: () => checkout({id: branch.id}),
})),
...node.data.heads.map(branch => ({
icon: <GitBranch />,
name: `Checkout ${branches[branch]?.scope}/${branches[branch]?.ref}`,
Expand Down

0 comments on commit 1462129

Please sign in to comment.