From 1e6b61633f58d236a6bbe797e17a4b91b6f52ed1 Mon Sep 17 00:00:00 2001 From: test Date: Wed, 20 Nov 2019 23:36:43 -0600 Subject: [PATCH 1/7] update committer fetching --- lib/containers/git-tab-container.js | 3 ++ lib/controllers/git-tab-controller.js | 4 ++- lib/controllers/git-tab-header-controller.js | 36 ++++---------------- lib/views/git-tab-header-view.js | 4 +-- lib/views/git-tab-view.js | 4 +-- 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/lib/containers/git-tab-container.js b/lib/containers/git-tab-container.js index e8ddef3cf7..5da6f07776 100644 --- a/lib/containers/git-tab-container.js +++ b/lib/containers/git-tab-container.js @@ -5,12 +5,14 @@ import yubikiri from 'yubikiri'; import {autobind} from '../helpers'; import {nullCommit} from '../models/commit'; import {nullBranch} from '../models/branch'; +import {nullAuthor} from '../models/author'; import ObserveModel from '../views/observe-model'; import GitTabController from '../controllers/git-tab-controller'; const DEFAULT_REPO_DATA = { lastCommit: nullCommit, recentCommits: [], + committer: nullAuthor, isMerging: false, isRebasing: false, hasUndoHistory: false, @@ -38,6 +40,7 @@ export default class GitTabContainer extends React.Component { return yubikiri({ lastCommit: repository.getLastCommit(), recentCommits: repository.getRecentCommits({max: 10}), + committer: repository.getCommitter(), isMerging: repository.isMerging(), isRebasing: repository.isRebasing(), hasUndoHistory: repository.hasDiscardHistory(), diff --git a/lib/controllers/git-tab-controller.js b/lib/controllers/git-tab-controller.js index 3b3a93e553..7ff5be4bc5 100644 --- a/lib/controllers/git-tab-controller.js +++ b/lib/controllers/git-tab-controller.js @@ -7,7 +7,7 @@ import GitTabView from '../views/git-tab-view'; import UserStore from '../models/user-store'; import RefHolder from '../models/ref-holder'; import { - CommitPropType, BranchPropType, FilePatchItemPropType, MergeConflictItemPropType, RefHolderPropType, + AuthorPropType, CommitPropType, BranchPropType, FilePatchItemPropType, MergeConflictItemPropType, RefHolderPropType, } from '../prop-types'; import {autobind} from '../helpers'; @@ -22,6 +22,7 @@ export default class GitTabController extends React.Component { lastCommit: CommitPropType.isRequired, recentCommits: PropTypes.arrayOf(CommitPropType).isRequired, + committer: AuthorPropType.isRequired, isMerging: PropTypes.bool.isRequired, isRebasing: PropTypes.bool.isRequired, hasUndoHistory: PropTypes.bool.isRequired, @@ -95,6 +96,7 @@ export default class GitTabController extends React.Component { lastCommit={this.props.lastCommit} recentCommits={this.props.recentCommits} + committer={this.props.committer} isMerging={this.props.isMerging} isRebasing={this.props.isRebasing} hasUndoHistory={this.props.hasUndoHistory} diff --git a/lib/controllers/git-tab-header-controller.js b/lib/controllers/git-tab-header-controller.js index b0a6831531..c3e15f4709 100644 --- a/lib/controllers/git-tab-header-controller.js +++ b/lib/controllers/git-tab-header-controller.js @@ -1,12 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import {CompositeDisposable} from 'atom'; -import {nullAuthor} from '../models/author'; +import {AuthorPropType} from '../prop-types'; import GitTabHeaderView from '../views/git-tab-header-view'; export default class GitTabHeaderController extends React.Component { static propTypes = { - getCommitter: PropTypes.func.isRequired, + committer: AuthorPropType.isRequired, // Workspace currentWorkDir: PropTypes.string, @@ -15,14 +15,11 @@ export default class GitTabHeaderController extends React.Component { // Event Handlers handleWorkDirSelect: PropTypes.func.isRequired, onDidChangeWorkDirs: PropTypes.func.isRequired, - onDidUpdateRepo: PropTypes.func.isRequired, } constructor(props) { super(props); - this._isMounted = false; - this.state = {currentWorkDirs: [], committer: nullAuthor}; - this.disposable = new CompositeDisposable(); + this.state = {currentWorkDirs: []}; } static getDerivedStateFromProps(props, state) { @@ -32,31 +29,20 @@ export default class GitTabHeaderController extends React.Component { } componentDidMount() { - this._isMounted = true; - this.disposable.add(this.props.onDidChangeWorkDirs(this.resetWorkDirs)); - this.disposable.add(this.props.onDidUpdateRepo(this.updateCommitter)); - this.updateCommitter(); + this.disposable = this.props.onDidChangeWorkDirs(this.resetWorkDirs); } componentDidUpdate(prevProps) { - if ( - prevProps.onDidChangeWorkDirs !== this.props.onDidChangeWorkDirs - || prevProps.onDidUpdateRepo !== this.props.onDidUpdateRepo - ) { + if (prevProps.onDidChangeWorkDirs !== this.props.onDidChangeWorkDirs) { this.disposable.dispose(); - this.disposable = new CompositeDisposable(); - this.disposable.add(this.props.onDidChangeWorkDirs(this.resetWorkDirs)); - this.disposable.add(this.props.onDidUpdateRepo(this.updateCommitter)); - } - if (prevProps.getCommitter !== this.props.getCommitter) { - this.updateCommitter(); + this.disposable = this.props.onDidChangeWorkDirs(this.resetWorkDirs); } } render() { return ( { - const committer = await this.props.getCommitter() || nullAuthor; - if (this._isMounted) { - this.setState({committer}); - } - } - componentWillUnmount() { - this._isMounted = false; this.disposable.dispose(); } } diff --git a/lib/views/git-tab-header-view.js b/lib/views/git-tab-header-view.js index 78a71a990c..157cd14217 100644 --- a/lib/views/git-tab-header-view.js +++ b/lib/views/git-tab-header-view.js @@ -12,7 +12,7 @@ export default class GitTabHeaderView extends React.Component { workdirs: PropTypes.shape({[Symbol.iterator]: PropTypes.func.isRequired}).isRequired, // Event Handlers - handleWorkDirSelect: PropTypes.func, + handleWorkDirSelect: PropTypes.func.isRequired, } render() { @@ -21,7 +21,7 @@ export default class GitTabHeaderView extends React.Component { {this.renderCommitter()} diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index a5f10cc687..5a262dd67c 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -27,6 +27,7 @@ export default class GitTabView extends React.Component { lastCommit: PropTypes.object.isRequired, currentBranch: PropTypes.object, + committer: AuthorPropType, recentCommits: PropTypes.arrayOf(PropTypes.object).isRequired, isMerging: PropTypes.bool, isRebasing: PropTypes.bool, @@ -121,7 +122,7 @@ export default class GitTabView extends React.Component { const {repository} = this.props; return ( this.props.changeWorkingDirectory(e.target.value)} /> ); From 0ff3e18012b22d24a28f2d5cd4b1a3f5de39735c Mon Sep 17 00:00:00 2001 From: test Date: Wed, 20 Nov 2019 23:38:08 -0600 Subject: [PATCH 2/7] add introduction view and toggle for it on click of avatar --- lib/controllers/git-tab-controller.js | 4 + lib/controllers/git-tab-header-controller.js | 2 + lib/views/git-introduction-view.js | 111 +++++++++++++++++++ lib/views/git-tab-header-view.js | 2 + lib/views/git-tab-view.js | 18 +++ 5 files changed, 137 insertions(+) create mode 100644 lib/views/git-introduction-view.js diff --git a/lib/controllers/git-tab-controller.js b/lib/controllers/git-tab-controller.js index 7ff5be4bc5..6a8d512042 100644 --- a/lib/controllers/git-tab-controller.js +++ b/lib/controllers/git-tab-controller.js @@ -75,6 +75,7 @@ export default class GitTabController extends React.Component { this.state = { selectedCoAuthors: [], + showIntroduction: false, }; this.userStore = new UserStore({ @@ -93,6 +94,7 @@ export default class GitTabController extends React.Component { isLoading={this.props.fetchInProgress} repository={this.props.repository} + showIntroduction={this.state.showIntroduction} lastCommit={this.props.lastCommit} recentCommits={this.props.recentCommits} @@ -127,6 +129,8 @@ export default class GitTabController extends React.Component { changeWorkingDirectory={this.props.changeWorkingDirectory} getCurrentWorkDirs={this.props.getCurrentWorkDirs} onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={() => this.setState({showIntroduction: true})} + onDidCancelIntroduction={() => this.setState({showIntroduction: false})} attemptFileStageOperation={this.attemptFileStageOperation} attemptStageAllOperation={this.attemptStageAllOperation} diff --git a/lib/controllers/git-tab-header-controller.js b/lib/controllers/git-tab-header-controller.js index c3e15f4709..2b23dbe1e2 100644 --- a/lib/controllers/git-tab-header-controller.js +++ b/lib/controllers/git-tab-header-controller.js @@ -15,6 +15,7 @@ export default class GitTabHeaderController extends React.Component { // Event Handlers handleWorkDirSelect: PropTypes.func.isRequired, onDidChangeWorkDirs: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, } constructor(props) { @@ -50,6 +51,7 @@ export default class GitTabHeaderController extends React.Component { // Event Handlers handleWorkDirSelect={this.props.handleWorkDirSelect} + onDidClickAvatar={this.props.onDidClickAvatar} /> ); } diff --git a/lib/views/git-introduction-view.js b/lib/views/git-introduction-view.js new file mode 100644 index 0000000000..8ac3b149da --- /dev/null +++ b/lib/views/git-introduction-view.js @@ -0,0 +1,111 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {AuthorPropType} from '../prop-types'; + +import Author from '../models/author'; +import Commands, {Command} from '../atom/commands'; + +export default class GitIntroductionView extends React.Component { + static propTypes = { + commands: PropTypes.object.isRequired, + identity: AuthorPropType.isRequired, + onSave: PropTypes.func.isRequired, + onCancel: PropTypes.func, + }; + + constructor(props) { + super(props); + + this.state = { + name: '', + email: '', + saveDisabled: true, + }; + } + + render() { + return ( +
+ + + + +

Your Current Identity

+ {this.renderIndentity()} +

Add your name and email that will be used to identify your commits.

+
+ (this.nameInput = e)} + className="input-text github-Introduction-input" + value={this.state.name} + onChange={this.onNameChange} + tabIndex="1" + /> + (this.emailInput = e)} + className="input-text github-Introduction-input" + value={this.state.email} + onChange={this.onEmailChange} + tabIndex="2" + /> + + +
+

+ This will only modify/overwrite your local (repository)  + user.name and  + user.email. +

+
+ ); + } + + renderIndentity() { + return null; + } + + confirm = () => { + if (this.isInputValid()) { + this.props.onSave( + new Author( + this.state.email || this.props.identity.getEmail(), + this.state.name || this.props.identity.getFullName() + ) + ); + } + } + + cancel = () => { + this.props.onCancel(); + } + + onNameChange = e => { + this.setState({name: e.target.value}, this.validate); + } + + onEmailChange = e => { + this.setState({email: e.target.value}, this.validate); + } + + validate = () => { + this.setState({saveDisabled: !this.isInputValid()}); + } + + isInputValid = () => { + // email validation with regex has a LOT of corner cases, dawg. + // https://stackoverflow.com/questions/48055431/can-it-cause-harm-to-validate-email-addresses-with-a-regex + // to avoid bugs for users with nonstandard email addresses, + // just check to make sure email address contains `@` and move on with our lives. + return !!( + (this.state.name || this.state.email.includes('@')) + && (this.state.name || this.props.identity.getFullName()) + && (this.state.email.includes('@') || this.props.identity.getEmail()) + ); + } +} diff --git a/lib/views/git-tab-header-view.js b/lib/views/git-tab-header-view.js index 157cd14217..897ccf986f 100644 --- a/lib/views/git-tab-header-view.js +++ b/lib/views/git-tab-header-view.js @@ -13,6 +13,7 @@ export default class GitTabHeaderView extends React.Component { // Event Handlers handleWorkDirSelect: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, } render() { @@ -46,6 +47,7 @@ export default class GitTabHeaderView extends React.Component { src={avatarUrl || 'atom://github/img/avatar.svg'} title={`${name} ${email}`} alt={`${name}'s avatar`} + onClick={this.props.onDidClickAvatar} /> ); } diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index 5a262dd67c..3c2516314a 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -7,6 +7,7 @@ import StagingView from './staging-view'; import GitTabHeaderController from '../controllers/git-tab-header-controller'; import CommitController from '../controllers/commit-controller'; import RecentCommitsController from '../controllers/recent-commits-controller'; +import GitIntroductionView from './git-introduction-view'; import RefHolder from '../models/ref-holder'; import {isValidWorkdir, autobind} from '../helpers'; import {AuthorPropType, UserStorePropType, RefHolderPropType} from '../prop-types'; @@ -24,6 +25,7 @@ export default class GitTabView extends React.Component { repository: PropTypes.object.isRequired, isLoading: PropTypes.bool.isRequired, + showIntroduction: PropTypes.bool.isRequired, lastCommit: PropTypes.object.isRequired, currentBranch: PropTypes.object, @@ -65,6 +67,8 @@ export default class GitTabView extends React.Component { changeWorkingDirectory: PropTypes.func.isRequired, onDidChangeWorkDirs: PropTypes.func.isRequired, getCurrentWorkDirs: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, + onDidCancelIntroduction: PropTypes.func.isRequired, }; constructor(props, context) { @@ -105,6 +109,8 @@ export default class GitTabView extends React.Component { isEmpty = true; } else if (this.props.isLoading || this.props.repository.showGitTabLoading()) { isLoading = true; + } else if (this.props.showIntroduction || !this.props.committer.isPresent()) { + renderMethod = 'renderIntroduction'; } return ( @@ -130,11 +136,23 @@ export default class GitTabView extends React.Component { // Event Handlers onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={this.props.onDidClickAvatar} handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)} /> ); } + renderIntroduction() { + return ( + {}} + onCancel={this.props.onDidCancelIntroduction} + /> + ); + } + renderNormal() { return ( From b790fc592f573a27445d9bd0c2a5ef080f676ff7 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 21 Nov 2019 12:13:49 -0600 Subject: [PATCH 3/7] enable config changing --- lib/views/git-tab-view.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index 3c2516314a..29fac11a0c 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -147,7 +147,11 @@ export default class GitTabView extends React.Component { {}} + onSave={newIdentity => { + this.props.repository.setConfig('user.name', newIdentity.getFullName()); + this.props.repository.setConfig('user.email', newIdentity.getEmail()); + this.props.onDidCancelIntroduction(); + }} onCancel={this.props.onDidCancelIntroduction} /> ); From a1a0694387d991745a8bb75565c116066428bcfd Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 21 Nov 2019 12:14:08 -0600 Subject: [PATCH 4/7] add ability to do nothing on avatar click --- lib/views/git-tab-view.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/views/git-tab-view.js b/lib/views/git-tab-view.js index 29fac11a0c..553f217f30 100644 --- a/lib/views/git-tab-view.js +++ b/lib/views/git-tab-view.js @@ -118,13 +118,13 @@ export default class GitTabView extends React.Component { className={cx('github-Git', {'is-empty': isEmpty, 'is-loading': !isEmpty && isLoading})} tabIndex="-1" ref={this.props.refRoot.setter}> - {this.renderHeader()} + {this.renderHeader(isEmpty || isLoading)} {this[renderMethod]()} ); } - renderHeader() { + renderHeader(disableOnDidClickAvatar) { const {repository} = this.props; return ( {} : this.props.onDidClickAvatar} handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)} /> ); From 8e278e7886435fd90a26e78d1d89a6bc6b767265 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 21 Nov 2019 13:41:37 -0600 Subject: [PATCH 5/7] beginning styles of git introduction view --- lib/views/git-introduction-view.js | 26 +++++++---- styles/git-introduction.less | 75 ++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 styles/git-introduction.less diff --git a/lib/views/git-introduction-view.js b/lib/views/git-introduction-view.js index 8ac3b149da..7f12f8df0a 100644 --- a/lib/views/git-introduction-view.js +++ b/lib/views/git-introduction-view.js @@ -30,15 +30,14 @@ export default class GitIntroductionView extends React.Component { -

Your Current Identity

{this.renderIndentity()} -

Add your name and email that will be used to identify your commits.

+

Add your name and email that will be used to identify your commits.

(this.nameInput = e)} - className="input-text github-Introduction-input" + className="input-text git-Introduction-input" value={this.state.name} onChange={this.onNameChange} tabIndex="1" @@ -47,15 +46,17 @@ export default class GitIntroductionView extends React.Component { type="email" placeholder={this.props.identity.getEmail()} ref={e => (this.emailInput = e)} - className="input-text github-Introduction-input" + className="input-text git-Introduction-input" value={this.state.email} onChange={this.onEmailChange} tabIndex="2" /> - - +
+ + +

This will only modify/overwrite your local (repository)  @@ -67,7 +68,14 @@ export default class GitIntroductionView extends React.Component { } renderIndentity() { - return null; + return ( +

+

Your Current Identity

+ +

{this.props.identity.getFullName()}

+

{this.props.identity.getEmail()}

+
+ ); } confirm = () => { diff --git a/styles/git-introduction.less b/styles/git-introduction.less new file mode 100644 index 0000000000..a560453519 --- /dev/null +++ b/styles/git-introduction.less @@ -0,0 +1,75 @@ +@import "variables"; + +.git-Introduction { + display: flex; + flex-direction: column; + justify-content: center; + width: 100%; + height: 100%; + padding: @component-padding; + + &-header { + margin-bottom: @component-padding; + color: @text-color-highlight; + } + + &-heading { + margin: 0; + margin-bottom: @component-padding; + } + + &-avatar { + width: 50%; + border-radius: @component-border-radius * 3; + } + + &-name { + margin: @component-padding/2; + } + + &-email { + margin: 0; + } + + &-header, &-context, &-explanation { + text-align: center; + } + + &-options { + display: flex; + flex: 2; + flex-direction: column; + align-items: center; + padding-left: @component-padding; + padding-right: @component-padding; + } + + &-context { + margin-bottom: @component-padding/2; + } + + &-row { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + + .btn { + flex: 2 + } + + .btn-primary { + flex: 5; + margin-right: @component-padding; + } + } + + &-input { + margin-bottom: @component-padding/2; + } + + &-explanation { + color: @text-color-subtle; + margin-bottom: 0; + } +} From 81c85eee9342d858befe2ee2e5334d702e3cfe09 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 21 Nov 2019 17:01:42 -0600 Subject: [PATCH 6/7] fix core commands --- lib/views/git-introduction-view.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/views/git-introduction-view.js b/lib/views/git-introduction-view.js index 7f12f8df0a..cee178b56f 100644 --- a/lib/views/git-introduction-view.js +++ b/lib/views/git-introduction-view.js @@ -2,6 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import {AuthorPropType} from '../prop-types'; +import RefHolder from '../models/ref-holder'; + import Author from '../models/author'; import Commands, {Command} from '../atom/commands'; @@ -16,6 +18,8 @@ export default class GitIntroductionView extends React.Component { constructor(props) { super(props); + this.refRoot = new RefHolder(); + this.state = { name: '', email: '', @@ -25,8 +29,8 @@ export default class GitIntroductionView extends React.Component { render() { return ( -
- +
+ From 1f1fac88e626d5fbf60b8eb9ab2949193dffa4b0 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 21 Nov 2019 21:23:31 -0600 Subject: [PATCH 7/7] github avatar click prototype --- lib/containers/github-tab-header-container.js | 7 +++++-- lib/controllers/github-tab-controller.js | 10 ++++++++++ .../github-tab-header-controller.js | 3 +++ lib/views/github-login-view.js | 20 ++++++++++++++----- lib/views/github-tab-header-view.js | 6 ++++-- lib/views/github-tab-view.js | 13 ++++++++++++ 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/lib/containers/github-tab-header-container.js b/lib/containers/github-tab-header-container.js index c421ef68b0..1ad42d3a04 100644 --- a/lib/containers/github-tab-header-container.js +++ b/lib/containers/github-tab-header-container.js @@ -20,8 +20,9 @@ export default class GithubTabHeaderContainer extends React.Component { getCurrentWorkDirs: PropTypes.func.isRequired, // Event Handlers - handleWorkDirSelect: PropTypes.func, - onDidChangeWorkDirs: PropTypes.func, + handleWorkDirSelect: PropTypes.func.isRequired, + onDidChangeWorkDirs: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, } render() { @@ -83,6 +84,7 @@ export default class GithubTabHeaderContainer extends React.Component { // Event Handlers handleWorkDirSelect={this.props.handleWorkDirSelect} onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={this.props.onDidClickAvatar} /> ); } @@ -99,6 +101,7 @@ export default class GithubTabHeaderContainer extends React.Component { // Event Handlers handleWorkDirSelect={this.props.handleWorkDirSelect} onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={() => {}} /> ); } diff --git a/lib/controllers/github-tab-controller.js b/lib/controllers/github-tab-controller.js index 320d48b328..d1781316f9 100644 --- a/lib/controllers/github-tab-controller.js +++ b/lib/controllers/github-tab-controller.js @@ -32,6 +32,13 @@ export default class GitHubTabController extends React.Component { openGitTab: PropTypes.func.isRequired, } + constructor(props) { + super(props); + this.state = { + showLogin: false, + } + } + render() { const gitHubRemotes = this.props.allRemotes.filter(remote => remote.isGithubRepo()); const currentBranch = this.props.branches.getHeadBranch(); @@ -48,6 +55,7 @@ export default class GitHubTabController extends React.Component { this.setState({showLogin: true})} + onCancelLogin={() => this.setState({showLogin: false})} /> ); } diff --git a/lib/controllers/github-tab-header-controller.js b/lib/controllers/github-tab-header-controller.js index 78f4fba875..3f867fec48 100644 --- a/lib/controllers/github-tab-header-controller.js +++ b/lib/controllers/github-tab-header-controller.js @@ -14,6 +14,7 @@ export default class GithubTabHeaderController extends React.Component { // Event Handlers handleWorkDirSelect: PropTypes.func.isRequired, onDidChangeWorkDirs: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, } constructor(props) { @@ -51,6 +52,8 @@ export default class GithubTabHeaderController extends React.Component { // Event Handlers handleWorkDirSelect={this.props.handleWorkDirSelect} + onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={this.props.onDidClickAvatar} /> ); } diff --git a/lib/views/github-login-view.js b/lib/views/github-login-view.js index b641b8cb15..9fc0476723 100644 --- a/lib/views/github-login-view.js +++ b/lib/views/github-login-view.js @@ -7,6 +7,7 @@ export default class GithubLoginView extends React.Component { static propTypes = { children: PropTypes.node, onLogin: PropTypes.func, + onCancel: PropTypes.func, } static defaultProps = { @@ -53,6 +54,13 @@ export default class GithubLoginView extends React.Component { + { + typeof this.props.onCancel === 'function' ? ( + + ) : null + }
); } @@ -77,14 +85,16 @@ export default class GithubLoginView extends React.Component { />
  • -
  • -
diff --git a/lib/views/github-tab-header-view.js b/lib/views/github-tab-header-view.js index fdcfa69b8a..1016e6c8ac 100644 --- a/lib/views/github-tab-header-view.js +++ b/lib/views/github-tab-header-view.js @@ -12,7 +12,8 @@ export default class GithubTabHeaderView extends React.Component { workdirs: PropTypes.shape({[Symbol.iterator]: PropTypes.func.isRequired}).isRequired, // Event Handlers - handleWorkDirSelect: PropTypes.func, + handleWorkDirSelect: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, } render() { @@ -21,7 +22,7 @@ export default class GithubTabHeaderView extends React.Component { {this.renderUser()} @@ -45,6 +46,7 @@ export default class GithubTabHeaderView extends React.Component { src={avatarUrl || 'atom://github/img/avatar.svg'} title={`@${login}`} alt={`@${login}'s avatar`} + onClick={this.props.onDidClickAvatar} /> ); } diff --git a/lib/views/github-tab-view.js b/lib/views/github-tab-view.js index a0add89b17..aaa96ad4d8 100644 --- a/lib/views/github-tab-view.js +++ b/lib/views/github-tab-view.js @@ -7,6 +7,7 @@ import { } from '../prop-types'; import LoadingView from './loading-view'; import RemoteSelectorView from './remote-selector-view'; +import GithubLoginView from './github-login-view'; import GithubTabHeaderContainer from '../containers/github-tab-header-container'; import GithubTabHeaderController from '../controllers/github-tab-header-controller'; import GitHubBlankNoLocal from './github-blank-nolocal'; @@ -49,6 +50,8 @@ export default class GitHubTabView extends React.Component { openBoundPublishDialog: PropTypes.func.isRequired, openCloneDialog: PropTypes.func.isRequired, openGitTab: PropTypes.func.isRequired, + onDidClickAvatar: PropTypes.func.isRequired, + onCancelLogin: PropTypes.func.isRequired, } render() { @@ -85,6 +88,14 @@ export default class GitHubTabView extends React.Component { ); } + if (this.props.showLogin) { + return ( + {}} onCancel={this.props.onCancelLogin}> +

Log in to GitHub to access pull request informationand more!

+
+ ); + } + if (this.props.currentRemote.isPresent()) { // Single, chosen or unambiguous remote return ( @@ -142,6 +153,7 @@ export default class GitHubTabView extends React.Component { // Event Handlers handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)} onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={this.props.onDidClickAvatar} /> ); } @@ -156,6 +168,7 @@ export default class GitHubTabView extends React.Component { // Event Handlers handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)} onDidChangeWorkDirs={this.props.onDidChangeWorkDirs} + onDidClickAvatar={() => {}} /> ); }