2021-08-05 14:39:08 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-08 05:47:39 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2021-08-05 14:39:08 +02:00
|
|
|
import { doSetClientSetting, doSetDarkTime } from 'redux/actions/settings';
|
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
|
|
import ThemeSelector from './view';
|
|
|
|
|
|
|
|
const select = (state) => ({
|
|
|
|
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
|
|
|
themes: makeSelectClientSetting(SETTINGS.THEMES)(state),
|
|
|
|
automaticDarkModeEnabled: makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED)(state),
|
|
|
|
darkModeTimes: makeSelectClientSetting(SETTINGS.DARK_MODE_TIMES)(state),
|
|
|
|
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
|
|
|
});
|
|
|
|
|
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
|
|
|
setDarkTime: (time, options) => dispatch(doSetDarkTime(time, options)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(ThemeSelector);
|