This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAY-614][PAY-541] Add recovery flow and modal for buying $AUDIO (#2043)
* Add recovery modal UI * Add BuyAudioRecovery modal to state * Add string amount to AmountObject, and 'unknown' provider for onramps * Add libs method for getting metadata, rename args to include units, and enable libs call to create stripe session * Refactor core BuyAudio flow to have reusable code for the recovery flow * Remove precalculation of fees since we calculate fees to check recovery flow anyway * Don't reset on close, but rather open using a special action * Check for recovery on modal open, safer localstorage sanitizing * Remove unused vars * Move functions * Always show success screen after recovery
- Loading branch information
1 parent
31698f3
commit cad36e3
Showing
14 changed files
with
718 additions
and
276 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
16 changes: 16 additions & 0 deletions
16
packages/web/src/components/buy-audio-modal/BuyAudioRecoveryModal.module.css
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,16 @@ | ||
.content > div { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 24px; | ||
} | ||
|
||
.spinner { | ||
width: 24px; | ||
height: 24px; | ||
} | ||
|
||
.helpText { | ||
white-space: pre-line; | ||
line-height: 150%; | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/web/src/components/buy-audio-modal/BuyAudioRecoveryModal.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,33 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { Modal, ModalContent, ModalHeader, ModalTitle } from '@audius/stems' | ||
|
||
import { ReactComponent as IconRaisedHand } from 'assets/img/iconRaisedHand.svg' | ||
import { useModalState } from 'common/hooks/useModalState' | ||
import LoadingSpinner from 'components/loading-spinner/LoadingSpinner' | ||
|
||
import styles from './BuyAudioRecoveryModal.module.css' | ||
|
||
const messages = { | ||
holdOn: 'Hold On', | ||
helpText: | ||
'Your purchase of $AUDIO was interrupted.\nGive us a moment while we finish things up.' | ||
} | ||
|
||
export const BuyAudioRecoveryModal = () => { | ||
const [isOpen, setIsOpen] = useModalState('BuyAudioRecovery') | ||
const handleClose = useCallback(() => { | ||
setIsOpen(false) | ||
}, [setIsOpen]) | ||
return ( | ||
<Modal isOpen={isOpen} onClose={handleClose}> | ||
<ModalHeader onClose={handleClose}> | ||
<ModalTitle title={messages.holdOn} icon={<IconRaisedHand />} /> | ||
</ModalHeader> | ||
<ModalContent className={styles.content}> | ||
<LoadingSpinner className={styles.spinner} /> | ||
<div className={styles.helpText}>{messages.helpText}</div> | ||
</ModalContent> | ||
</Modal> | ||
) | ||
} |
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
Oops, something went wrong.