Skip to content

Commit

Permalink
Merge pull request desktop#15377 from desktop/pr-no-changes
Browse files Browse the repository at this point in the history
PR View: No changes message
  • Loading branch information
tidy-dev authored Oct 4, 2022
2 parents 3e6cadd + 9a3c29b commit 08da825
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
31 changes: 30 additions & 1 deletion app/src/ui/open-pull-request/open-pull-request-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { ImageDiffType } from '../../models/diff'
import { Repository } from '../../models/repository'
import { DialogFooter, OkCancelButtonGroup, Dialog } from '../dialog'
import { Dispatcher } from '../dispatcher'
import { Ref } from '../lib/ref'
import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'

Expand Down Expand Up @@ -100,6 +103,7 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
private renderContent() {
return (
<div className="open-pull-request-content">
{this.renderNoChanges()}
{this.renderFilesChanged()}
</div>
)
Expand All @@ -117,9 +121,13 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
nonLocalCommitSHA,
} = this.props
const { commitSelection } = pullRequestState
const { diff, file, changesetData } = commitSelection
const { diff, file, changesetData, shas } = commitSelection
const { files } = changesetData

if (shas.length === 0) {
return
}

return (
<PullRequestFilesChanged
diff={diff}
Expand All @@ -137,6 +145,27 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
)
}

private renderNoChanges() {
const { pullRequestState, currentBranch } = this.props
const { commitSelection, baseBranch } = pullRequestState
const { shas } = commitSelection

if (shas.length !== 0) {
return
}

return (
<div className="open-pull-request-no-changes">
<div>
<Octicon symbol={OcticonSymbol.gitPullRequest} />
<h3>There are no changes.</h3>
<Ref>{baseBranch.name}</Ref> is up to date with all commits from{' '}
<Ref>{currentBranch.name}</Ref>.
</div>
</div>
)
}

private renderFooter() {
const gitHubRepository = this.props.repository.gitHubRepository
const isEnterprise =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ export class PullRequestFilesChanged extends React.Component<
}

public render() {
// TODO: handle empty change set
return (
<div className="pull-request-files-changed">
{this.renderHeader()}
Expand Down
9 changes: 9 additions & 0 deletions app/styles/ui/dialogs/_open-pull-request.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@
.open-pull-request-content {
padding: var(--spacing);
}

.open-pull-request-no-changes {
height: 100%;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
padding: var(--spacing-double);
}
}

0 comments on commit 08da825

Please sign in to comment.