diff --git a/package.json b/package.json index 442a0f740b..353e54de7b 100644 --- a/package.json +++ b/package.json @@ -3480,16 +3480,19 @@ "group": "1_create@2" }, { - "command": "review.approve", - "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentApprove" + "command": "review.comment", + "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentComment", + "group": "1_review@1" }, { - "command": "review.comment", - "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentComment" + "command": "review.approve", + "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentApprove", + "group": "1_review@2" }, { "command": "review.requestChanges", - "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentRequestChanges" + "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentRequestChanges", + "group": "1_review@3" }, { "command": "review.approveOnDotCom", @@ -3500,16 +3503,19 @@ "when": "webviewId == 'github:activePullRequest' && github:reviewCommentMenu && github:reviewCommentRequestChangesOnDotCom" }, { - "command": "review.approveDescription", - "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentApprove" + "command": "review.commentDescription", + "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentComment", + "group": "1_review@1" }, { - "command": "review.commentDescription", - "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentComment" + "command": "review.approveDescription", + "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentApprove", + "group": "1_review@2" }, { "command": "review.requestChangesDescription", - "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentRequestChanges" + "when": "webviewId == PullRequestOverview && github:reviewCommentMenu && github:reviewCommentRequestChanges", + "group": "1_review@3" }, { "command": "review.approveOnDotComDescription", diff --git a/webviews/components/comment.tsx b/webviews/components/comment.tsx index c83c74bc31..bfd5e63286 100644 --- a/webviews/components/comment.tsx +++ b/webviews/components/comment.tsx @@ -460,12 +460,12 @@ export function AddComment({ defaultOptionValue={() => currentSelection} allOptions={() => { const actions: { label: string; value: string; optionDisabled: boolean; action: (event: React.MouseEvent) => void }[] = []; - if (availableActions.approve) { - actions.push({ label: availableActions[ReviewType.Approve]!, value: ReviewType.Approve, action: () => submitAction(ReviewType.Approve), optionDisabled: shouldDisableApproveButton }); - } if (availableActions.comment) { actions.push({ label: availableActions[ReviewType.Comment]!, value: ReviewType.Comment, action: () => submitAction(ReviewType.Comment), optionDisabled: shouldDisableNonApproveButtons }); } + if (availableActions.approve) { + actions.push({ label: availableActions[ReviewType.Approve]!, value: ReviewType.Approve, action: () => submitAction(ReviewType.Approve), optionDisabled: shouldDisableApproveButton }); + } if (availableActions.requestChanges) { actions.push({ label: availableActions[ReviewType.RequestChanges]!, value: ReviewType.RequestChanges, action: () => submitAction(ReviewType.RequestChanges), optionDisabled: shouldDisableNonApproveButtons }); } @@ -475,6 +475,7 @@ export function AddComment({ disabled={isBusy || busy} hasSingleAction={Object.keys(availableActions).length === 1} spreadable={true} + primaryOptionValue={ReviewType.Comment} /> @@ -608,12 +609,12 @@ export const AddCommentSimple = (pr: PullRequest) => { defaultOptionValue={() => currentSelection} allOptions={() => { const actions: { label: string; value: string; optionDisabled: boolean; action: (event: React.MouseEvent) => void }[] = []; - if (availableActions.approve) { - actions.push({ label: availableActions[ReviewType.Approve]!, value: ReviewType.Approve, action: () => submitAction(ReviewType.Approve), optionDisabled: shouldDisableApproveButton }); - } if (availableActions.comment) { actions.push({ label: availableActions[ReviewType.Comment]!, value: ReviewType.Comment, action: () => submitAction(ReviewType.Comment), optionDisabled: shouldDisableNonApproveButtons }); } + if (availableActions.approve) { + actions.push({ label: availableActions[ReviewType.Approve]!, value: ReviewType.Approve, action: () => submitAction(ReviewType.Approve), optionDisabled: shouldDisableApproveButton }); + } if (availableActions.requestChanges) { actions.push({ label: availableActions[ReviewType.RequestChanges]!, value: ReviewType.RequestChanges, action: () => submitAction(ReviewType.RequestChanges), optionDisabled: shouldDisableNonApproveButtons }); } @@ -623,6 +624,7 @@ export const AddCommentSimple = (pr: PullRequest) => { disabled={isBusy || pr.busy} hasSingleAction={Object.keys(availableActions).length === 1} spreadable={true} + primaryOptionValue={ReviewType.Comment} /> diff --git a/webviews/components/contextDropdown.tsx b/webviews/components/contextDropdown.tsx index 9863dbb203..907777903d 100644 --- a/webviews/components/contextDropdown.tsx +++ b/webviews/components/contextDropdown.tsx @@ -17,6 +17,7 @@ interface ContextDropdownProps { hasSingleAction?: boolean; spreadable: boolean; isSecondary?: boolean; + primaryOptionValue?: string; } function useWindowSize() { @@ -32,7 +33,7 @@ function useWindowSize() { return size; } -export const ContextDropdown = ({ optionsContext, defaultOptionLabel, defaultOptionValue, defaultAction, allOptions: options, optionsTitle, disabled, hasSingleAction, spreadable, isSecondary }: ContextDropdownProps) => { +export const ContextDropdown = ({ optionsContext, defaultOptionLabel, defaultOptionValue, defaultAction, allOptions: options, optionsTitle, disabled, hasSingleAction, spreadable, isSecondary, primaryOptionValue }: ContextDropdownProps) => { const [expanded, setExpanded] = useState(false); const onHideAction = (e: MouseEvent | KeyboardEvent) => { if (e.target instanceof HTMLElement && e.target.classList.contains('split-right')) { @@ -56,7 +57,9 @@ export const ContextDropdown = ({ optionsContext, defaultOptionLabel, defaultOpt return
{divRef.current && spreadable && (divRef.current.clientWidth > 375) && options && !hasSingleAction ? options().map(({ label, value, action, optionDisabled }) => { - return ; + // Only the primary option should use the primary (blue) button style when expanded + const isPrimary = primaryOptionValue && value === primaryOptionValue; + return ; }) :