mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Add UI toggle to optionally reset the settings
This commit is contained in:
parent
4399293a02
commit
0a98fcb8cc
1 changed files with 25 additions and 2 deletions
|
@ -1,12 +1,14 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { Button, Modal } from '@wordpress/components';
|
||||
import { Button, Modal, ToggleControl } from '@wordpress/components';
|
||||
import { useCallback, useState } from '@wordpress/element';
|
||||
|
||||
import { CommonHooks } from '../../../../../../data';
|
||||
import { HStack } from '../../../../../ReusableComponents/Stack';
|
||||
import { Separator } from '../../../../../ReusableComponents/Elements';
|
||||
|
||||
const DisconnectButton = () => {
|
||||
const [ isOpen, setIsOpen ] = useState( false );
|
||||
const [ resetFlag, setResetFlag ] = useState( false );
|
||||
const { disconnectMerchant } = CommonHooks.useDisconnectMerchant();
|
||||
|
||||
const handleOpen = useCallback( () => {
|
||||
|
@ -49,7 +51,28 @@ const DisconnectButton = () => {
|
|||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
</p>
|
||||
<HStack>
|
||||
<ToggleControl
|
||||
__nextHasNoMarginBottom
|
||||
checked={ resetFlag }
|
||||
onChange={ setResetFlag }
|
||||
label={ __(
|
||||
'Start over',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
help={
|
||||
resetFlag
|
||||
? __(
|
||||
'Attention: The plugin is reset to its initial state!',
|
||||
'woocommerce-paypal-payments'
|
||||
)
|
||||
: __(
|
||||
'Change Paypal accounts, preserving all settings',
|
||||
'woocommerce-paypal-payments'
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Separator />
|
||||
<HStack className="ppcp--action-buttons">
|
||||
<Button variant="tertiary" onClick={ handleCancel }>
|
||||
{ __( 'Cancel', 'woocommerce-paypal-payments' ) }
|
||||
</Button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue