Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 6c4088e

Browse files
committed
Pull in the other prototype views
1 parent a49a27c commit 6c4088e

File tree

4 files changed

+72
-18
lines changed

4 files changed

+72
-18
lines changed

lib/views/github-blank-nolocal.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
3+
export default function GitHubBlankNoLocal() {
4+
return (
5+
<div className="github-NoLocal github-Blank">
6+
<div className="github-Blank-LargeIcon icon icon-mark-github" />
7+
<h1 className="github-Blank-banner">Welcome</h1>
8+
<p className="github-Blank-context">How would you like to get started today?</p>
9+
<p className="github-Blank-option">
10+
<button
11+
className="github-Blank-actionBtn btn icon icon-repo-create">
12+
Create a new GitHub repository...
13+
</button>
14+
</p>
15+
<p className="github-Blank-option">
16+
<button
17+
className="github-Blank-actionBtn btn icon icon-repo-clone">
18+
Clone an existing GitHub repository...
19+
</button>
20+
</p>
21+
</div>
22+
);
23+
}

lib/views/github-blank-noremote.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
3+
export default function GitHubBlankNoRemote() {
4+
return (
5+
<div className="github-Local-NoRemotes github-Blank">
6+
<div className="github-Blank-LargeIcon icon icon-mark-github" />
7+
<p className="github-Blank-context">This repository has no remotes on GitHub.</p>
8+
<p className="github-Blank-option github-Blank-option--explained">
9+
<button
10+
className="github-Blank-actionBtn btn icon icon-globe">
11+
Publish on GitHub...
12+
</button>
13+
</p>
14+
<p className="github-Blank-explanation">
15+
Create a new GitHub repository and configure this git repository configured to push there.
16+
</p>
17+
</div>
18+
);
19+
}

lib/views/github-tab-view.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import {
88
import LoadingView from './loading-view';
99
import RemoteSelectorView from './remote-selector-view';
1010
import TabHeaderView from './tab-header-view';
11+
import GitHubBlankNoLocal from './github-blank-nolocal';
1112
import GitHubBlankUninitialized from './github-blank-uninitialized';
13+
import GitHubBlankNoRemote from './github-blank-noremote';
1214
import RemoteContainer from '../containers/remote-container';
1315

1416
export default class GitHubTabView extends React.Component {
@@ -52,6 +54,12 @@ export default class GitHubTabView extends React.Component {
5254
return <LoadingView />;
5355
}
5456

57+
if (this.props.repository.isAbsent()) {
58+
return (
59+
<GitHubBlankNoLocal />
60+
);
61+
}
62+
5563
if (this.props.repository.isEmpty()) {
5664
return (
5765
<GitHubBlankUninitialized />
@@ -90,16 +98,8 @@ export default class GitHubTabView extends React.Component {
9098
);
9199
}
92100

93-
// No remotes available
94-
// TODO: display a view that lets you create a repository on GitHub
95101
return (
96-
<div className="github-GitHub-noRemotes">
97-
<div className="github-GitHub-LargeIcon icon icon-mark-github" />
98-
<h1>No Remotes</h1>
99-
<div className="initialize-repo-description">
100-
<span>This repository does not have any remotes hosted at GitHub.com.</span>
101-
</div>
102-
</div>
102+
<GitHubBlankNoRemote />
103103
);
104104
}
105105

test/views/github-tab-view.test.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import RemoteSet from '../../lib/models/remote-set';
99
import Branch from '../../lib/models/branch';
1010
import GitHubTabView from '../../lib/views/github-tab-view';
1111

12-
import {buildRepository} from '../helpers';
12+
import {buildRepository, cloneRepository} from '../helpers';
1313

1414
describe('GitHubTabView', function() {
1515
let atomEnv;
@@ -32,6 +32,13 @@ describe('GitHubTabView', function() {
3232
assert.isTrue(wrapper.find('LoadingView').exists());
3333
});
3434

35+
it('renders a no-local view when no local repository is found', function() {
36+
const wrapper = shallow(buildApp({
37+
repository: Repository.absent(),
38+
}));
39+
assert.isTrue(wrapper.exists('GitHubBlankNoLocal'));
40+
});
41+
3542
it('renders a uninitialized view when a local repository is not initialized', async function() {
3643
const workdir = temp.mkdirSync();
3744
const repository = await buildRepository(workdir);
@@ -40,11 +47,19 @@ describe('GitHubTabView', function() {
4047
assert.isTrue(wrapper.exists('GitHubBlankUninitialized'));
4148
});
4249

43-
it('renders a RemoteContainer if a remote has been chosen', function() {
50+
it('renders a no-remote view when the local repository has no remotes', async function() {
51+
const repository = await buildRepository(await cloneRepository());
52+
53+
const wrapper = shallow(buildApp({repository, currentRemote: nullRemote, manyRemotesAvailable: false}));
54+
assert.isTrue(wrapper.exists('GitHubBlankNoRemote'));
55+
});
56+
57+
it('renders a RemoteContainer if a remote has been chosen', async function() {
58+
const repository = await buildRepository(await cloneRepository());
4459
const currentRemote = new Remote('aaa', '[email protected]:aaa/bbb.git');
4560
const currentBranch = new Branch('bbb');
4661
const handlePushBranch = sinon.spy();
47-
const wrapper = shallow(buildApp({currentRemote, currentBranch, handlePushBranch}));
62+
const wrapper = shallow(buildApp({repository, currentRemote, currentBranch, handlePushBranch}));
4863

4964
const container = wrapper.find('RemoteContainer');
5065
assert.isTrue(container.exists());
@@ -53,10 +68,12 @@ describe('GitHubTabView', function() {
5368
assert.isTrue(handlePushBranch.calledWith(currentBranch, currentRemote));
5469
});
5570

56-
it('renders a RemoteSelectorView when many remote choices are available', function() {
71+
it('renders a RemoteSelectorView when many remote choices are available', async function() {
72+
const repository = await buildRepository(await cloneRepository());
5773
const remotes = new RemoteSet();
5874
const handleRemoteSelect = sinon.spy();
5975
const wrapper = shallow(buildApp({
76+
repository,
6077
remotes,
6178
currentRemote: nullRemote,
6279
manyRemotesAvailable: true,
@@ -70,11 +87,6 @@ describe('GitHubTabView', function() {
7087
assert.isTrue(handleRemoteSelect.called);
7188
});
7289

73-
it('renders a static message when no remotes are available', function() {
74-
const wrapper = shallow(buildApp({currentRemote: nullRemote, manyRemotesAvailable: false}));
75-
assert.isTrue(wrapper.find('.github-GitHub-noRemotes').exists());
76-
});
77-
7890
it('calls changeWorkingDirectory when a project is selected', async function() {
7991
const changeWorkingDirectory = sinon.spy();
8092
const wrapper = shallow(await buildApp({changeWorkingDirectory}));

0 commit comments

Comments
 (0)