10 changed files with 67 additions and 64 deletions
@ -1,20 +1,55 @@ |
|||||
// @flow
|
// @flow
|
||||
import React from 'react' |
import React from 'react' |
||||
import { Provider } from 'react-redux' |
import { Provider, connect } from 'react-redux' |
||||
import { ConnectedRouter } from 'react-router-redux' |
import { ConnectedRouter } from 'react-router-redux' |
||||
|
import { fetchBlockHeight, lndSelectors } from 'reducers/lnd' |
||||
|
import LndSyncing from 'components/LndSyncing' |
||||
import Routes from '../routes' |
import Routes from '../routes' |
||||
|
|
||||
|
const mapDispatchToProps = { |
||||
|
fetchBlockHeight |
||||
|
} |
||||
|
|
||||
|
const mapStateToProps = state => ({ |
||||
|
lnd: state.lnd, |
||||
|
|
||||
|
syncPercentage: lndSelectors.syncPercentage(state) |
||||
|
}) |
||||
|
|
||||
type RootType = { |
type RootType = { |
||||
store: {}, |
store: {}, |
||||
history: {} |
history: {} |
||||
}; |
}; |
||||
|
|
||||
export default function Root({ store, history }: RootType) { |
class Root extends React.Component { |
||||
return ( |
render() { |
||||
<Provider store={store}> |
const { |
||||
<ConnectedRouter history={history}> |
store, |
||||
<Routes /> |
history, |
||||
</ConnectedRouter> |
lnd, |
||||
</Provider> |
fetchBlockHeight, |
||||
) |
syncPercentage |
||||
} |
} = this.props |
||||
|
|
||||
|
if (lnd.syncing) { |
||||
|
return ( |
||||
|
<LndSyncing |
||||
|
fetchBlockHeight={fetchBlockHeight} |
||||
|
fetchingBlockHeight={lnd.fetchingBlockHeight} |
||||
|
syncPercentage={syncPercentage} |
||||
|
/> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
return ( |
||||
|
<Provider store={store}> |
||||
|
<ConnectedRouter history={history}> |
||||
|
<Routes /> |
||||
|
</ConnectedRouter> |
||||
|
</Provider> |
||||
|
) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export default connect(mapStateToProps, mapDispatchToProps)(Root) |
Binary file not shown.
Loading…
Reference in new issue