You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.3 KiB

// @flow
import React from 'react'
import { Provider, connect } from 'react-redux'
import { ConnectedRouter } from 'react-router-redux'
import { fetchBlockHeight, lndSelectors } from 'reducers/lnd'
import LoadingBolt from 'components/LoadingBolt'
import LndSyncing from 'components/LndSyncing'
import Routes from '../routes'
const mapDispatchToProps = {
fetchBlockHeight
}
const mapStateToProps = state => ({
lnd: state.lnd,
syncPercentage: lndSelectors.syncPercentage(state)
})
type RootType = {
store: {},
history: {}
};
class Root extends React.Component {
render() {
const {
store,
history,
lnd,
fetchBlockHeight,
syncPercentage
} = this.props
console.log('lnd: ', lnd)
console.log('lnd: ', lnd)
if (lnd.syncing) {
return (
<LndSyncing
fetchBlockHeight={fetchBlockHeight}
fetchingBlockHeight={lnd.fetchingBlockHeight}
syncPercentage={syncPercentage}
/>
)
}
if (!lnd.grpcStarted) { return <LoadingBolt /> }
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<Routes />
</ConnectedRouter>
</Provider>
)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Root)