diff --git a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx index ecb939482f..19373ee981 100644 --- a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx +++ b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx @@ -5,13 +5,13 @@ import { useTranslation } from 'react-i18next'; import { env } from '@/shared/env'; import { useColorMode } from '@/shared/contexts/color-mode'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useWorkerKycStatus } from '@/modules/worker/profile/hooks'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useActiveProposalQuery } from '../hooks/use-active-proposal-query'; export function GovernanceBanner() { const { t } = useTranslation(); const { data, isLoading, isError } = useActiveProposalQuery(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { colorPalette } = useColorMode(); const [timeRemaining, setTimeRemaining] = useState('00:00:00'); const isMobile = useIsMobile('lg'); @@ -43,7 +43,7 @@ export function GovernanceBanner() { }; }, [data?.deadline]); - if (!kycApproved || isLoading || isError || !data) { + if (!isVerificationCompleted || isLoading || isError || !data) { return null; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx index 66fce91d97..2e27f715db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx @@ -11,6 +11,7 @@ import { Counter } from '@/shared/components/ui/counter'; import { getErrorMessageForError } from '@/shared/errors'; import { getTomorrowDate } from '@/shared/helpers/date'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications'; import { useColorMode } from '@/shared/contexts/color-mode'; import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; @@ -29,6 +30,7 @@ export function HcaptchaLabelingPage() { const { colorPalette, isDarkMode } = useColorMode(); const captchaRef = useRef(null); const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { onSuccess, onError } = useHCaptchaLabelingNotifications(); const statsColor = isDarkMode ? onlyDarkModeColor.additionalTextColor @@ -79,7 +81,7 @@ export function HcaptchaLabelingPage() { solveHCaptchaMutation({ token }); }; - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx similarity index 91% rename from packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx index 7abb883624..7f6663e162 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx @@ -5,7 +5,7 @@ import { import { getErrorMessageForError } from '@/shared/errors'; import type { ResponseError } from '@/shared/types/global.type'; -export function useKycErrorNotifications() { +export function useIdvErrorNotifications() { const { showNotification } = useNotification(); return (error: ResponseError) => { diff --git a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx index b844b46d0b..4f5aefa0db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx @@ -2,15 +2,15 @@ import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Grid'; import { Navigate } from 'react-router-dom'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { routerPaths } from '@/router/router-paths'; import { OraclesTableJobTypesSelect, OraclesTable } from './components'; export function JobsDiscoveryPage() { const isMobile = useIsMobile(); - const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts index ebfc0e1758..bc7560332f 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts @@ -1,2 +1,2 @@ -export * from './start-kyc-btn'; +export * from './start-idv-btn'; export * from './register-address-btn'; diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx new file mode 100644 index 0000000000..68f5ad06e9 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx @@ -0,0 +1,26 @@ +import { t } from 'i18next'; +import { Button } from '@/shared/components/ui/button'; +import { useStartIdv } from '../../hooks'; + +export function StartIdvBtn() { + const { isIdvAlreadyInProgress, idvStartIsPending, startIdv } = useStartIdv(); + + if (isIdvAlreadyInProgress) { + return ( + + ); + } + + return ( + + ); +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx deleted file mode 100644 index 88c5363ecc..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { t } from 'i18next'; -import { Button } from '@/shared/components/ui/button'; -import { useStartKyc } from '../../hooks'; - -export function StartKycBtn() { - const { isKYCInProgress, kycStartIsPending, startKYC } = useStartKyc(); - - if (isKYCInProgress) { - return ( - - ); - } - - return ( - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx new file mode 100644 index 0000000000..2b8b801cb6 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx @@ -0,0 +1,21 @@ +import { useTranslation } from 'react-i18next'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; +import { StartIdvBtn } from './buttons'; +import { DoneLabel, ErrorLabel } from './status-labels'; + +export function IdentityVerificationControl() { + const { t } = useTranslation(); + const { status } = useWorkerIdentityVerificationStatus(); + + if (status === 'approved') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } else if (status === 'declined') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } + + return ; +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx deleted file mode 100644 index 21f661e3be..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import { useWorkerKycStatus } from '../hooks'; -import { StartKycBtn } from './buttons'; -import { DoneLabel, ErrorLabel } from './status-labels'; - -export function KycVerificationControl() { - const { t } = useTranslation(); - const { kycApproved, kycDeclined, kycToComplete } = useWorkerKycStatus(); - - return ( - <> - {kycApproved && {t('worker.profile.kycCompleted')}} - {kycDeclined && ( - {t('worker.profile.kycDeclined')} - )} - {kycToComplete && } - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx index 9b37cf4107..56551421f6 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx @@ -1,12 +1,12 @@ import Grid from '@mui/material/Grid'; -import { KycVerificationControl } from './kyc-verification-control'; +import { IdentityVerificationControl } from './identity-verification-control'; import { WalletConnectionControl } from './wallet-connection-control'; export function ProfileActions() { return ( - + diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx index 5159b94eba..d0268f7d7d 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx @@ -3,7 +3,7 @@ import { Grid } from '@mui/material'; import { Button } from '@/shared/components/ui/button'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { useWalletConnect } from '@/shared/contexts/wallet-connect'; -import { useWorkerKycStatus } from '../hooks'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; import { DoneLabel } from './status-labels'; import { WalletConnectDone } from './wallet-connect-done'; import { RegisterAddressBtn } from './buttons'; @@ -11,7 +11,7 @@ import { RegisterAddressBtn } from './buttons'; export function WalletConnectionControl() { const { t } = useTranslation(); const { user } = useAuthenticatedUser(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { isConnected, openModal } = useWalletConnect(); const { wallet_address: walletAddress } = user; @@ -25,7 +25,7 @@ export function WalletConnectionControl() { ); } - if (kycApproved && isConnected) { + if (isVerificationCompleted && isConnected) { return ( @@ -36,7 +36,7 @@ export function WalletConnectionControl() { return (