Redux changes and refactoring

This commit is contained in:
Scott E. Graves
2019-06-07 23:13:05 -05:00
parent 6499ff4f79
commit 4b93c298c2
9 changed files with 75 additions and 45 deletions

View File

@@ -11,6 +11,12 @@ import {setActiveRelease} from "../../redux/actions/release_version_actions";
const mapStateToProps = state => {
return {
AppPlatform: state.common.AppPlatform,
DownloadActive: state.download.DownloadActive,
InstallActive: state.install.InstallActive,
InstallType: state.install.InstallType,
InstalledVersion: state.relver.InstalledVersion,
MountsBusy: state.mounts.MountsBusy,
Release: state.relver.Release,
ReleaseUpgradeAvailable: state.relver.ReleaseUpgradeAvailable,
ReleaseVersion: state.relver.Version,
@@ -35,9 +41,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
props.setActiveRelease(props.Release, parseInt(e.target.value, 10));
};
const text = props.InstalledVersion + ' [' + props.AppPlatform + ']';
const disabled = props.DownloadActive || props.InstallActive || props.MountsBusy;
const releaseExtracting = (props.InstallType === Constants.INSTALL_TYPES.Release);
let optionsDisplay = [];
let key = 0;
if (props.releaseExtracting) {
if (releaseExtracting) {
optionsDisplay.push((
<Text col={dimensions => (dimensions.columns / 3) * 2}
colSpan={'remain'}
@@ -53,7 +63,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
key={key++}
row={5}
rowSpan={7}
text={props.text}
text={text}
textAlign={'left'}/>
));
} else if (props.downloadDisabled) {
@@ -73,7 +83,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
key={key++}
row={5}
rowSpan={7}
text={props.text}
text={text}
textAlign={'left'}/>
));
} else {
@@ -97,7 +107,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
type={'Heading2'}/>
<DropDown changed={handleReleaseChanged}
colSpan={remain=>remain / 3 - 1}
disabled={props.disabled}
disabled={disabled}
items={Constants.RELEASE_TYPES}
row={5}
rowSpan={7}
@@ -116,7 +126,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
<DropDown changed={handleVersionChanged}
col={dimensions => dimensions.columns / 3}
colSpan={remain=>remain / 2 - 1}
disabled={props.disabled}
disabled={disabled}
items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]}
row={5}
rowSpan={7}