@@ -5,7 +5,7 @@ import { UserProfile } from '~/libs/core'
55import { IconOutline , LinkButton , LoadingCircles } from '~/libs/ui'
66
77import { Balance } from '../../../lib/models/WalletDetails'
8- import { InfoRow } from '../../../lib'
8+ import { InfoRow , PayoutGuard } from '../../../lib'
99import { BannerImage , BannerText } from '../../../lib/assets/home'
1010import { nullToZero } from '../../../lib/util'
1111import { useWalletDetails , WalletDetailsResponse } from '../../../lib/hooks/use-wallet-details'
@@ -17,7 +17,8 @@ interface HomeTabProps {
1717 profile : UserProfile
1818}
1919
20- const HomeTab : FC < HomeTabProps > = ( ) => {
20+ const HomeTab : FC < HomeTabProps > = props => {
21+
2122 const { data : walletDetails , isLoading, error } : WalletDetailsResponse = useWalletDetails ( )
2223 const [ balanceSum , setBalanceSum ] = useState ( 0 )
2324
@@ -57,63 +58,70 @@ const HomeTab: FC<HomeTabProps> = () => {
5758 }
5859 />
5960
60- { walletDetails . withdrawalMethod . isSetupComplete && walletDetails . taxForm . isSetupComplete && (
61- < InfoRow
62- title = 'Est. Payment Fees and Tax Withholding %'
63- // eslint-disable-next-line max-len
64- value = { `Fee: ${ nullToZero ( walletDetails . estimatedFees ) } USD / Tax Withholding: ${ nullToZero ( walletDetails . taxWithholdingPercentage ) } %` }
65- action = {
66- < LinkButton
67- label = 'ADJUST YOUR PAYOUT SETTINGS'
68- iconToRight
69- icon = { IconOutline . ArrowRightIcon }
70- size = 'md'
71- link
72- to = '#payout'
73- />
74- }
75- />
76- ) }
61+ < PayoutGuard profile = { props . profile } >
62+ { walletDetails . withdrawalMethod . isSetupComplete
63+ && walletDetails . taxForm . isSetupComplete && (
64+ < InfoRow
65+ title = 'Est. Payment Fees and Tax Withholding %'
66+ // eslint-disable-next-line max-len
67+ value = { `Fee: ${ nullToZero ( walletDetails . estimatedFees ) } USD / Tax Withholding: ${ nullToZero ( walletDetails . taxWithholdingPercentage ) } %` }
68+ action = {
69+ < LinkButton
70+ label = 'ADJUST YOUR PAYOUT SETTINGS'
71+ iconToRight
72+ icon = { IconOutline . ArrowRightIcon }
73+ size = 'md'
74+ link
75+ to = '#payout'
76+ />
77+ }
78+ />
79+ ) }
7780
78- { ! walletDetails ?. withdrawalMethod . isSetupComplete && (
79- < InfoRow
80- title = 'Withdrawal Method'
81- value = {
82- walletDetails ?. withdrawalMethod . isSetupComplete ? (
83- 'Your preferred method'
84- ) : (
85- < Chip text = 'Setup Required' />
86- )
87- }
88- action = {
89- < LinkButton
90- label = 'SETUP WITHDRAWAL METHOD'
91- iconToRight
92- icon = { IconOutline . ArrowRightIcon }
93- size = 'md'
94- link
95- to = '#payout'
96- />
97- }
98- />
99- ) }
81+ { ! walletDetails ?. withdrawalMethod . isSetupComplete && (
82+ < InfoRow
83+ title = 'Withdrawal Method'
84+ value = {
85+ walletDetails ?. withdrawalMethod . isSetupComplete ? (
86+ 'Your preferred method'
87+ ) : (
88+ < Chip text = 'Setup Required' />
89+ )
90+ }
91+ action = {
92+ < LinkButton
93+ label = 'SETUP WITHDRAWAL METHOD'
94+ iconToRight
95+ icon = { IconOutline . ArrowRightIcon }
96+ size = 'md'
97+ link
98+ to = '#payout'
99+ />
100+ }
101+ />
102+ ) }
100103
101- { ! walletDetails ?. taxForm . isSetupComplete && (
102- < InfoRow
103- title = 'Tax Form'
104- value = { walletDetails ?. taxForm . isSetupComplete ? 'All set' : < Chip text = 'Setup Required' /> }
105- action = {
106- < LinkButton
107- label = 'COMPLETE TAX FORM'
108- iconToRight
109- icon = { IconOutline . ArrowRightIcon }
110- size = 'md'
111- link
112- to = '#payout'
113- />
114- }
115- />
116- ) }
104+ { ! walletDetails ?. taxForm . isSetupComplete && (
105+ < InfoRow
106+ title = 'Tax Form'
107+ value = {
108+ walletDetails ?. taxForm . isSetupComplete
109+ ? 'All set'
110+ : < Chip text = 'Setup Required' />
111+ }
112+ action = {
113+ < LinkButton
114+ label = 'COMPLETE TAX FORM'
115+ iconToRight
116+ icon = { IconOutline . ArrowRightIcon }
117+ size = 'md'
118+ link
119+ to = '#payout'
120+ />
121+ }
122+ />
123+ ) }
124+ </ PayoutGuard >
117125 </ div >
118126 ) }
119127 </ div >
0 commit comments