lbry-desktop/ui/component/syncToggle/index.js

23 lines
915 B
JavaScript
Raw Permalink Normal View History

import * as SETTINGS from 'constants/settings';
2019-10-15 23:23:51 +02:00
import { connect } from 'react-redux';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
2020-10-02 17:03:25 +02:00
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
import { doSetWalletSyncPreference } from 'redux/actions/settings';
import { doOpenModal } from 'redux/actions/app';
2019-10-15 23:23:51 +02:00
import SyncToggle from './view';
const select = (state) => ({
2019-10-15 23:23:51 +02:00
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
verifiedEmail: selectUserVerifiedEmail(state),
getSyncError: selectGetSyncErrorMessage(state),
language: selectLanguage(state),
2019-10-15 23:23:51 +02:00
});
const perform = (dispatch) => ({
setSyncEnabled: (value) => dispatch(doSetWalletSyncPreference(value)),
openModal: (id, props) => dispatch(doOpenModal(id, props)),
2019-10-15 23:23:51 +02:00
});
export default connect(select, perform)(SyncToggle);