Redux changes and refactoring
This commit is contained in:
@@ -7,6 +7,7 @@ import Grid from '../UI/Grid/Grid';
|
||||
import Text from '../UI/Text/Text';
|
||||
import Button from '../UI/Button/Button';
|
||||
import UpgradeIcon from '../UpgradeIcon/UpgradeIcon';
|
||||
import {setActiveRelease} from "../../redux/actions/release_version_actions";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
@@ -17,7 +18,23 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(props => {
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
||||
const handleReleaseChanged = e => {
|
||||
const release = parseInt(e.target.value, 10);
|
||||
const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
props.setActiveRelease(release, releaseVersion);
|
||||
};
|
||||
|
||||
const handleVersionChanged = e => {
|
||||
props.setActiveRelease(props.Release, parseInt(e.target.value, 10));
|
||||
};
|
||||
|
||||
let optionsDisplay = [];
|
||||
let key = 0;
|
||||
if (props.releaseExtracting) {
|
||||
@@ -78,7 +95,7 @@ export default connect(mapStateToProps)(props => {
|
||||
text={'Release'}
|
||||
textAlign={'left'}
|
||||
type={'Heading2'}/>
|
||||
<DropDown changed={props.releaseChanged}
|
||||
<DropDown changed={handleReleaseChanged}
|
||||
colSpan={remain=>remain / 3 - 1}
|
||||
disabled={props.disabled}
|
||||
items={Constants.RELEASE_TYPES}
|
||||
@@ -96,7 +113,7 @@ export default connect(mapStateToProps)(props => {
|
||||
colSpan={4}
|
||||
release
|
||||
rowSpan={4}/>
|
||||
<DropDown changed={props.versionChanged}
|
||||
<DropDown changed={handleVersionChanged}
|
||||
col={dimensions => dimensions.columns / 3}
|
||||
colSpan={remain=>remain / 2 - 1}
|
||||
disabled={props.disabled}
|
||||
|
||||
Reference in New Issue
Block a user