Skip to content

Commit

Permalink
Copy change for dApp
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Nov 26, 2024
1 parent bad4608 commit 1085336
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export default function BuildTransactionModal({
return (
<>
<ModalCloseButton onClick={onClose} />
<ModalHeader>Building transaction data...</ModalHeader>
<ModalHeader>Preparing withdrawal transaction...</ModalHeader>
<ModalBody>
<Spinner size="xl" variant="filled" />
<TextMd>We are building your withdrawal data.</TextMd>
<TextMd>This may take a few minutes.</TextMd>
<Button size="lg" width="100%" variant="outline" onClick={onClose}>
Cancel
</Button>
Expand Down
17 changes: 12 additions & 5 deletions dapp/src/components/TransactionModal/WalletInteractionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
ProgressProps,
} from "@chakra-ui/react"
import { AcreSignIcon } from "#/assets/icons"
import { useActionFlowType, useConnector } from "#/hooks"
import { ACTION_FLOW_TYPES } from "#/types"
import { useActionFlowType, useConnector, useIsEmbed } from "#/hooks"
import { ACTION_FLOW_TYPES, DappMode } from "#/types"
import { Alert, AlertIcon } from "../shared/Alert"
import { TextMd } from "../shared/Typography"

Expand All @@ -22,11 +22,16 @@ const ICON_STYLES = {

type WalletInteractionStep = "opening-wallet" | "awaiting-transaction"

const CONTENT_BY_DAPP_MODE: Record<DappMode, string> = {
standalone: "wallet",
"ledger-live": "Ledger Device",
}

const DATA: Record<
WalletInteractionStep,
{
header: string
description: (action: string) => string
description: (action: string, mode: DappMode) => string
progressProps?: ProgressProps
}
> = {
Expand All @@ -37,7 +42,8 @@ const DATA: Record<
},
"awaiting-transaction": {
header: "Awaiting signature confirmation",
description: () => "Waiting for your wallet to confirm the transaction.",
description: (_, mode: DappMode) =>
`Communicating with your ${CONTENT_BY_DAPP_MODE[mode]}...`,
progressProps: { transform: "scaleX(-1)" },
},
}
Expand All @@ -50,6 +56,7 @@ export default function WalletInteractionModal({
const actionType = useActionFlowType()
const connector = useConnector()
const { header, description, progressProps } = DATA[step]
const { embeddedApp } = useIsEmbed()

return (
<>
Expand Down Expand Up @@ -78,14 +85,14 @@ export default function WalletInteractionModal({
<TextMd>
{description(
actionType === ACTION_FLOW_TYPES.STAKE ? "deposit" : "withdraw",
embeddedApp ?? "standalone",
)}
</TextMd>
{step === "awaiting-transaction" && (
<Alert variant="elevated">
<AlertIcon />
<AlertDescription>
<TextMd>This may take up to a minute.</TextMd>
<TextMd>Don&apos;t close this window.</TextMd>
</AlertDescription>
</Alert>
)}
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/pages/DashboardPage/PositionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function PositionDetails() {
<VStack alignItems="start" spacing={0}>
{/* TODO: Component should be moved to `CardHeader` */}
<TextMd>
Your deposit
Your balance
{/* TODO: Uncomment when position will be implemented */}
{/* {positionPercentage && (
<Tag
Expand Down

0 comments on commit 1085336

Please sign in to comment.