Skip to content

Commit 37089c4

Browse files
Merge pull request #187 from ekonstantinidis/improve-navbar
Improve UI
2 parents 3fa916a + cb8faca commit 37089c4

File tree

15 files changed

+323
-302
lines changed

15 files changed

+323
-302
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Gitify
2-
[![travis][travis-image]][travis-url]
3-
[![codecov][codecov-image]][codecov-url]
4-
[![slack][slack-image]][slack-url]
5-
6-
### GitHub Notifications on your menu bar.
2+
[![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![slack][slack-image]][slack-url]
73

84
![Gitify](images/press.png)
95

@@ -20,8 +16,8 @@ It has been a while since this app was made so I decided to give it a good revam
2016
- [x] Update Bootstrap to version 4 - Which means move from LESS to SCSS.
2117
- [x] Rewrite tests with Mocha - Since gitify is moving from Reflux to Redux, all tests have to be rewritten.
2218
- [x] Move to Codecov for coverage with new tests
23-
- [ ] Revamp the UI. From Scratch?
24-
- [ ] Rebranding - New Logo! Fresh stuff!
19+
- [x] Rebranding - New Logo! Fresh stuff!
20+
- [x] Revamp the UI. From Scratch?
2521

2622
If you would like to help let me know! There is a slack channel for gitify in the [atom](http://atomio.slack.com) team. See badge on the header.
2723

images/press.png

2.97 MB
Loading

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"build": "webpack",
88
"watch": "webpack --progress --colors --watch",
99
"release-js": "webpack --config webpack.rel.config.js",
10-
"package": "electron-packager . Gitify --overwrite --platform=darwin --arch=x64 --version=0.35.4 --asar=true --icon=images/app-icon.icns --prune --ignore='src' --ignore='coverage'",
10+
"package": "electron-packager . Gitify --overwrite --platform=darwin --arch=x64 --version=1.0.2 --asar=true --icon=images/app-icon.icns --prune --ignore='src' --ignore='coverage'",
1111
"codesign": "bash scripts/codesign.bash",
1212
"dist": "npm run release-js && npm run package && npm run codesign",
1313
"lint-js": "eslint 'src/js/' 'src/js/app.js' 'main.js'",
@@ -51,6 +51,8 @@
5151
"dependencies": {
5252
"auto-launch": "=2.0.1",
5353
"bootstrap": "=4.0.0-alpha.2",
54+
"electron-gh-releases": "=2.0.2",
55+
"electron-positioner": "=3.0.0",
5456
"font-awesome": "=4.6.1",
5557
"history": "=2.1.1",
5658
"malarkey": "=1.3.3",
@@ -70,7 +72,6 @@
7072
"redux-storage": "=4.0.0",
7173
"redux-storage-decorator-filter": "=1.1.3",
7274
"redux-storage-engine-localstorage": "=1.1.0",
73-
"reloading": "=0.0.6",
7475
"underscore": "=1.8.3"
7576
},
7677
"devDependencies": {
@@ -83,10 +84,8 @@
8384
"babel-preset-stage-0": "=6.5.0",
8485
"chai": "=3.5.0",
8586
"css-loader": "=0.23.1",
86-
"electron-gh-releases": "=2.0.2",
8787
"electron-packager": "=7.0.1",
8888
"electron-prebuilt": "=1.0.2",
89-
"electron-positioner": "=3.0.0",
9089
"enzyme": "=2.3.0",
9190
"eslint": "=2.9.0",
9291
"eslint-plugin-react": "=5.1.1",

src/js/__tests__/components/login.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('components/login.js', function () {
4848
const { wrapper } = setup(props);
4949

5050
expect(wrapper).to.exist;
51-
expect(wrapper.find('.desc').text()).to.equal('GitHub notifications in your menu bar.');
51+
expect(wrapper.find('.desc').text()).to.contain('in your menu bar.');
5252

5353
});
5454

@@ -206,7 +206,6 @@ describe('components/login.js', function () {
206206
const { wrapper, context } = setup(props);
207207

208208
expect(wrapper).to.exist;
209-
expect(wrapper.find('.desc').text()).to.equal('GitHub notifications in your menu bar.');
210209

211210
wrapper.setProps({
212211
token: 'HELLO'

src/js/__tests__/components/navigation.js

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ describe('components/navigation.js', function () {
6161
expect(Navigation.prototype.componentDidMount).to.have.been.calledOnce;
6262
expect(wrapper.find('.fa-refresh').length).to.equal(1);
6363
expect(wrapper.find('.fa-refresh').first().hasClass('fa-spin')).to.be.false;
64-
expect(wrapper.find('.fa-sign-out').length).to.equal(1);
6564
expect(wrapper.find('.fa-cog').length).to.equal(1);
6665
expect(wrapper.find('.fa-search').length).to.equal(1);
6766
expect(wrapper.find('.fa-power-off').length).to.equal(0);
@@ -111,7 +110,6 @@ describe('components/navigation.js', function () {
111110
expect(wrapper).to.exist;
112111
expect(Navigation.prototype.componentDidMount).to.have.been.calledOnce;
113112
expect(wrapper.find('.fa-refresh').length).to.equal(0);
114-
expect(wrapper.find('.fa-sign-out').length).to.equal(0);
115113
expect(wrapper.find('.fa-cog').length).to.equal(0);
116114
expect(wrapper.find('.fa-search').length).to.equal(0);
117115
expect(wrapper.find('.fa-power-off').length).to.equal(1);
@@ -141,7 +139,6 @@ describe('components/navigation.js', function () {
141139
expect(Navigation.prototype.componentDidMount).to.have.been.calledOnce;
142140
expect(wrapper.find('.fa-refresh').length).to.equal(1);
143141
expect(wrapper.find('.fa-refresh').first().hasClass('fa-spin')).to.be.false;
144-
expect(wrapper.find('.fa-sign-out').length).to.equal(1);
145142
expect(wrapper.find('.fa-cog').length).to.equal(1);
146143
expect(wrapper.find('.fa-search').length).to.equal(1);
147144
expect(wrapper.find('.fa-power-off').length).to.equal(0);
@@ -168,7 +165,6 @@ describe('components/navigation.js', function () {
168165

169166
expect(wrapper).to.exist;
170167
expect(wrapper.find('.fa-refresh').length).to.equal(0);
171-
expect(wrapper.find('.fa-sign-out').length).to.equal(0);
172168
expect(wrapper.find('.fa-power-off').length).to.equal(1);
173169

174170
wrapper.find('.fa-power-off').simulate('click');
@@ -193,7 +189,7 @@ describe('components/navigation.js', function () {
193189
expect(wrapper).to.exist;
194190
expect(wrapper.find('.fa-power-off').length).to.equal(1);
195191

196-
wrapper.find('.logo').simulate('click');
192+
wrapper.find('.navbar-brand').simulate('click');
197193

198194
expect(shell.openExternal).to.have.been.calledOnce;
199195
expect(shell.openExternal).to.have.been.calledWith('http://www.github.com/ekonstantinidis/gitify');
@@ -224,42 +220,6 @@ describe('components/navigation.js', function () {
224220

225221
});
226222

227-
it('should press the logout', function () {
228-
229-
const props = {
230-
logout: sinon.spy(),
231-
toggleSearch: sinon.spy(),
232-
isFetching: false,
233-
notifications: notifications.length,
234-
showSearch: true,
235-
token: 'IMLOGGEDIN',
236-
location: {
237-
pathname: '/settings'
238-
}
239-
};
240-
241-
const { wrapper, context } = setup(props);
242-
243-
expect(wrapper).to.exist;
244-
expect(wrapper.find('.fa-cog').length).to.equal(1);
245-
246-
wrapper.find('.fa-sign-out').simulate('click');
247-
248-
expect(props.logout).to.have.been.calledOnce;
249-
expect(props.toggleSearch).to.have.been.calledOnce;
250-
251-
expect(ipcRenderer.send).to.have.been.calledOnce;
252-
expect(ipcRenderer.send).to.have.been.calledWith('update-icon', 'IconPlain');
253-
254-
expect(context.router.replace).to.have.been.calledOnce;
255-
expect(context.router.replace).to.have.been.calledWith('/login');
256-
257-
context.router.replace.reset();
258-
props.logout.reset();
259-
props.toggleSearch.reset();
260-
261-
});
262-
263223
it('should go to settings from home', function () {
264224

265225
const props = {

src/js/__tests__/components/oops.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('components/oops.js', function () {
2020
const { wrapper } = setup();
2121

2222
expect(wrapper).to.exist;
23-
expect(wrapper.find('h3').text()).to.equal('Oops something went wrong.');
23+
expect(wrapper.find('h2').text()).to.equal('Oops something went wrong.');
2424

2525
});
2626

src/js/__tests__/components/settings.js

Lines changed: 124 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,76 @@ import { shallow } from 'enzyme';
44
import sinon from 'sinon';
55
import Toggle from 'react-toggle';
66
import { SettingsPage } from '../../components/settings';
7-
8-
function setup() {
9-
const props = {
10-
updateSetting: sinon.spy(),
11-
fetchNotifications: sinon.spy(),
12-
settings: {
13-
participating: false,
14-
playSound: true,
15-
showNotifications: true,
16-
markOnClick: false,
17-
openAtStartup: false
7+
const ipcRenderer = window.require('electron').ipcRenderer;
8+
9+
const options = {
10+
context: {
11+
location: {
12+
pathname: ''
13+
},
14+
router: {
15+
push: sinon.spy(),
16+
replace: sinon.spy()
1817
}
19-
};
18+
}
19+
};
2020

21-
const wrapper = shallow(<SettingsPage {...props} />);
21+
function setup(props) {
22+
const wrapper = shallow(<SettingsPage {...props} />, options);
2223

2324
return {
25+
context: options.context,
2426
props: props,
2527
wrapper: wrapper,
2628
};
2729
};
2830

2931
describe('components/settings.js', function () {
3032

33+
beforeEach(function() {
34+
ipcRenderer.send.reset();
35+
});
36+
3137
it('should render itself & its children', function () {
3238

33-
const { wrapper } = setup();
39+
const props = {
40+
updateSetting: sinon.spy(),
41+
fetchNotifications: sinon.spy(),
42+
logout: sinon.spy(),
43+
settings: {
44+
participating: false,
45+
playSound: true,
46+
showNotifications: true,
47+
markOnClick: false,
48+
openAtStartup: false
49+
}
50+
};
51+
52+
const { wrapper } = setup(props);
3453

3554
expect(wrapper).to.exist;
3655
expect(wrapper.find(Toggle).length).to.equal(5);
56+
expect(wrapper.find('.fa-sign-out').length).to.equal(1);
3757
expect(wrapper.find('.footer').find('.text-right').text()).to.contain('Gitify - Version');
3858

3959
});
4060

4161
it('should update a setting', function () {
4262

43-
const { wrapper, props } = setup();
63+
const props = {
64+
updateSetting: sinon.spy(),
65+
fetchNotifications: sinon.spy(),
66+
logout: sinon.spy(),
67+
settings: {
68+
participating: false,
69+
playSound: true,
70+
showNotifications: true,
71+
markOnClick: false,
72+
openAtStartup: false
73+
}
74+
};
75+
76+
const { wrapper } = setup(props);
4477
expect(wrapper).to.exist;
4578

4679
// Note: First Toggle is "participating"
@@ -58,14 +91,86 @@ describe('components/settings.js', function () {
5891

5992
});
6093

61-
it('should check for updates and quit the app', function () {
94+
it('should check for updates ', function () {
95+
96+
const props = {
97+
updateSetting: sinon.spy(),
98+
fetchNotifications: sinon.spy(),
99+
logout: sinon.spy(),
100+
settings: {
101+
participating: false,
102+
playSound: true,
103+
showNotifications: true,
104+
markOnClick: false,
105+
openAtStartup: false
106+
}
107+
};
108+
109+
const { wrapper } = setup(props);
110+
111+
expect(wrapper).to.exist;
112+
113+
wrapper.find('.fa-cloud-download').parent().simulate('click');
114+
expect(ipcRenderer.send).to.have.been.calledOnce;
115+
expect(ipcRenderer.send).to.have.been.calledWith('check-update');
116+
117+
});
118+
119+
it('should quit the app', function () {
120+
121+
const props = {
122+
updateSetting: sinon.spy(),
123+
fetchNotifications: sinon.spy(),
124+
logout: sinon.spy(),
125+
settings: {
126+
participating: false,
127+
playSound: true,
128+
showNotifications: true,
129+
markOnClick: false,
130+
openAtStartup: false
131+
}
132+
};
62133

63-
const { wrapper } = setup();
134+
const { wrapper } = setup(props);
64135

65136
expect(wrapper).to.exist;
66137

67-
wrapper.find('.btn-primary').simulate('click');
68-
wrapper.find('.btn-danger').simulate('click');
138+
wrapper.find('.fa-power-off').parent().simulate('click');
139+
expect(ipcRenderer.send).to.have.been.calledOnce;
140+
expect(ipcRenderer.send).to.have.been.calledWith('app-quit');
141+
142+
});
143+
144+
it('should press the logout', function () {
145+
146+
const props = {
147+
updateSetting: sinon.spy(),
148+
fetchNotifications: sinon.spy(),
149+
logout: sinon.spy(),
150+
settings: {
151+
participating: false,
152+
playSound: true,
153+
showNotifications: true,
154+
markOnClick: false,
155+
openAtStartup: false
156+
}
157+
};
158+
159+
const { wrapper, context } = setup(props);
160+
161+
expect(wrapper).to.exist;
162+
163+
wrapper.find('.fa-sign-out').parent().simulate('click');
164+
165+
expect(props.logout).to.have.been.calledOnce;
166+
167+
expect(ipcRenderer.send).to.have.been.calledOnce;
168+
expect(ipcRenderer.send).to.have.been.calledWith('update-icon', 'IconPlain');
169+
170+
expect(context.router.replace).to.have.been.calledOnce;
171+
expect(context.router.replace).to.have.been.calledWith('/login');
172+
173+
context.router.replace.reset();
69174

70175
});
71176

src/js/components/login.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export class LoginPage extends React.Component {
7676
<div className="container-fluid main-container login">
7777
<div className="row">
7878
<div className="col-xs-offset-2 col-xs-8">
79-
<img className="img-responsive logo" src="images/gitify-logo-outline-light.png" />
80-
<div className="desc">GitHub notifications in your menu bar.</div>
81-
<button className="btn btn-secondary btn-lg btn-block" onClick={this.authGithub.bind(this)}>
79+
<img className="img-responsive logo" src="images/gitify-logo-outline-dark.png" />
80+
<div className="desc">GitHub Notifications<br />in your menu bar.</div>
81+
<button className="btn btn-lg btn-block" onClick={this.authGithub.bind(this)}>
8282
<i className="fa fa-github" />Log in to GitHub
8383
</button>
8484
</div>

0 commit comments

Comments
 (0)