Skip to content

Commit

Permalink
Merge branch 'code-217' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlee01 authored and Harness committed Apr 18, 2023
2 parents b886a96 + ad28fbe commit 656cf90
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ interface PrReviewOption {
interface ReviewSplitButtonProps extends Pick<GitInfoProps, 'repoMetadata'> {
shouldHide: boolean
pullRequestMetadata?: TypesPullReq
refreshPr: () => void
}
const ReviewSplitButton = (props: ReviewSplitButtonProps) => {
const { pullRequestMetadata, repoMetadata, shouldHide } = props
const { pullRequestMetadata, repoMetadata, shouldHide, refreshPr } = props
const { getString } = useStrings()
const { showError, showSuccess } = useToaster()

Expand Down Expand Up @@ -69,6 +70,7 @@ const ReviewSplitButton = (props: ReviewSplitButtonProps) => {
.then(() => {
// setReset(true)
showSuccess(getString('pr.reviewSubmitted'))
refreshPr()
})
.catch(exception => showError(getErrorMessage(exception)))
}, [decisionOption, mutate, showError, showSuccess, getString])
Expand Down
18 changes: 17 additions & 1 deletion web/src/components/CommentBox/CommentBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import React, { useCallback, useRef, useState } from 'react'
import { useResizeDetector } from 'react-resize-detector'
import { Render, Match, Truthy, Falsy, Else } from 'react-jsx-match'
import { Container, Layout, Avatar, TextInput, Text, Color, FontVariation, FlexExpander } from '@harness/uicore'
import {
Container,
Layout,
Avatar,
TextInput,
Text,
Color,
FontVariation,
FlexExpander,
Button,
ButtonVariation,
ButtonSize
} from '@harness/uicore'
import cx from 'classnames'
import ReactTimeago from 'react-timeago'
import { noop } from 'lodash-es'
Expand Down Expand Up @@ -140,6 +152,10 @@ export const CommentBox = <T = unknown,>({
<Layout.Horizontal spacing="small" className={css.replyPlaceHolder} padding="medium">
<Avatar name={currentUserName} size="small" hoverCard={false} />
<TextInput placeholder={getString('replyHere')} onFocus={hidePlaceHolder} onClick={hidePlaceHolder} />
<Button
text={<strong>{getString('resolve')}</strong>}
variation={ButtonVariation.TERTIARY}
size={ButtonSize.SMALL}></Button>
</Layout.Horizontal>
</Container>
</Truthy>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function RepositoryPageHeader({
</Fragment>
))}
</Layout.Horizontal>
<Container padding={{ top: 'xsmall', bottom: 'small' }}>
<Container padding={{ top: 'large', bottom: 'small' }}>
{typeof title === 'string' ? (
<Text tag="h1" font={{ variation: FontVariation.H4 }} tooltipProps={{ dataTooltipId }}>
{title}
Expand Down
1 change: 1 addition & 0 deletions web/src/framework/strings/stringTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export interface StringsMap {
requestChanges: string
required: string
resetZoom: string
resolve: string
resolved: string
reviewers: string
samplePayloadUrl: string
Expand Down
1 change: 1 addition & 0 deletions web/src/i18n/strings.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,4 @@ dangerDeleteRepo: Danger, are you sure you want to delete it?
repoUpdate: Repository Updated
deleteRepoText: Are you sure you want to delete the repository '{REPONAME}'?
deleteRepoTitle: Delete the repository
resolve: Resolve
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const PullRequestActionsBox: React.FC<PullRequestActionsBoxProps> = ({
shouldHide={(pullRequestMetadata?.state as EnumPullReqState) === 'merged'}
repoMetadata={repoMetadata}
pullRequestMetadata={pullRequestMetadata}
refreshPr={onPRStateChanged}
/>
<Container
inline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
padding-right: var(--spacing-small);
}

.noReviewerText {
padding-left: var(--spacing-13) !important;
.semiBoldText {
font-weight: 500 !important;
line-height: 18px !important;
--typography-color: var(--grey-500) !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ declare const styles: {
readonly reviewerPadding: string
readonly reviewerName: string
readonly reviewerAvatar: string
readonly noReviewerText: string
readonly semiBoldText: string
}
export default styles
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
<Button variation={ButtonVariation.TERTIARY} size={ButtonSize.SMALL} text={'Add +'}></Button>
</Layout.Horizontal>
<Container padding={{ top: 'medium', bottom: 'large' }}>
<Text padding={{ bottom: 'medium' }} font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
<Text className={css.semiBoldText} padding={{ bottom: 'medium' }} font={{ variation: FontVariation.FORM_LABEL, size: 'small' }}>
{getString('required')}
</Text>
{reviewers && reviewers?.length !== 0 ? (
Expand Down Expand Up @@ -120,13 +120,13 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
)
) : (
<Text
className={css.noReviewerText}
color={Color.GREY_300}
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
{getString('noRequiredReviewers')}
</Text>
)}
<Text
className={css.semiBoldText}
padding={{ top: 'medium', bottom: 'medium' }}
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
{getString('optional')}
Expand Down Expand Up @@ -175,7 +175,6 @@ const PullRequestSideBar = (props: PullRequestSideBarProps) => {
})
) : (
<Text
className={css.noReviewerText}
color={Color.GREY_300}
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
{getString('noOptionalReviewers')}
Expand Down
6 changes: 6 additions & 0 deletions web/src/pages/PullRequest/PullRequest.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
display: flex;
align-items: center;
height: 24px;
margin-top: var(--spacing-8);


> svg {
display: inline-block;
Expand All @@ -52,6 +54,10 @@
padding: 3px 6px !important;
}
}

.tabTitle:not:first-child {
margin-left: var(--spacing-8) !important;
}
}
}

Expand Down
16 changes: 13 additions & 3 deletions web/src/pages/PullRequest/PullRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
ButtonVariation,
ButtonSize,
TextInput,
useToaster
useToaster,
Spacing,
PaddingProps
} from '@harness/uicore'
import { useGet, useMutate } from 'restful-react'
import { Render, Match, Truthy, Else } from 'react-jsx-match'
Expand Down Expand Up @@ -167,6 +169,7 @@ export default function PullRequest() {
icon={CodeIcon.Commit}
title={getString('commits')}
count={prData?.stats?.commits || 0}
padding={{ left: 'medium' }}
/>
),
panel: (
Expand All @@ -185,6 +188,7 @@ export default function PullRequest() {
icon={CodeIcon.File}
title={getString('filesChanged')}
count={prData?.stats?.files_changed || 0}
padding={{ left: 'medium' }}
/>
),
panel: (
Expand All @@ -211,6 +215,7 @@ export default function PullRequest() {
icon={CodeIcon.ChecksSuccess}
title={getString('checks')}
count={0} // TODO: Count for checks when API supports it
padding={{ left: 'medium' }}
/>
),
panel: <Checks />
Expand Down Expand Up @@ -311,13 +316,18 @@ const PullRequestTitle: React.FC<PullRequestTitleProps> = ({ repoMetadata, title
)
}

const TabTitle: React.FC<{ icon: IconName; title: string; count?: number }> = ({ icon, title, count }) => {
const TabTitle: React.FC<{ icon: IconName; title: string; count?: number; padding?: Spacing | PaddingProps }> = ({
icon,
title,
count,
padding
}) => {
// Icon inside a tab got overriden-and-looked-bad styles from UICore
// on hover. Use icon directly instead
const TabIcon: React.ElementType = HarnessIcons[icon]

return (
<Text className={css.tabTitle}>
<Text className={css.tabTitle} padding={padding}>
<TabIcon width={16} height={16} />
{title}
<Render when={count}>
Expand Down

0 comments on commit 656cf90

Please sign in to comment.