forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigateToPersonalDetails.tsx
74 lines (66 loc) · 2.66 KB
/
NavigateToPersonalDetails.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Button, Text } from '@deriv/components';
import { Localize, useTranslations } from '@deriv-com/translations';
import { useDevice } from '@deriv-com/ui';
import { useHistory } from 'react-router';
import { routes } from '@deriv/shared';
import FormFooter from '../../../Components/form-footer';
import { DerivLightOrdersDefaultIcon } from '@deriv/quill-icons';
import { observer, useStore } from '@deriv/stores';
import './navigate-to-personal-details.scss';
const NavigateToPersonalDetails = observer(() => {
const { localize } = useTranslations();
const { isDesktop } = useDevice();
const { ui, client } = useStore();
const history = useHistory();
const { account_settings } = client;
const handleOnclick = () => {
let field_to_scroll;
if (!account_settings.account_opening_reason) {
field_to_scroll = 'account-opening-reason';
} else {
field_to_scroll = 'employment-tax-section';
}
ui.setFieldRefToFocus(field_to_scroll);
history.push(routes.personal_details);
};
const icon_size = isDesktop ? { height: '200px', width: '200px' } : { height: '124px', width: '124px' };
return (
<div className='navigate-to-personal-details'>
<div className='navigate-to-personal-details__body'>
<DerivLightOrdersDefaultIcon {...icon_size} />
<Text
as='p'
size={isDesktop ? 'sm' : 's'}
className='navigate-to-personal-details__body--text'
align='center'
>
<Localize i18n_default_text='Update your personal details in account settings before starting your financial assessment.' />
</Text>
</div>
{isDesktop ? (
<div className='navigate-to-personal-details__footer'>
<Button
type='button'
has_effect
text={localize('Update now')}
primary
large
onClick={handleOnclick}
/>
</div>
) : (
<FormFooter className='navigate-to-personal-details__footer--layout'>
<Button
onClick={handleOnclick}
has_effect
is_loading={false}
text={localize('Update now')}
large
primary
/>
</FormFooter>
)}
</div>
);
});
export default NavigateToPersonalDetails;