Refactoring

This commit is contained in:
Scott E. Graves
2019-07-15 14:54:28 -05:00
parent d7759402f6
commit f006beb8d9
14 changed files with 261 additions and 355 deletions

View File

@@ -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>

View File

@@ -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)}/>
);
});