2021-07-08 02:10:12 +02:00
|
|
|
import React from 'react';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import PropTypes from 'prop-types';
|
2022-03-10 17:33:53 +01:00
|
|
|
import { capitalize } from 'lodash';
|
2021-07-08 02:10:12 +02:00
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
import Box from '../../ui/box';
|
2021-10-13 19:41:24 +02:00
|
|
|
import { BLOCK_SIZES } from '../../../helpers/constants/design-system';
|
2021-07-08 02:10:12 +02:00
|
|
|
|
2021-10-13 19:41:24 +02:00
|
|
|
export const threeStepStages = {
|
2021-07-08 02:10:12 +02:00
|
|
|
PASSWORD_CREATE: 1,
|
2021-10-13 19:41:24 +02:00
|
|
|
RECOVERY_PHRASE_VIDEO: 2,
|
|
|
|
RECOVERY_PHRASE_REVIEW: 3,
|
|
|
|
RECOVERY_PHRASE_CONFIRM: 4,
|
2021-07-08 02:10:12 +02:00
|
|
|
ONBOARDING_COMPLETE: 5,
|
|
|
|
};
|
2021-10-13 19:41:24 +02:00
|
|
|
|
|
|
|
export const twoStepStages = {
|
|
|
|
RECOVERY_PHRASE_CONFIRM: 1,
|
|
|
|
PASSWORD_CREATE: 2,
|
|
|
|
};
|
|
|
|
|
2022-05-16 20:38:04 +02:00
|
|
|
export function ThreeStepProgressBar({ stage, ...boxProps }) {
|
2021-07-08 02:10:12 +02:00
|
|
|
const t = useI18nContext();
|
|
|
|
return (
|
2022-05-16 20:38:04 +02:00
|
|
|
<Box {...boxProps}>
|
2021-07-08 02:10:12 +02:00
|
|
|
<ul className="progressbar">
|
|
|
|
<li
|
|
|
|
className={classnames({
|
2021-10-13 19:41:24 +02:00
|
|
|
active: stage >= 1,
|
2022-03-10 17:33:53 +01:00
|
|
|
complete: stage > 1,
|
2021-07-08 02:10:12 +02:00
|
|
|
})}
|
|
|
|
>
|
2022-03-10 17:33:53 +01:00
|
|
|
{capitalize(t('createPassword'))}
|
2021-07-08 02:10:12 +02:00
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={classnames({
|
2021-10-13 19:41:24 +02:00
|
|
|
active: stage >= 2,
|
2022-03-10 17:33:53 +01:00
|
|
|
complete: stage > 3,
|
2021-07-08 02:10:12 +02:00
|
|
|
})}
|
|
|
|
>
|
2022-03-10 17:33:53 +01:00
|
|
|
{capitalize(t('secureWallet'))}
|
2021-07-08 02:10:12 +02:00
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={classnames({
|
2021-10-13 19:41:24 +02:00
|
|
|
active: stage >= 4,
|
2022-03-10 17:33:53 +01:00
|
|
|
complete: stage > 5,
|
2021-10-13 19:41:24 +02:00
|
|
|
})}
|
|
|
|
>
|
2022-03-10 17:33:53 +01:00
|
|
|
{capitalize(t('confirmRecoveryPhrase'))}
|
2021-10-13 19:41:24 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-05-16 20:38:04 +02:00
|
|
|
export function TwoStepProgressBar({ stage, ...boxProps }) {
|
2021-10-13 19:41:24 +02:00
|
|
|
const t = useI18nContext();
|
|
|
|
return (
|
2022-05-16 20:38:04 +02:00
|
|
|
<Box width={BLOCK_SIZES.FULL} {...boxProps}>
|
2021-10-13 19:41:24 +02:00
|
|
|
<ul className="progressbar two-steps">
|
|
|
|
<li
|
|
|
|
className={classnames({
|
|
|
|
active: stage >= 1,
|
|
|
|
complete: stage > 1,
|
2021-07-08 02:10:12 +02:00
|
|
|
})}
|
|
|
|
>
|
2022-03-10 17:33:53 +01:00
|
|
|
{capitalize(t('confirmRecoveryPhrase'))}
|
2021-10-13 19:41:24 +02:00
|
|
|
</li>
|
|
|
|
<li
|
|
|
|
className={classnames('two-steps', {
|
|
|
|
active: stage >= 2,
|
|
|
|
complete: stage > 2,
|
|
|
|
})}
|
|
|
|
>
|
2022-03-10 17:33:53 +01:00
|
|
|
{capitalize(t('createPassword'))}
|
2021-07-08 02:10:12 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-10-13 19:41:24 +02:00
|
|
|
ThreeStepProgressBar.propTypes = {
|
|
|
|
stage: PropTypes.number,
|
2022-05-16 20:38:04 +02:00
|
|
|
...Box.propTypes,
|
2021-10-13 19:41:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
TwoStepProgressBar.propTypes = {
|
|
|
|
stage: PropTypes.number,
|
2022-05-16 20:38:04 +02:00
|
|
|
...Box.propTypes,
|
2021-07-08 02:10:12 +02:00
|
|
|
};
|