-
Notifications
You must be signed in to change notification settings - Fork 14
Pm 959 tc finance integration #1098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,12 +59,26 @@ const HomeTab: FC<HomeTabProps> = props => { | |
/> | ||
|
||
<PayoutGuard profile={props.profile}> | ||
{walletDetails.withdrawalMethod.isSetupComplete | ||
&& walletDetails.taxForm.isSetupComplete && ( | ||
{walletDetails.withdrawalMethod.isSetupComplete && ( | ||
<InfoRow | ||
title='Est. Payment Fees and Tax Withholding %' | ||
// eslint-disable-next-line max-len | ||
value={`Fee: ${nullToZero(walletDetails.estimatedFees)} USD / Tax Withholding: ${nullToZero(walletDetails.taxWithholdingPercentage)}%`} | ||
title='Est. Payment Fees' | ||
value={`$${nullToZero(walletDetails.estimatedFees)} USD`} | ||
action={ | ||
<LinkButton | ||
label='ADJUST YOUR PAYOUT SETTINGS' | ||
iconToRight | ||
icon={IconOutline.ArrowRightIcon} | ||
size='md' | ||
link | ||
to='#payout' | ||
/> | ||
} | ||
/> | ||
)} | ||
{walletDetails.taxForm.isSetupComplete && ( | ||
<InfoRow | ||
title='Est. Tax Withholding %' | ||
value={`${nullToZero(walletDetails.taxWithholdingPercentage)}%`} | ||
action={ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the percentage sign '%' is correctly formatted and displayed in all locales. Consider using a localization library if necessary. |
||
<LinkButton | ||
label='ADJUST YOUR PAYOUT SETTINGS' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,59 @@ | |
margin-top: 20px; | ||
} | ||
} | ||
|
||
.processing { | ||
border-radius: $sp-2; | ||
background: $black-5; | ||
border-left: 4px solid $purple-100; | ||
padding: $sp-4; | ||
} | ||
|
||
.breakdown { | ||
margin-top: $sp-8; | ||
} | ||
|
||
.breakdownList { | ||
margin-top: $sp-4; | ||
display: flex; | ||
flex-direction: column; | ||
gap: $sp-2; | ||
|
||
li { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
color: $black-100; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the extra blank line for consistency with the rest of the code. |
||
@include ltelg { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} | ||
} | ||
} | ||
|
||
.summary { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin-top: $sp-4; | ||
|
||
@include ltelg { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} | ||
} | ||
|
||
.alert { | ||
margin-top: $sp-6; | ||
background: $orange-25; | ||
border-radius: $sp-2; | ||
padding: $sp-3; | ||
color: $gold-3; | ||
} | ||
|
||
.taxesFooterRow { | ||
margin-top: $sp-6; | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding some styling properties to |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,53 +193,83 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => { | |
|
||
function handlePayMeClick( | ||
paymentIds: { [paymentId: string]: Winning }, | ||
totalAmount: string, | ||
totalAmountStr: string, | ||
): void { | ||
const totalAmount = parseFloat(totalAmountStr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for |
||
const taxWithholdAmount = (parseFloat(nullToZero(walletDetails?.taxWithholdingPercentage ?? '0')) * totalAmount) / 100 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The calculation for |
||
const feesAmount = parseFloat(nullToZero(walletDetails?.estimatedFees ?? '0')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
const netAmount = totalAmount - taxWithholdAmount - feesAmount | ||
|
||
setConfirmFlow({ | ||
action: 'Yes', | ||
action: 'Confirm Payment', | ||
callback: () => processPayouts(Object.keys(paymentIds)), | ||
content: ( | ||
<> | ||
You are about to process payments for a total of USD | ||
{' '} | ||
{totalAmount} | ||
. | ||
<br /> | ||
<br /> | ||
<div className={`${styles.processing} body-medium-normal`}> | ||
Processing Payment: $ | ||
{totalAmountStr} | ||
{' '} | ||
USD | ||
</div> | ||
{walletDetails && ( | ||
<> | ||
<div className={styles.taxes}> | ||
Est. Payment Fees: | ||
{' '} | ||
{nullToZero(walletDetails.estimatedFees)} | ||
{' '} | ||
USD and Tax Withholding: | ||
{' '} | ||
{`${nullToZero(walletDetails.taxWithholdingPercentage)}%`} | ||
{' '} | ||
will be applied on the payment. | ||
</div> | ||
<div className={styles.taxes}> | ||
{walletDetails.primaryCurrency && ( | ||
<> | ||
You will receive the payment in | ||
<div className={styles.breakdown}> | ||
<h4>Payment Breakdown:</h4> | ||
<ul className={`${styles.breakdownList} body-main`}> | ||
<li> | ||
<span>Base amount:</span> | ||
<span> | ||
$ | ||
{totalAmountStr} | ||
</span> | ||
</li> | ||
<li> | ||
<span> | ||
Tax Witholding ( | ||
{nullToZero(walletDetails.taxWithholdingPercentage)} | ||
%): | ||
</span> | ||
<span> | ||
$ | ||
{taxWithholdAmount.toFixed(2)} | ||
</span> | ||
</li> | ||
<li> | ||
<span>Processing fee:</span> | ||
<span> | ||
$ | ||
{feesAmount.toFixed(2)} | ||
</span> | ||
</li> | ||
</ul> | ||
<hr /> | ||
<div className={`${styles.summary} body-main-bold`}> | ||
<span>Net amount after fees:</span> | ||
<span>{netAmount.toFixed(2)}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider formatting the |
||
</div> | ||
{walletDetails?.primaryCurrency && walletDetails.primaryCurrency !== 'USD' && ( | ||
<div className={`${styles.alert} body-main-medium`}> | ||
Net amount will be converted to | ||
{' '} | ||
{walletDetails.primaryCurrency} | ||
{' '} | ||
currency after 2% conversion fees applied. | ||
</> | ||
with 2% conversion fee applied. | ||
</div> | ||
)} | ||
</div> | ||
<div className={`${styles.taxes} ${styles.mt}`}> | ||
You can adjust your payout settings to customize your estimated payment fee and tax withholding percentage in | ||
<div className={`${styles.taxesFooterRow} body-main`}> | ||
You can adjust your payout settings to customize your estimated payment fee | ||
and tax withholding percentage in the | ||
{' '} | ||
<Link to='#payout'>Payout</Link> | ||
{' '} | ||
section. | ||
</div> | ||
</> | ||
)} | ||
</> | ||
), | ||
title: 'Are you sure?', | ||
title: 'Payment Confirmation', | ||
}) | ||
} | ||
|
||
|
@@ -430,6 +460,8 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => { | |
</div> | ||
{confirmFlow && ( | ||
<ConfirmModal | ||
size='lg' | ||
maxWidth='610px' | ||
title={confirmFlow.title} | ||
action={confirmFlow.action} | ||
onClose={function onClose() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the redundant 'USD' from the value string since the dollar sign '$' already indicates the currency.