Skip to content

MP-40 dice modal wrap up -> dev #654

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

Merged
merged 1 commit into from
Jun 15, 2023
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
4 changes: 4 additions & 0 deletions src/apps/accounts/src/lib/assets/security/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { ReactComponent as MFAImage } from './mfa.svg'
import { ReactComponent as AppleStore } from './apple-store.svg'
import { ReactComponent as UnSuccessfullDiceVerificationIcon } from './unsuccessful.svg'
import diceIdLogo from './dicelogo.png'
import diceIdLogoBig from './dicelogobig.png'
import diceIdLogoSmall from './dicelogosmall.png'
import googlePlay from './google-play.png'

export {
AppleStore,
diceIdLogo,
diceIdLogoBig,
diceIdLogoSmall,
googlePlay,
MFAImage,
UnSuccessfullDiceVerificationIcon,
}
3 changes: 3 additions & 0 deletions src/apps/accounts/src/lib/assets/security/unsuccessful.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
display: flex;
}

.titleWrap {
display: flex;
align-items: center;

img {
margin-right: $sp-4;
}
}

.appSoresWrap {
display: flex;
justify-content: space-evenly;
Expand All @@ -25,10 +34,29 @@
margin: auto;
}

.diceBigLogo {
margin: $sp-4 0;
}

.errorWrap {
display: flex;
align-items: center;

svg {
margin-right: $sp-2;
width: 28px;
height: 28px;
}
}

.ctaButtons {
display: flex;
justify-content: space-between;
width: 100%;
flex: 1;
}

.errorText {
color: #ef476f;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { get, isUndefined, lowerCase } from 'lodash'
import { toast } from 'react-toastify'

import { BaseModal, Button } from '~/libs/ui'
import { AppleStore, diceIdLogoBig, googlePlay } from '~/apps/accounts/src/lib'
import {
AppleStore,
diceIdLogoBig,
diceIdLogoSmall,
googlePlay,
UnSuccessfullDiceVerificationIcon,
} from '~/apps/accounts/src/lib'
import { DiceConnectionStatus, updateMemberMFAStatusAsync, useDiceIdConnection, UserProfile } from '~/libs/core'
import { EnvironmentConfig } from '~/config'

Expand Down Expand Up @@ -51,7 +57,6 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
switch (step) {
case 1:
case 2:
case 3:
return setStep(step + 1)
default: return props.onClose()
}
Expand Down Expand Up @@ -90,7 +95,15 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
<BaseModal
open
onClose={props.onClose}
title='DICE ID AUTHENTICATOR SETUP'
title={(
<div className={styles.titleWrap}>
<img
src={diceIdLogoSmall}
alt='DICE ID Title Logo'
/>
<h3>DICE ID AUTHENTICATOR SETUP</h3>
</div>
)}
size='body'
classNames={{ modal: styles.diceModal }}
buttons={(
Expand All @@ -101,10 +114,10 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
onClick={handleSecondaryButtonClick}
/>
{
step <= 4 && (
step !== 3 && (
<Button
primary
label={step === 4 ? 'Finish' : 'Next'}
label={(step === 4 || step === 5) ? 'Finish' : 'Next'}
onClick={handlePrimaryButtonClick}
disabled={step === 2 && !diceConnection?.accepted}
/>
Expand Down Expand Up @@ -227,7 +240,7 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
{
step === 4 && (
<>
<h4>Setup completed!</h4>
<h3>Setup completed!</h3>
<p>
Hello
{' '}
Expand All @@ -238,7 +251,7 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
Your credentials have been verified and you are all set
for MFA using your decentralized identity (DICE ID).
</p>
<img src={diceIdLogoBig} alt='DICE ID Logo' />
<img src={diceIdLogoBig} className={styles.diceBigLogo} alt='DICE ID Logo' />
<p>
For more information on DICE ID, please visit
{' '}
Expand All @@ -257,7 +270,27 @@ const DiceSetupModal: FC<DiceSetupModalProps> = (props: DiceSetupModalProps) =>
{
step === 5 && (
<>

<div className={styles.errorWrap}>
<UnSuccessfullDiceVerificationIcon />
<h3 className={styles.errorText}>Unsuccessful Verification!</h3>
</div>
<p>
Hello
{' '}
{props.profile.handle}
,
<br />
<br />
Your credentials could not be verified,
you won&apos;t be able to connect to MFA using your decentralized identity (DICE ID).
</p>
<img src={diceIdLogoBig} className={styles.diceBigLogo} alt='DICE ID Logo' />
<p>
Please try again your process after few minutes.
<br />
<br />
</p>
<p>Please click Finish bellow.</p>
</>
)
}
Expand Down
10 changes: 8 additions & 2 deletions src/libs/ui/lib/components/modals/base-modal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface BaseModalProps extends ModalProps {
contentUrl?: string
theme?: 'danger' | 'clear'
size?: 'body' | 'lg' | 'md' | 'sm'
title?: string
title?: string | ReactNode
buttons?: ReactNode
}

Expand Down Expand Up @@ -62,7 +62,13 @@ const BaseModal: FC<BaseModalProps> = (props: BaseModalProps) => {
{props.title && (
<>
<div className={styles['modal-header']}>
<h3>{props.title}</h3>
{
typeof props.title === 'string' ? (
<h3>{props.title}</h3>
) : (
props.title
)
}
</div>

<hr className={styles.spacer} />
Expand Down