2019-06-17 22:32:38 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2019-06-17 22:32:38 +02:00
|
|
|
import { selectBalance, SETTINGS as LBRY_REDUX_SETTINGS } from 'lbry-redux';
|
2018-11-21 22:20:55 +01:00
|
|
|
import { formatCredits } from 'util/format-credits';
|
2019-06-17 22:32:38 +02:00
|
|
|
import { doSetClientSetting } from 'redux/actions/settings';
|
2019-06-12 23:51:39 +02:00
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
2019-06-17 22:32:38 +02: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-04-17 07:14:14 +02:00
|
|
|
balance: selectBalance(state),
|
2019-06-17 22:32:38 +02:00
|
|
|
language: makeSelectClientSetting(LBRY_REDUX_SETTINGS.LANGUAGE)(state), // trigger redraw on language change
|
2018-04-17 07:14:14 +02:00
|
|
|
roundedBalance: formatCredits(selectBalance(state) || 0, 2),
|
2019-06-17 22:32:38 +02:00
|
|
|
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
|
|
|
automaticDarkModeEnabled: makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED)(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 => ({
|
2019-06-17 22:32:38 +02:00
|
|
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
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);
|