Skip to content

Commit 0048682

Browse files
authored
[HUMAN App] refactor: change KYC to IDV (#3368)
1 parent 72b95f3 commit 0048682

File tree

19 files changed

+137
-138
lines changed

19 files changed

+137
-138
lines changed

packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { useTranslation } from 'react-i18next';
55
import { env } from '@/shared/env';
66
import { useColorMode } from '@/shared/contexts/color-mode';
77
import { useIsMobile } from '@/shared/hooks/use-is-mobile';
8-
import { useWorkerKycStatus } from '@/modules/worker/profile/hooks';
8+
import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks';
99
import { useActiveProposalQuery } from '../hooks/use-active-proposal-query';
1010

1111
export function GovernanceBanner() {
1212
const { t } = useTranslation();
1313
const { data, isLoading, isError } = useActiveProposalQuery();
14-
const { kycApproved } = useWorkerKycStatus();
14+
const { isVerificationCompleted } = useWorkerIdentityVerificationStatus();
1515
const { colorPalette } = useColorMode();
1616
const [timeRemaining, setTimeRemaining] = useState('00:00:00');
1717
const isMobile = useIsMobile('lg');
@@ -43,7 +43,7 @@ export function GovernanceBanner() {
4343
};
4444
}, [data?.deadline]);
4545

46-
if (!kycApproved || isLoading || isError || !data) {
46+
if (!isVerificationCompleted || isLoading || isError || !data) {
4747
return null;
4848
}
4949

packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Counter } from '@/shared/components/ui/counter';
1111
import { getErrorMessageForError } from '@/shared/errors';
1212
import { getTomorrowDate } from '@/shared/helpers/date';
1313
import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user';
14+
import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks';
1415
import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications';
1516
import { useColorMode } from '@/shared/contexts/color-mode';
1617
import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette';
@@ -29,6 +30,7 @@ export function HcaptchaLabelingPage() {
2930
const { colorPalette, isDarkMode } = useColorMode();
3031
const captchaRef = useRef<HCaptcha>(null);
3132
const { user } = useAuthenticatedUser();
33+
const { isVerificationCompleted } = useWorkerIdentityVerificationStatus();
3234
const { onSuccess, onError } = useHCaptchaLabelingNotifications();
3335
const statsColor = isDarkMode
3436
? onlyDarkModeColor.additionalTextColor
@@ -79,7 +81,7 @@ export function HcaptchaLabelingPage() {
7981
solveHCaptchaMutation({ token });
8082
};
8183

82-
if (user.kyc_status !== 'approved') {
84+
if (!isVerificationCompleted) {
8385
return <Navigate to={routerPaths.worker.profile} replace />;
8486
}
8587

packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx renamed to packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
import { getErrorMessageForError } from '@/shared/errors';
66
import type { ResponseError } from '@/shared/types/global.type';
77

8-
export function useKycErrorNotifications() {
8+
export function useIdvErrorNotifications() {
99
const { showNotification } = useNotification();
1010

1111
return (error: ResponseError) => {

packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import Paper from '@mui/material/Paper';
22
import Grid from '@mui/material/Grid';
33
import { Navigate } from 'react-router-dom';
44
import { useIsMobile } from '@/shared/hooks/use-is-mobile';
5-
import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user';
5+
import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks';
66
import { routerPaths } from '@/router/router-paths';
77
import { OraclesTableJobTypesSelect, OraclesTable } from './components';
88

99
export function JobsDiscoveryPage() {
1010
const isMobile = useIsMobile();
11-
const { user } = useAuthenticatedUser();
11+
const { isVerificationCompleted } = useWorkerIdentityVerificationStatus();
1212

13-
if (user.kyc_status !== 'approved') {
13+
if (!isVerificationCompleted) {
1414
return <Navigate to={routerPaths.worker.profile} replace />;
1515
}
1616

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './start-kyc-btn';
1+
export * from './start-idv-btn';
22
export * from './register-address-btn';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { t } from 'i18next';
2+
import { Button } from '@/shared/components/ui/button';
3+
import { useStartIdv } from '../../hooks';
4+
5+
export function StartIdvBtn() {
6+
const { isIdvAlreadyInProgress, idvStartIsPending, startIdv } = useStartIdv();
7+
8+
if (isIdvAlreadyInProgress) {
9+
return (
10+
<Button disabled fullWidth variant="contained">
11+
{t('worker.profile.identityVerificationInProgress')}
12+
</Button>
13+
);
14+
}
15+
16+
return (
17+
<Button
18+
fullWidth
19+
loading={idvStartIsPending}
20+
onClick={startIdv}
21+
variant="contained"
22+
>
23+
{t('worker.profile.completeIdentityVerification')}
24+
</Button>
25+
);
26+
}

packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useTranslation } from 'react-i18next';
2+
import { useWorkerIdentityVerificationStatus } from '../hooks';
3+
import { StartIdvBtn } from './buttons';
4+
import { DoneLabel, ErrorLabel } from './status-labels';
5+
6+
export function IdentityVerificationControl() {
7+
const { t } = useTranslation();
8+
const { status } = useWorkerIdentityVerificationStatus();
9+
10+
if (status === 'approved') {
11+
return (
12+
<DoneLabel>{t('worker.profile.identityVerificationStatus')}</DoneLabel>
13+
);
14+
} else if (status === 'declined') {
15+
return (
16+
<ErrorLabel>{t('worker.profile.identityVerificationStatus')}</ErrorLabel>
17+
);
18+
}
19+
20+
return <StartIdvBtn />;
21+
}

packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Grid from '@mui/material/Grid';
2-
import { KycVerificationControl } from './kyc-verification-control';
2+
import { IdentityVerificationControl } from './identity-verification-control';
33
import { WalletConnectionControl } from './wallet-connection-control';
44

55
export function ProfileActions() {
66
return (
77
<Grid container flexDirection="column" gap="1rem">
88
<Grid>
9-
<KycVerificationControl />
9+
<IdentityVerificationControl />
1010
</Grid>
1111

1212
<Grid>

0 commit comments

Comments
 (0)