Skip to content

Commit 5904daf

Browse files
authored
feat: handle kyc declined status (#2801)
1 parent c89c808 commit 5904daf

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

packages/apps/human-app/frontend/.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = {
3434
// allow imports from material react table library
3535
camelcase: ['error', { allow: ['MRT_'] }],
3636
'react/jsx-pascal-case': ['error', { ignore: ['MRT_'] }],
37+
'react/jsx-no-leaked-render': 'off',
3738
'@typescript-eslint/restrict-template-expressions': [
3839
'error',
3940
{

packages/apps/human-app/frontend/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
"KYCInProgress": "KYC in progress",
197197
"confirmEmail": "Confirm email",
198198
"kycCompleted": "KYC Completed",
199+
"kycDeclined": "KYC Declined",
199200
"walletAddressMessage": "This address is the wallet address where you will receive payments for completing tasks.",
200201
"connectWallet": "Connect Wallet",
201202
"walletConnected": "Wallet Connected ",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Grid from '@mui/material/Grid';
2+
import Typography from '@mui/material/Typography';
3+
import CancelIcon from '@mui/icons-material/Cancel';
4+
5+
interface ErrorLabelProps {
6+
children: string | React.ReactElement;
7+
}
8+
9+
export function ErrorLabel({ children }: ErrorLabelProps) {
10+
if (typeof children === 'string') {
11+
return (
12+
<Grid alignItems="center" container gap="0.5rem" padding="0.5rem 0">
13+
<Typography variant="buttonLarge">{children}</Typography>
14+
<CancelIcon color="error" fontSize="small" />
15+
</Grid>
16+
);
17+
}
18+
19+
return children;
20+
}

packages/apps/human-app/frontend/src/pages/worker/profile/profile-actions.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { RegisterAddressBtn } from '@/pages/worker/profile/register-address-btn'
1212
import { DoneLabel } from '@/pages/worker/profile/done-label';
1313
import { useRegisterAddressNotifications } from '@/hooks/use-register-address-notifications';
1414
import { useRegisterAddressMutation } from '@/api/services/worker/use-register-address';
15+
import { ErrorLabel } from './error-label';
1516
// import { RegisterAddressOnChainButton } from '@/pages/worker/profile/register-address-on-chain-btn';
1617

1718
export function ProfileActions() {
@@ -38,6 +39,8 @@ export function ProfileActions() {
3839
const { t } = useTranslation();
3940
const emailVerified = user.status === 'active';
4041
const kycApproved = user.kyc_status === 'approved';
42+
const kycDeclined = user.kyc_status === 'declined';
43+
const kycToComplete = !(kycApproved || kycDeclined);
4144

4245
const getConnectWalletBtn = () => {
4346
switch (true) {
@@ -87,11 +90,13 @@ export function ProfileActions() {
8790
return (
8891
<Grid container flexDirection="column" gap="1rem">
8992
<Grid>
90-
{kycApproved ? (
93+
{kycApproved && (
9194
<DoneLabel>{t('worker.profile.kycCompleted')}</DoneLabel>
92-
) : (
93-
<StartKycButton />
9495
)}
96+
{kycDeclined && (
97+
<ErrorLabel>{t('worker.profile.kycDeclined')}</ErrorLabel>
98+
)}
99+
{kycToComplete && <StartKycButton />}
95100
</Grid>
96101
<Grid>{getConnectWalletBtn()}</Grid>
97102
{kycApproved && !user.wallet_address && isWalletConnected ? (

0 commit comments

Comments
 (0)