PropTypes and refactoring

This commit is contained in:
2021-05-04 19:22:45 -05:00
parent 811f022229
commit ace51f61d1
30 changed files with 491 additions and 279 deletions

View File

@@ -1,18 +1,10 @@
import React from 'react';
import './Dependency.css';
import { connect } from 'react-redux';
import * as Constants from '../../../constants';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
const mapStateToProps = (state) => {
return {
AllowDownload:
state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency &&
!state.download.DownloadActive &&
!state.install.InstallActive,
};
};
export default connect(mapStateToProps)((props) => {
const Dependency = (props) => {
return (
<div className={'Dependency'}>
<table width="100%">
@@ -41,4 +33,21 @@ export default connect(mapStateToProps)((props) => {
</table>
</div>
);
});
};
const mapStateToProps = (state) => {
return {
AllowDownload:
state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency &&
!state.download.DownloadActive &&
!state.install.InstallActive,
};
};
Dependency.propTypes = {
AllowDownload: PropTypes.bool,
name: PropTypes.string.isRequired,
onDownload: PropTypes.func.isRequired,
};
export default connect(mapStateToProps)(Dependency);