-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update screens for deposit and withdrawal flows #821
Open
kkosiorowska
wants to merge
12
commits into
main
Choose a base branch
from
awaiting-modals
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
804c4e0
Add `inProgress` status for sending BTC transaction
kkosiorowska 9e6fbe6
Update screens for deposit and withdrawal flows
kkosiorowska 51a3965
Update `initializeWithdrawal` fn
kkosiorowska d0c0418
Add a new step for the withdrawal flow
kkosiorowska 9c8840f
Fix failed SDK test
kkosiorowska 8fdbec7
Add padding for the connector icon
kkosiorowska f47c3e9
Set the right description in `WalletInteractionModal`
kkosiorowska a880198
Use `finally` to update state
kkosiorowska 48effb3
Show correct modal when `transactionHash` is defined
kkosiorowska f3f18be
Add `alt` prop to image component
kkosiorowska 3fbfbef
Rename from `type` to `actionType`
kkosiorowska 8ceb6b4
Rename from `builtDataStepCallback` to `dataBuiltStepCallback`
kkosiorowska File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 29 additions & 0 deletions
29
dapp/src/components/TransactionModal/ActiveUnstakingStep/BuildTransactionModal.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,29 @@ | ||
import React from "react" | ||
import { | ||
Button, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalHeader, | ||
} from "@chakra-ui/react" | ||
import Spinner from "#/components/shared/Spinner" | ||
import { TextMd } from "#/components/shared/Typography" | ||
|
||
export default function BuildTransactionModal({ | ||
onClose, | ||
}: { | ||
onClose: () => void | ||
}) { | ||
return ( | ||
<> | ||
<ModalCloseButton onClick={onClose} /> | ||
<ModalHeader>Building transaction data...</ModalHeader> | ||
<ModalBody> | ||
<Spinner size="xl" variant="filled" /> | ||
<TextMd>We are building your withdrawal data.</TextMd> | ||
<Button size="lg" width="100%" variant="outline" onClick={onClose}> | ||
Cancel | ||
</Button> | ||
</ModalBody> | ||
</> | ||
) | ||
} |
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
32 changes: 0 additions & 32 deletions
32
dapp/src/components/TransactionModal/TriggerTransactionModal.tsx
This file was deleted.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
dapp/src/components/TransactionModal/WalletInteractionModal.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,95 @@ | ||
import React from "react" | ||
import { | ||
AlertDescription, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalHeader, | ||
Image, | ||
HStack, | ||
Progress, | ||
ProgressProps, | ||
} from "@chakra-ui/react" | ||
import { AcreSignIcon } from "#/assets/icons" | ||
import { useActionFlowType, useConnector } from "#/hooks" | ||
import { ACTION_FLOW_TYPES } from "#/types" | ||
import { Alert, AlertIcon } from "../shared/Alert" | ||
import { TextMd } from "../shared/Typography" | ||
|
||
const ICON_STYLES = { | ||
boxSize: 14, | ||
rounded: "full", | ||
} | ||
|
||
type WalletInteractionStep = "opening-wallet" | "awaiting-transaction" | ||
|
||
const DATA: Record< | ||
WalletInteractionStep, | ||
{ | ||
header: string | ||
description: (action: string) => string | ||
progressProps?: ProgressProps | ||
} | ||
> = { | ||
"opening-wallet": { | ||
header: "Opening your wallet for signature", | ||
description: (action) => | ||
`Confirm the ${action} by signing the transaction with your wallet.`, | ||
}, | ||
"awaiting-transaction": { | ||
header: "Awaiting signature confirmation", | ||
description: () => "Waiting for your wallet to confirm the transaction.", | ||
progressProps: { transform: "scaleX(-1)" }, | ||
}, | ||
} | ||
|
||
export default function WalletInteractionModal({ | ||
step, | ||
}: { | ||
step: WalletInteractionStep | ||
}) { | ||
const actionType = useActionFlowType() | ||
const connector = useConnector() | ||
const { header, description, progressProps } = DATA[step] | ||
|
||
return ( | ||
<> | ||
{step === "opening-wallet" && <ModalCloseButton />} | ||
<ModalHeader textAlign="center" pt={16} pb={12}> | ||
{header} | ||
</ModalHeader> | ||
<ModalBody gap={12}> | ||
<HStack minW={80} spacing={5}> | ||
<AcreSignIcon {...ICON_STYLES} /> | ||
{/* TODO: Create correct progress bar */} | ||
<Progress | ||
size="sm" | ||
bg="gold.200" | ||
isIndeterminate | ||
{...progressProps} | ||
/> | ||
<Image | ||
src={connector?.icon} | ||
p={2} | ||
bg="black" | ||
alt="Connector icon" | ||
{...ICON_STYLES} | ||
/> | ||
</HStack> | ||
<TextMd> | ||
{description( | ||
actionType === ACTION_FLOW_TYPES.STAKE ? "deposit" : "withdraw", | ||
)} | ||
</TextMd> | ||
{step === "awaiting-transaction" && ( | ||
<Alert variant="elevated"> | ||
<AlertIcon /> | ||
<AlertDescription> | ||
<TextMd>This may take up to a minute.</TextMd> | ||
<TextMd>Don't close this window.</TextMd> | ||
</AlertDescription> | ||
</Alert> | ||
)} | ||
</ModalBody> | ||
</> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename
inProgress
toisInProgress
to keep consistency with other boolean values. Or if you agree to refactor theuseDepositBTCTransaction
hook as I mentioned above, we can usestatus
.