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