Refactoring
This commit is contained in:
@@ -25,7 +25,7 @@ export default connect(mapStateToProps)(props => {
|
||||
<a
|
||||
href={void(0)}
|
||||
className={'DependencyLink'}
|
||||
onClick={()=>{props.onDownload(props.download); return false;}}><u>Install</u></a> :
|
||||
onClick={()=>{props.onDownload(); return false;}}><u>Install</u></a> :
|
||||
'Installing...'}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import React from 'react';
|
||||
import './DependencyList.css';
|
||||
import {connect} from 'react-redux';
|
||||
import * as Constants from '../../constants';
|
||||
import Dependency from './Dependency/Dependency';
|
||||
import Box from '../UI/Box/Box';
|
||||
import {downloadItem} from '../../redux/actions/download_actions';
|
||||
import {extractFileNameFromURL} from '../../utils';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
@@ -10,13 +13,18 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(props => {
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
downloadItem: (name, type, url) => dispatch(downloadItem(name, type, url))
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
||||
const items = props.MissingDependencies.map((k, i)=> {
|
||||
return (
|
||||
<Dependency download={k.download}
|
||||
key={i}
|
||||
<Dependency key={i}
|
||||
name={k.display}
|
||||
onDownload={props.onDownload}/>
|
||||
onDownload={()=>props.downloadItem(extractFileNameFromURL(k.download), Constants.INSTALL_TYPES.Dependency, k.download)}/>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user