2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2019-03-28 17:53:13 +01:00
|
|
|
import { selectBalance } from 'lbry-redux';
|
2018-11-21 22:20:55 +01:00
|
|
|
import { formatCredits } from 'util/format-credits';
|
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),
|
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()),
|
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);
|