-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ameerul / FEQ-2189 integrate email verification flow (#69)
* feat: added email verification flow up until before rating modal * chore: added mixin for modals * chore: added RatingModals in order details, table row, moved order review to order footer * fix: style issues with order review footer and routing issue for orders page * fix: go back to past orders if user views order details then rating modal then goes back * chore: added Localize for texts * fix: failing test cases for Order flows * fix: remaining failing test cases * chore: added suggestions * Update src/components/Modals/EmailLinkBlockedModal/EmailLinkBlockedModal.tsx Co-authored-by: Hasan Mobarak <[email protected]> * Update src/components/Modals/InvalidVerificationLinkModal/InvalidVerificationLinkModal.tsx Co-authored-by: Hasan Mobarak <[email protected]> --------- Co-authored-by: Hasan Mobarak <[email protected]>
- Loading branch information
1 parent
95f875f
commit 948532a
Showing
44 changed files
with
1,045 additions
and
174 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/components/Modals/EmailLinkBlockedModal/EmailLinkBlockedModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.email-link-blocked-modal { | ||
@include default-modal; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/components/Modals/EmailLinkBlockedModal/EmailLinkBlockedModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { DerivLightIcEmailVerificationLinkBlockedIcon } from '@deriv/quill-icons'; | ||
import { Localize } from '@deriv-com/translations'; | ||
import { Modal, Text, useDevice } from '@deriv-com/ui'; | ||
import './EmailLinkBlockedModal.scss'; | ||
|
||
type TEmailLinkBlockedModalProps = { | ||
errorMessage?: string; | ||
isModalOpen: boolean; | ||
onRequestClose: () => void; | ||
}; | ||
|
||
const EmailLinkBlockedModal = ({ errorMessage, isModalOpen, onRequestClose }: TEmailLinkBlockedModalProps) => { | ||
const { isMobile } = useDevice(); | ||
const iconSize = isMobile ? 96 : 128; | ||
|
||
return ( | ||
<Modal | ||
ariaHideApp={false} | ||
className='email-link-blocked-modal' | ||
isOpen={isModalOpen} | ||
onRequestClose={onRequestClose} | ||
> | ||
<Modal.Header hideBorder onRequestClose={onRequestClose} /> | ||
<Modal.Body className='flex flex-col items-center lg:gap-[2.4rem] gap-8 p-[2.4rem] lg:pt-4 pt-0'> | ||
<DerivLightIcEmailVerificationLinkBlockedIcon height={iconSize} width={iconSize} /> | ||
<Text align='center' weight='bold'> | ||
<Localize i18n_default_text='Too many failed attempts' /> | ||
</Text> | ||
{errorMessage && <Text align='center'>{errorMessage}</Text>} | ||
</Modal.Body> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default EmailLinkBlockedModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as EmailLinkBlockedModal } from './EmailLinkBlockedModal'; |
8 changes: 1 addition & 7 deletions
8
src/components/Modals/EmailLinkVerifiedModal/EmailLinkVerifiedModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
.email-link-verified-modal { | ||
height: auto; | ||
width: 44rem; | ||
border-radius: 8px; | ||
|
||
@include mobile { | ||
max-width: calc(100vw - 3.2rem); | ||
} | ||
@include default-modal; | ||
} |
33 changes: 20 additions & 13 deletions
33
src/components/Modals/EmailLinkVerifiedModal/EmailLinkVerifiedModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
src/components/Modals/EmailLinkVerifiedModal/__tests__/EmailLinkVerifiedModal.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
src/components/Modals/EmailVerificationModal/EmailVerificationModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/components/Modals/InvalidVerificationLinkModal/InvalidVerificationLinkModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.invalid-verification-link-modal { | ||
@include default-modal; | ||
} |
81 changes: 81 additions & 0 deletions
81
src/components/Modals/InvalidVerificationLinkModal/InvalidVerificationLinkModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import clsx from 'clsx'; | ||
import { ERROR_CODES } from '@/constants'; | ||
import { | ||
DerivLightIcEmailVerificationLinkBlockedIcon, | ||
DerivLightIcEmailVerificationLinkInvalidIcon, | ||
} from '@deriv/quill-icons'; | ||
import { Localize } from '@deriv-com/translations'; | ||
import { Button, Modal, Text, useDevice } from '@deriv-com/ui'; | ||
import './InvalidVerificationLinkModal.scss'; | ||
|
||
type TInvalidVerificationLinkModalProps = { | ||
error?: { | ||
code: string; | ||
message: string; | ||
}; | ||
isModalOpen: boolean; | ||
mutate: () => void; | ||
onRequestClose: () => void; | ||
}; | ||
|
||
const InvalidVerificationLinkModal = ({ | ||
error, | ||
isModalOpen, | ||
mutate, | ||
onRequestClose, | ||
}: TInvalidVerificationLinkModalProps) => { | ||
const { isMobile } = useDevice(); | ||
const iconSize = isMobile ? 96 : 128; | ||
const isInvalidVerification = error?.code === ERROR_CODES.INVALID_VERIFICATION_TOKEN; | ||
const isExcessiveErrorMobile = !isInvalidVerification && isMobile; | ||
|
||
return ( | ||
<Modal | ||
ariaHideApp={false} | ||
className='invalid-verification-link-modal' | ||
isOpen={isModalOpen} | ||
onRequestClose={onRequestClose} | ||
> | ||
<Modal.Header hideBorder onRequestClose={onRequestClose} /> | ||
<Modal.Body | ||
className={clsx('flex flex-col items-center gap-[2.4rem] p-[2.4rem] pb-4', { | ||
'py-0 px-[1.4rem] gap-[1.4rem]': isExcessiveErrorMobile, | ||
})} | ||
> | ||
{isInvalidVerification ? ( | ||
<DerivLightIcEmailVerificationLinkInvalidIcon height={iconSize} width={iconSize} /> | ||
) : ( | ||
<DerivLightIcEmailVerificationLinkBlockedIcon height={iconSize} width={iconSize} /> | ||
)} | ||
{isInvalidVerification && ( | ||
<Text weight='bold'> | ||
<Localize i18n_default_text='Invalid verification link' /> | ||
</Text> | ||
)} | ||
{error?.message && <Text align='center' weight={isInvalidVerification ? 'normal' : 'bold'}> | ||
{error.message} | ||
</Text>} | ||
</Modal.Body> | ||
<Modal.Footer | ||
className={clsx('justify-center', { | ||
'pt-2 min-h-fit': isExcessiveErrorMobile, | ||
})} | ||
hideBorder | ||
> | ||
<Button | ||
onClick={() => (isInvalidVerification ? mutate() : onRequestClose())} | ||
size={isMobile ? 'md' : 'lg'} | ||
textSize='sm' | ||
> | ||
{isInvalidVerification ? ( | ||
<Localize i18n_default_text='Get new link' /> | ||
) : ( | ||
<Localize i18n_default_text='OK' /> | ||
)} | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default InvalidVerificationLinkModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as InvalidVerificationLinkModal } from './InvalidVerificationLinkModal'; |
Oops, something went wrong.