From e179696678cad7c5510d58e810475babcbaeb2eb Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Thu, 9 Feb 2023 13:00:44 -0700 Subject: [PATCH] feat: [code-120]: internal page refresh button (#316) --- .../components/Changes/Changes.module.scss | 13 +++++ .../Changes/Changes.module.scss.d.ts | 3 ++ web/src/components/Changes/Changes.tsx | 21 +++++++- .../CommitsView/CommitsView.module.scss | 5 ++ .../CommitsView/CommitsView.module.scss.d.ts | 1 + .../components/CommitsView/CommitsView.tsx | 38 +++++++++++++- web/src/framework/strings/stringTypes.ts | 1 + web/src/i18n/strings.en.yaml | 3 +- .../Conversation/Conversation.module.scss | 29 +++++++++++ .../Conversation.module.scss.d.ts | 3 ++ .../PullRequest/Conversation/Conversation.tsx | 28 ++++++++++- .../PullRequestSideBar/PullRequestSideBar.tsx | 8 +-- web/src/pages/PullRequest/PullRequest.tsx | 49 +++++++++++++++++-- .../PullRequestCommits/PullRequestCommits.tsx | 13 ++++- web/src/utils/Utils.ts | 1 + 15 files changed, 201 insertions(+), 15 deletions(-) diff --git a/web/src/components/Changes/Changes.module.scss b/web/src/components/Changes/Changes.module.scss index 8f1e5e5af..a114f26c2 100644 --- a/web/src/components/Changes/Changes.module.scss +++ b/web/src/components/Changes/Changes.module.scss @@ -40,3 +40,16 @@ .container { background-color: var(--primary-bg) !important; } + +.hideBtn { + display: none; +} + +.refreshIcon { + padding-left: var(--spacing-xsmall) !important; + padding-right: var(--spacing-xsmall); +} + +.repeatBtn { + margin-left: var(--spacing-xsmall) !important; +} diff --git a/web/src/components/Changes/Changes.module.scss.d.ts b/web/src/components/Changes/Changes.module.scss.d.ts index 865b35ae8..301e459da 100644 --- a/web/src/components/Changes/Changes.module.scss.d.ts +++ b/web/src/components/Changes/Changes.module.scss.d.ts @@ -7,5 +7,8 @@ declare const styles: { readonly main: string readonly enableDiffLineBreaks: string readonly container: string + readonly hideBtn: string + readonly refreshIcon: string + readonly repeatBtn: string } export default styles diff --git a/web/src/components/Changes/Changes.tsx b/web/src/components/Changes/Changes.tsx index 510253aab..462945464 100644 --- a/web/src/components/Changes/Changes.tsx +++ b/web/src/components/Changes/Changes.tsx @@ -7,7 +7,8 @@ import { Text, StringSubstitute, Button, - PageError + PageError, + ButtonSize } from '@harness/uicore' import { Match, Case, Render } from 'react-jsx-match' import * as Diff2Html from 'diff2html' @@ -50,6 +51,8 @@ interface ChangesProps extends Pick { pullRequestMetadata?: TypesPullReq className?: string onCommentUpdate: () => void + prHasChanged?: boolean + handleRefresh?: () => void } export const Changes: React.FC = ({ @@ -61,7 +64,9 @@ export const Changes: React.FC = ({ emptyMessage, pullRequestMetadata, onCommentUpdate, - className + className, + prHasChanged, + handleRefresh }) => { const { getString } = useStrings() const [viewStyle, setViewStyle] = useUserPreference(UserPreference.DIFF_VIEW_STYLE, ViewStyle.SIDE_BY_SIDE) @@ -174,6 +179,18 @@ export const Changes: React.FC = ({ }} /> + {!prHasChanged ? null : ( +