Skip to content

sometimes it doesn't make sense to create a branch - #3736

Merged
iAmWillShepherd merged 1 commit into
masterfrom
you-cant-always-create-a-branch
Jan 7, 2018
Merged

iAmWillShepherd merged 1 commit into
masterfrom
you-cant-always-create-a-branch

Conversation

@shiftkey

@shiftkey shiftkey commented Jan 5, 2018

Copy link
Copy Markdown
Member

Fixes #3733

This is what you now see when a branch can't be found in the merge dialog:

I wanted to use React fragments in here to avoid refactoring the layout and CSS, but that doesn't seem to be supported in pre-16. This is what it would look like:

  public render() {
    return (
      <div className="no-branches">
        <img src={BlankSlateImage} className="blankslate-image" />

        <div className="title">Sorry, I can't find that branch</div>

        {this.renderCreateBranch()}
      </div>
    )
  }

  private renderCreateBranch(): JSX.Element | null {
    if (this.props.canCreateNewBranch) {
      return (
        <>
          <div className="subtitle">
            Do you want to create a new branch instead?
          </div>

          <Button
            className="create-branch-button"
            onClick={this.props.onCreateNewBranch}
            type="submit"
          >
            {__DARWIN__ ? 'Create New Branch' : 'Create new branch'}
          </Button>

          <div className="protip">
            ProTip! Press {this.renderShortcut()} to quickly create a new branch
            from anywhere within the app
          </div>
        </>
      )
    } else {
      return null
    }
  }

@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 5, 2018
@iAmWillShepherd iAmWillShepherd self-assigned this Jan 7, 2018
@iAmWillShepherd
iAmWillShepherd merged commit 6684413 into master Jan 7, 2018
@iAmWillShepherd
iAmWillShepherd deleted the you-cant-always-create-a-branch branch January 7, 2018 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants