|
@ -1,15 +1,46 @@ |
|
|
// @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 { |
|
|
|
|
|
render() { |
|
|
|
|
|
const { |
|
|
|
|
|
store, |
|
|
|
|
|
history, |
|
|
|
|
|
lnd, |
|
|
|
|
|
fetchBlockHeight, |
|
|
|
|
|
syncPercentage |
|
|
|
|
|
} = this.props |
|
|
|
|
|
|
|
|
|
|
|
if (lnd.syncing) { |
|
|
|
|
|
return ( |
|
|
|
|
|
<LndSyncing |
|
|
|
|
|
fetchBlockHeight={fetchBlockHeight} |
|
|
|
|
|
fetchingBlockHeight={lnd.fetchingBlockHeight} |
|
|
|
|
|
syncPercentage={syncPercentage} |
|
|
|
|
|
/> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<Provider store={store}> |
|
|
<Provider store={store}> |
|
|
<ConnectedRouter history={history}> |
|
|
<ConnectedRouter history={history}> |
|
@ -17,4 +48,8 @@ export default function Root({ store, history }: RootType) { |
|
|
</ConnectedRouter> |
|
|
</ConnectedRouter> |
|
|
</Provider> |
|
|
</Provider> |
|
|
) |
|
|
) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Root) |