-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, sets up logic to show account tools and working on mo…
…dal.
- Loading branch information
1 parent
2591624
commit d117524
Showing
12 changed files
with
240 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.account-fees { | ||
padding-top: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React, { useState } from 'react'; | ||
import { render } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import strings from './strings'; | ||
import { isInTestOrDevMode } from 'utils'; | ||
import { Button, CardDivider } from '@wordpress/components'; | ||
import './styles.scss'; | ||
import ResetAccountModal from 'wcpay/overview/modal/reset-account'; | ||
|
||
interface Props { | ||
accountLink: string; | ||
openModal: () => void; | ||
} | ||
|
||
const renderModal = () => { | ||
let container = document.querySelector( '#wcpay-reset-account-container' ); | ||
|
||
if ( ! container ) { | ||
container = document.createElement( 'div' ); | ||
container.id = 'wcpay-reset-account-container'; | ||
document.body.appendChild( container ); | ||
} | ||
|
||
render( <ResetAccountModal />, container ); | ||
}; | ||
|
||
const resetAccount = () => { | ||
// TODO: Should we have a generic function for rendering a modal in utils? | ||
renderModal(); | ||
}; | ||
|
||
export const AccountTools: React.FC< Props > = ( props: Props ) => { | ||
const accountLink = props.accountLink; | ||
const [ modalVisible, setModalVisible ] = useState( true ); | ||
Check warning on line 40 in client/components/account-status/account-tools/index.tsx GitHub Actions / JS linting
|
||
|
||
// if ( isInTestOrDevMode() ) return null; | ||
|
||
return ( | ||
<div className="account-tools"> | ||
<CardDivider /> | ||
<h4>{ strings.title }</h4> | ||
<p>{ strings.description }</p> | ||
{ /* Use wrapping div to keep buttons grouped together. */ } | ||
<div className="account-tools__actions"> | ||
<Button | ||
variant={ 'secondary' } | ||
href={ accountLink } | ||
target={ '_blank' } | ||
> | ||
{ strings.finish } | ||
</Button> | ||
<Button variant={ 'link' } onClick={ resetAccount }> | ||
{ strings.reset } | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
15 changes: 15 additions & 0 deletions
15
client/components/account-status/account-tools/strings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable max-len */ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export default { | ||
title: __( 'Account Tools', 'woocommerce-payments' ), | ||
description: __( | ||
'Payments and deposits are disabled until account setup is completed. If you are experiencing problems completing account setup, or need to change the email/country associated with your account, you can reset your account and start from the beginning.', | ||
'woocommerce-payments' | ||
), | ||
finish: __( 'Finish setup', 'woocommerce-payments' ), | ||
reset: __( 'Reset account', 'woocommerce-payments' ), | ||
}; |
11 changes: 11 additions & 0 deletions
11
client/components/account-status/account-tools/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.account-tools { | ||
padding-top: 16px; | ||
|
||
&__actions { | ||
display: grid; | ||
grid-auto-flow: column; | ||
grid-auto-columns: max-content; | ||
column-gap: $gap-small; | ||
margin-top: $gap-small; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React, { useState } from 'react'; | ||
import { Button, Modal } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { trackAccountReset } from 'onboarding/tracking'; | ||
import './style.scss'; | ||
import strings from './strings'; | ||
|
||
const ResetAccountModal: React.FC = () => { | ||
const [ modalVisible, setModalVisible ] = useState( true ); | ||
|
||
const handleReset = () => { | ||
trackAccountReset(); | ||
|
||
// // Note: we don't need to update the option here because it will be handled upon redirect to the connect URL. | ||
// window.location.href = addQueryArgs( wcpaySettings.connectUrl, { | ||
// collect_payout_requirements: true, | ||
// } ); | ||
}; | ||
|
||
if ( ! modalVisible ) return null; | ||
|
||
return ( | ||
<Modal | ||
title={ 'Reset account' } | ||
className="wcpay-reset-account-modal" | ||
onRequestClose={ () => setModalVisible( false ) } | ||
> | ||
<div className="wcpay-reset-account-modal__content"> | ||
<p>{ strings.description }</p> | ||
<p> | ||
<b>{ strings.beforeContinue }</b> | ||
</p> | ||
<ol> | ||
<li>{ strings.step1 }</li> | ||
<li>{ strings.step2 }</li> | ||
<li>{ strings.step3 }</li> | ||
</ol> | ||
<p>{ strings.confirmation }</p> | ||
</div> | ||
<div className="wcpay-reset-account-modal__footer"> | ||
<Button | ||
variant={ 'secondary' } | ||
onClick={ () => setModalVisible( false ) } | ||
> | ||
{ strings.cancel } | ||
</Button> | ||
<Button | ||
variant={ 'primary' } | ||
isDestructive={ true } | ||
onClick={ handleReset } | ||
> | ||
{ strings.reset } | ||
</Button> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ResetAccountModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable max-len */ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
|
||
export default { | ||
title: __( 'Reset account', 'woocommerce-payments' ), | ||
description: __( | ||
'If you are experiencing problems completing account setup, or need to change the email/country associated with your account, you can reset your account and start from the beginning.', | ||
'woocommerce-payments' | ||
), | ||
beforeContinue: __( 'Before you continue', 'woocommerce-payments' ), | ||
step1: sprintf( | ||
/* translators: %s: WooPayments. */ | ||
__( | ||
'Your %s account will be reset, and all data will be lost.', | ||
'woocommerce-payments' | ||
), | ||
'WooPayments' | ||
), | ||
step2: __( | ||
'You will have to re-confirm your business and banking details.', | ||
'woocommerce-payments' | ||
), | ||
step3: __( 'This action cannnot be undone.', 'woocommerce-payments' ), | ||
confirmation: __( | ||
'Are you sure you want to continue?', | ||
'woocommerce-payments' | ||
), | ||
cancel: __( 'Cancel', 'woocommerce-payments' ), | ||
reset: __( 'Yes, reset account', 'woocommerce-payments' ), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.wcpay-reset-account-modal { | ||
// fix for the modal being too short on smaller screens | ||
@media ( max-height: 880px ) { | ||
max-height: 100% !important; | ||
} | ||
|
||
.components-modal__content { | ||
box-sizing: border-box; | ||
max-width: 700px; | ||
margin: 0 auto; | ||
padding: $gap-larger; | ||
} | ||
|
||
// &__heading { | ||
// @include wp-title-large; | ||
// text-align: left; | ||
// margin-bottom: 0; | ||
// } | ||
|
||
&__footer { | ||
text-align: right; | ||
margin-top: $gap-large; | ||
|
||
& :first-child { | ||
margin-right: $gap-smaller; | ||
} | ||
|
||
button { | ||
margin-top: $gap; | ||
padding: $gap-smaller $gap; | ||
} | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters