From a2e937a36d3adbf8897c04bc42a1f74936549aad Mon Sep 17 00:00:00 2001 From: Andrew Golovanov Date: Wed, 15 Jan 2025 17:38:04 +0100 Subject: [PATCH] fix: minor changes --- .../components/pull-request-header.tsx | 2 +- .../conversation/pull-request-panel.tsx | 21 +++++++------------ .../ui/src/views/repo/pull-request/utils.ts | 4 ++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/ui/src/views/repo/pull-request/components/pull-request-header.tsx b/packages/ui/src/views/repo/pull-request/components/pull-request-header.tsx index 7a96deaee..93614c00f 100644 --- a/packages/ui/src/views/repo/pull-request/components/pull-request-header.tsx +++ b/packages/ui/src/views/repo/pull-request/components/pull-request-header.tsx @@ -7,7 +7,7 @@ import { timeAgo } from '@utils/utils' import { IconType } from '../pull-request.types' import { getPrState } from '../utils' -type ThemeType = 'default' | 'destructive' | 'warning' | 'success' | 'emphasis' | 'muted' | null | undefined +type ThemeType = 'default' | 'destructive' | 'success' | 'emphasis' | 'muted' | null | undefined interface PullRequestTitleProps { data: { title?: string diff --git a/packages/ui/src/views/repo/pull-request/details/components/conversation/pull-request-panel.tsx b/packages/ui/src/views/repo/pull-request/details/components/conversation/pull-request-panel.tsx index e54e07fe5..2e16c50c8 100644 --- a/packages/ui/src/views/repo/pull-request/details/components/conversation/pull-request-panel.tsx +++ b/packages/ui/src/views/repo/pull-request/details/components/conversation/pull-request-panel.tsx @@ -11,7 +11,6 @@ import { DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, - DropdownMenuShortcut, DropdownMenuTrigger, Icon, Layout, @@ -202,10 +201,12 @@ const PullRequestPanel = ({ setNotBypassable(checkIfBypassAllowed) } }, [ruleViolationArr]) + const rebasePossible = useMemo( () => pullReqMetadata?.merge_target_sha !== pullReqMetadata?.merge_base_sha && !pullReqMetadata?.merged, [pullReqMetadata] ) + const moreTooltip = () => { return ( @@ -214,7 +215,7 @@ const PullRequestPanel = ({ - + { @@ -222,20 +223,16 @@ const PullRequestPanel = ({ e.stopPropagation() }} - className="cursor-pointer" > - - {'Mark as draft'} + Mark as draft { handlePrState('closed') e.stopPropagation() }} - className="cursor-pointer" > - - {'Close pull request'} + Close pull request {rebasePossible && ( - - {'Rebase'} + Rebase )} @@ -305,7 +300,7 @@ const PullRequestPanel = ({ )}