Skip to content
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

chore: signup modal style fix and add error msg from be #130

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@deriv-com/api-hooks": "^0.1.11",
"@deriv-com/analytics": "~1.4.13",
"@deriv-com/ui": "1.14.2",
"@deriv-com/ui": "1.14.5",
"@deriv-com/utils": "^0.0.11",
"@deriv/quill-icons": "latest",
"@svgr/core": "^8.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/flows/Signup/CitizenshipModal/CitizenshipModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const CitizenshipModal = ({ onClickNext }: TCitizenshipModal) => {
}
}, [clientCountry, setFieldValue, residenceList, values.country]);

// Add <Loading /> here later when it's created

return (
<div className='h-full rounded-default max-w-[328px] lg:max-w-[440px] bg-system-light-primary-background'>
<div className='bg-system-light-primary-background rounded-xl'>
<div className='flex flex-col p-16 space-y-16 lg:space-y-24 lg:p-24'>
<Text weight='bold'>Select your country and citizenship:</Text>
<Text className='text-default lg:text-lg' weight='bold'>
Select your country and citizenship:
</Text>
<Dropdown
dropdownIcon={<LabelPairedChevronDownMdRegularIcon />}
errorMessage='Country of residence is where you currently live.'
Expand Down
11 changes: 8 additions & 3 deletions src/flows/Signup/PasswordSettingModal/PasswordSettingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,33 @@ import { useFormikContext } from 'formik';

import { Button, PasswordInput, Text } from '@deriv-com/ui';

import { useUIContext } from '@/providers';
import { validPassword } from '@/utils';

import { TSignupFormValues } from '../SignupWrapper/SignupWrapper';

export const PasswordSettingModal = () => {
const { values, setFieldValue } = useFormikContext<TSignupFormValues>();
const { uiState } = useUIContext();

const { errorMessage } = uiState;

const onPasswordChange = (e: ChangeEvent<HTMLInputElement>) => {
setFieldValue('password', e.target.value);
};

return (
<div className='h-full rounded-default max-w-[328px] lg:max-w-[440px] bg-system-light-primary-background'>
<div className='flex flex-col p-16 space-y-16 lg:space-y-24 lg:p-24'>
<Text align='center' weight='bold'>
<div className='rounded-xl bg-system-light-primary-background'>
<div className='flex flex-col p-16 space-y-16 lg:space-y-24 lg:p-24 rounded-xl'>
<Text align='center' weight='bold' className='text-default lg:text-lg'>
Keep your account secure with a password
</Text>
<PasswordInput
isFullWidth
label='Create a password'
onChange={onPasswordChange}
value={values.password}
customErrorMessage={errorMessage}
/>
<Text align='center' size='xs'>
Strong passwords contain at least 8 characters. combine uppercase and lowercase letters, numbers,
Expand Down
7 changes: 6 additions & 1 deletion src/flows/Signup/SignupWrapper/SignupWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export const SignupWrapper = () => {
};

return (
<Modal ariaHideApp={false} isOpen={isModalOpen('Signup')} shouldCloseOnOverlayClick={false}>
<Modal
ariaHideApp={false}
isOpen={isModalOpen('Signup')}
shouldCloseOnOverlayClick={false}
className='max-w-[328px] lg:max-w-[440px] h-auto rounded-xl'
>
<Formik initialValues={initialValues} onSubmit={handleSubmit} validationSchema={signup}>
<Form>
<SignupScreens setStep={setStep} step={step} />
Expand Down
14 changes: 13 additions & 1 deletion src/hooks/useNewVirtualAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ export const useNewVirtualAccount = () => {
const navigate = useNavigate();
const { openModal } = useQueryParams();
const { setUIState } = useUIContext();
const { data: newTradingAccountData, mutate: createAccount, status, ...rest } = useNewAccountVirtual();
const {
data: newTradingAccountData,
mutate: createAccount,
status,
error: newAccountError,
...rest
} = useNewAccountVirtual();

useEffect(() => {
if (newAccountError) {
setUIState({ errorMessage: newAccountError.error.message });
}
}, [newAccountError, setUIState, status]);

const { appendAccountCookie } = useAuthData();

Expand Down
1 change: 1 addition & 0 deletions src/providers/UIProvider/UIProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type TUIState = {
accountType?: string;
isSignupWizardOpen?: boolean;
regulation?: string;
errorMessage?: string;
};

type TUIContext = {
Expand Down
Loading