Skip to content

Commit d9a6107

Browse files
committed
Move refresh button to the coinsPage
1 parent c838cfd commit d9a6107

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

app/components/Navbar.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
// @flow
22
import { ipcRenderer } from 'electron';
33
import React, { Component } from 'react';
4-
import { connect } from 'react-redux';
54
import { Link, NavLink } from 'react-router-dom';
6-
import { toggleForceRefresh } from '../modules/coins/actions';
75
import image from "../appIconLarge.png";
86

97
class Navbar extends Component {
10-
constructor(props) {
11-
super(props);
12-
13-
this.onClickForceRefresh = ::this.onClickForceRefresh;
14-
}
15-
168
onClickUpdateAvailable() {
179
ipcRenderer.send('check-update', true);
1810
}
1911

20-
onClickForceRefresh() {
21-
this.props.toggleForceRefresh();
22-
}
23-
2412
render() {
2513
return (
2614
<nav className="navbar navbar-default navbar-static-top">
@@ -31,7 +19,6 @@ class Navbar extends Component {
3119
<div className="content">
3220
</div>
3321
<div className="toolbar pull-right">
34-
<a onClick={this.onClickForceRefresh} className="link-force-refresh"><span className="glyphicon glyphicon-refresh" aria-hidden="true" /></a>
3522
<a onClick={this.onClickUpdateAvailable} className="link-update"><span className="glyphicon glyphicon-download-alt" aria-hidden="true" /></a>
3623
<Link to="/settings" className="link-settings"><span className="glyphicon glyphicon-cog" aria-hidden="true" /></Link>
3724
</div>
@@ -44,4 +31,4 @@ class Navbar extends Component {
4431
}
4532
}
4633

47-
export default connect(null, { toggleForceRefresh })(Navbar);
34+
export default Navbar;

app/modules/coins/containers/CoinsPage.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ import { map } from 'lodash';
44
import { connect } from 'react-redux';
55
import Coin from '../components/Coin';
66
import CoinSettings from './CoinsSettings';
7+
import { toggleForceRefresh } from '../actions';
78
import ModalButton from '../../modal/containers/ModalButton';
89
import Modal from '../../modal/containers/Modal';
9-
import shallowCompare from 'react-addons-shallow-compare'; // ES6
10+
import shallowCompare from 'react-addons-shallow-compare';
1011

1112
export class CoinsPage extends Component {
13+
constructor(props) {
14+
super(props);
15+
16+
this.onClickForceRefresh = ::this.onClickForceRefresh;
17+
}
18+
19+
onClickForceRefresh() {
20+
this.props.toggleForceRefresh();
21+
}
22+
1223
shouldComponentUpdate(nextProps, nextState) {
1324
return shallowCompare(this, nextProps, nextState);
1425
}
@@ -31,7 +42,10 @@ export class CoinsPage extends Component {
3142
<tr>
3243
<th>Coin</th>
3344
<th>Price</th>
34-
<th><ModalButton className="pull-right"><span className="glyphicon glyphicon-plus" /></ModalButton></th>
45+
<th className="toolbar">
46+
<ModalButton className="pull-right"><span className="glyphicon glyphicon-plus" /></ModalButton>
47+
<a onClick={this.onClickForceRefresh} className="link-force-refresh pull-right"><span className="glyphicon glyphicon-refresh" aria-hidden="true" /></a>
48+
</th>
3549
</tr>
3650
</thead>
3751
<tbody>
@@ -51,4 +65,4 @@ function mapStateToProps({ coins }) {
5165
};
5266
}
5367

54-
export default connect(mapStateToProps)(CoinsPage);
68+
export default connect(mapStateToProps, { toggleForceRefresh })(CoinsPage);

0 commit comments

Comments
 (0)