Begin move to redux

This commit is contained in:
Scott E. Graves
2019-06-04 22:08:21 -05:00
parent a5e21c8dfc
commit fc48c9c0db
7 changed files with 64 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ import axios from 'axios';
import './App.css';
import Box from './components/UI/Box/Box';
import Configuration from './containers/Configuration/Configuration';
import {connect} from 'react-redux';
import DependencyList from './components/DependencyList/DependencyList';
import DownloadProgress from './components/DownloadProgress/DownloadProgress';
import ErrorDetails from './components/ErrorDetails/ErrorDetails';
@@ -63,7 +64,6 @@ class App extends IPCContainer {
ExtractActive: false,
LocationsLookup: {},
MissingDependencies: [],
MountsBusy: false,
Release: 2,
ReleaseTypes: [
'Release',
@@ -317,10 +317,6 @@ class App extends IPCContainer {
this.setState({AutoMountProcessed: true});
};
notifyMountsBusy = (busy) => {
this.setState({MountsBusy: busy})
};
onCheckInstalledReply = (event, arg) => {
const action = () => {
const installedVersion = arg.data.Success && arg.data.Exists ? arg.data.Version : 'none';
@@ -579,7 +575,7 @@ class App extends IPCContainer {
this.getSelectedVersion();
const downloadEnabled = this.state.AllowDownload &&
!this.state.MountsBusy &&
!this.props.MountsBusy &&
!this.state.DownloadActive &&
(selectedVersion !== 'unavailable') &&
(selectedVersion !== this.state.InstalledVersion);
@@ -671,7 +667,7 @@ class App extends IPCContainer {
mainContent.push((
<div key={'rvd_' + key++}
style={{height: '32%'}}>
<ReleaseVersionDisplay disabled={this.state.DownloadActive || this.state.ExtractActive || this.state.MountsBusy}
<ReleaseVersionDisplay disabled={this.state.DownloadActive || this.state.ExtractActive || this.props.MountsBusy}
downloadClicked={this.handleReleaseDownload}
downloadDisabled={!downloadEnabled}
installedVersion={this.state.InstalledVersion}
@@ -705,7 +701,6 @@ class App extends IPCContainer {
configClicked={this.handleConfigClicked}
directory={Constants.DATA_LOCATIONS[this.props.platform]}
errorHandler={this.setErrorState}
mountsBusy={this.notifyMountsBusy}
platform={this.props.platform}
processAutoMount={!this.state.AutoMountProcessed}
version={this.state.InstalledVersion}/>
@@ -755,4 +750,10 @@ class App extends IPCContainer {
}
}
export default App;
const mapStateToProps = state =>{
return {
MountsBusy: state.mounts.MountsBusy
};
};
export default connect(mapStateToProps)(App);