2019-10-15 23:23:51 +02:00
|
|
|
// @flow
|
2020-09-11 20:35:50 +02:00
|
|
|
import * as MODALS from 'constants/modal_types';
|
2019-10-15 23:23:51 +02:00
|
|
|
import React from 'react';
|
2021-08-23 08:50:25 +02:00
|
|
|
import SettingsRow from 'component/settingsRow';
|
2019-10-16 07:01:18 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2020-09-11 20:35:50 +02:00
|
|
|
import { FormField } from 'component/common/form';
|
2019-10-15 23:23:51 +02:00
|
|
|
|
|
|
|
type Props = {
|
2021-08-05 09:00:21 +02:00
|
|
|
setSyncEnabled: (boolean) => void,
|
2019-10-15 23:23:51 +02:00
|
|
|
syncEnabled: boolean,
|
2021-08-05 09:00:21 +02:00
|
|
|
history: { push: (string) => void },
|
2019-10-16 07:01:18 +02:00
|
|
|
location: UrlLocation,
|
|
|
|
getSyncError: ?string,
|
2019-10-17 21:15:32 +02:00
|
|
|
disabled: boolean,
|
2020-09-11 20:35:50 +02:00
|
|
|
openModal: (string, any) => void,
|
2019-10-15 23:23:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function SyncToggle(props: Props) {
|
2022-08-07 22:37:51 +02:00
|
|
|
// Redesign for new sync system
|
|
|
|
const { openModal, syncEnabled, disabled } = props;
|
2019-10-16 07:01:18 +02:00
|
|
|
|
2019-10-15 23:23:51 +02:00
|
|
|
return (
|
2022-08-07 22:37:51 +02:00
|
|
|
<SettingsRow title={__('Sync')} subtitle={disabled ? '' : __('Sync your balance and preferences across devices.')}>
|
2021-08-05 09:00:21 +02:00
|
|
|
<FormField
|
|
|
|
type="checkbox"
|
|
|
|
name="sync_toggle"
|
2022-08-07 22:37:51 +02:00
|
|
|
label={disabled ? __('Sync your balance and preferences across devices.') : undefined}
|
|
|
|
checked={syncEnabled}
|
2021-08-05 09:00:21 +02:00
|
|
|
onChange={() => openModal(MODALS.SYNC_ENABLE, { mode: syncEnabled ? 'disable' : 'enable' })}
|
2022-08-07 22:37:51 +02:00
|
|
|
disabled={disabled}
|
2021-08-05 09:00:21 +02:00
|
|
|
helper={
|
|
|
|
disabled
|
|
|
|
? __("To enable Sync, close LBRY completely and check 'Remember Password' during wallet unlock.")
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
/>
|
2021-08-23 08:50:25 +02:00
|
|
|
</SettingsRow>
|
2019-10-15 23:23:51 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-10-16 07:01:18 +02:00
|
|
|
export default withRouter(SyncToggle);
|