Redux changes and refactoring
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
import React from 'react';
|
||||
import './Dependency.css';
|
||||
import {connect} from 'react-redux';
|
||||
import * as Constants from '../../../constants';
|
||||
|
||||
export default props => {
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
AllowDownload: (state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(props => {
|
||||
return (
|
||||
<div className={'Dependency'}>
|
||||
<table width="100%">
|
||||
@@ -11,7 +19,7 @@ export default props => {
|
||||
<h3>{props.name}</h3>
|
||||
</td>
|
||||
<td>
|
||||
{props.allowDownload ?
|
||||
{props.AllowDownload ?
|
||||
<a href={void(0)} className={'DependencyLink'} onClick={()=>{props.onDownload(props.download); return false;}}><u>Install</u></a> :
|
||||
'Installing...'}
|
||||
</td>
|
||||
@@ -20,4 +28,4 @@ export default props => {
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user