2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2018-06-25 08:07:45 +02:00
|
|
|
import { selectBalance, selectIsBackDisabled, selectIsForwardDisabled } from 'lbry-redux';
|
2018-04-18 06:03:01 +02:00
|
|
|
import { formatCredits } from 'util/formatCredits';
|
2018-06-25 08:07:45 +02:00
|
|
|
import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation';
|
2018-03-26 23:32:43 +02:00
|
|
|
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
2018-04-18 06:03:01 +02:00
|
|
|
import { doDownloadUpgradeRequested } from 'redux/actions/app';
|
2017-12-21 22:08:54 +01:00
|
|
|
import Header from './view';
|
2017-04-22 15:17:01 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const select = state => ({
|
2018-01-16 06:38:23 +01:00
|
|
|
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
2018-04-17 07:14:14 +02:00
|
|
|
balance: selectBalance(state),
|
|
|
|
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
|
|
|
roundedBalance: formatCredits(selectBalance(state) || 0, 2),
|
2018-06-25 08:07:45 +02:00
|
|
|
isBackDisabled: selectIsBackDisabled(state),
|
|
|
|
isForwardDisabled: selectIsForwardDisabled(state),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-22 15:17:01 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2018-01-16 06:38:23 +01:00
|
|
|
downloadUpgradeRequested: () => dispatch(doDownloadUpgradeRequested()),
|
2018-04-17 07:14:14 +02:00
|
|
|
navigate: path => dispatch(doNavigate(path)),
|
2018-06-25 08:07:45 +02:00
|
|
|
back: () => dispatch(doHistoryBack()),
|
|
|
|
forward: () => dispatch(doHistoryForward()),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-22 15:17:01 +02:00
|
|
|
|
2018-06-25 08:07:45 +02:00
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(Header);
|