@@ -4,11 +4,22 @@ import { map } from 'lodash';
44import { connect } from 'react-redux' ;
55import Coin from '../components/Coin' ;
66import CoinSettings from './CoinsSettings' ;
7+ import { toggleForceRefresh } from '../actions' ;
78import ModalButton from '../../modal/containers/ModalButton' ;
89import Modal from '../../modal/containers/Modal' ;
9- import shallowCompare from 'react-addons-shallow-compare' ; // ES6
10+ import shallowCompare from 'react-addons-shallow-compare' ;
1011
1112export 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