Skip to content

Commit 7183c4c

Browse files
Merge pull request #272 from threshold-network/stake-flow-modal-updates
Update the confirm staking params modal Update helper texts below the input to match designs. Also get rid of the addresses from the list of confirmation params to match designs.
2 parents 5e8015b + 9e3a9dd commit 7183c4c

File tree

3 files changed

+46
-19
lines changed

3 files changed

+46
-19
lines changed

src/components/Forms/FormikInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const FormikInput: FC<
1919
name: string
2020
label: string
2121
secondaryLabel?: string
22-
helperText?: string
22+
helperText?: string | JSX.Element
2323
placeholder?: string
2424
tooltip?: string
2525
}

src/components/Modal/ConfirmStakingParams/AdvancedParamsForm.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ import { FC, Ref } from "react"
22
import { FormikProps, FormikErrors, withFormik } from "formik"
33
import { Form, FormikInput } from "../../Forms"
44
import { getErrorsObj, validateETHAddress } from "../../../utils/forms"
5-
import { Alert, AlertIcon } from "@chakra-ui/react"
5+
import {
6+
Alert,
7+
AlertIcon,
8+
BodyXs,
9+
useColorModeValue,
10+
} from "@threshold-network/components"
611
import { useWeb3React } from "@web3-react/core"
7-
import { BodyXs } from "@threshold-network/components"
812
import { isAddress, isSameETHAddress } from "../../../web3/utils"
13+
import Link from "../../Link"
914

1015
export interface FormValues {
1116
stakingProvider: string
@@ -29,19 +34,23 @@ const AdvancedParamsFormBase: FC<ComponentProps & FormikProps<FormValues>> = ({
2934
<FormikInput
3035
name="stakingProvider"
3136
label="Provider Address"
32-
helperText="Enter a staking provider address."
37+
helperText={
38+
<AddressHelper text="This is your node address. You can setup this address on your own or receive it from your Staking Provider." />
39+
}
3340
/>
3441
<FormikInput
3542
mt="6"
3643
name="beneficiary"
3744
label="Beneficiary Address"
38-
helperText="This address will receive rewards."
45+
helperText={<AddressHelper text="This address will receive rewards." />}
3946
/>
4047
<FormikInput
4148
mt="6"
4249
name="authorizer"
4350
label="Authorizer Address"
44-
helperText="This address will authorize applications."
51+
helperText={
52+
<AddressHelper text="This address will authorize applications. We recommend you to use the same address as your wallet address." />
53+
}
4554
/>
4655
{isAddress(authorizer) &&
4756
!isSameETHAddress(authorizer, account as string) && (
@@ -57,6 +66,16 @@ const AdvancedParamsFormBase: FC<ComponentProps & FormikProps<FormValues>> = ({
5766
)
5867
}
5968

69+
const AddressHelper: FC<{ text: string }> = ({ text }) => {
70+
const textColor = useColorModeValue("gray.500", "gray.300")
71+
72+
return (
73+
<BodyXs color={textColor}>
74+
{text} <Link to="/staking/how-it-works/overview">Learn more</Link>.
75+
</BodyXs>
76+
)
77+
}
78+
6079
type AdvancedParamsFormProps = {
6180
initialAddress: string
6281
innerRef: Ref<FormikProps<FormValues>>

src/components/Modal/ConfirmStakingParams/index.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { FC, useEffect, useRef, useState } from "react"
22
import { useWeb3React } from "@web3-react/core"
33
import {
4+
BodyLg,
5+
BodySm,
6+
H5,
47
Alert,
58
AlertIcon,
69
Button,
@@ -9,8 +12,10 @@ import {
912
ModalCloseButton,
1013
ModalFooter,
1114
ModalHeader,
12-
} from "@chakra-ui/react"
13-
import { BodyLg, BodySm, H5 } from "@threshold-network/components"
15+
List,
16+
ListItem,
17+
HStack,
18+
} from "@threshold-network/components"
1419
import { FormikProps } from "formik"
1520
import withBaseModal from "../withBaseModal"
1621
import { useModal } from "../../../hooks/useModal"
@@ -24,6 +29,7 @@ import StakingStats from "../../StakingStats"
2429
import useCheckDuplicateProviderAddress from "../../../web3/hooks/useCheckDuplicateProviderAddress"
2530
import { featureFlags } from "../../../constants"
2631
import { useStakeTransaction } from "../../../web3/hooks/useStakeTransaction"
32+
import { formatTokenAmount } from "../../../utils/formatAmount"
2733

2834
const ConfirmStakingParamsModal: FC<
2935
BaseModalProps & { stakeAmount: string }
@@ -87,21 +93,23 @@ const ConfirmStakingParamsModal: FC<
8793
</ModalHeader>
8894
<ModalCloseButton />
8995
<ModalBody>
90-
<InfoBox variant="modal" spacing={6}>
91-
<H5>You are about to make a deposit into the T Staking Contract.</H5>
96+
<InfoBox variant="modal">
97+
<H5 mb="4">
98+
You are about to make a deposit into the T Staking Contract.
99+
</H5>
92100
{featureFlags.MULTI_APP_STAKING && (
93101
<BodyLg>Staking requires 2 transactions.</BodyLg>
94102
)}
95103
</InfoBox>
96-
<StakingStats
97-
{...{
98-
stakeAmount,
99-
beneficiary: account as string,
100-
stakingProvider: account as string,
101-
authorizer: account as string,
102-
}}
103-
/>
104-
<Alert my={6} status="info" fontSize="sm">
104+
<List mt="6">
105+
<ListItem>
106+
<HStack justifyContent="space-between">
107+
<BodySm>Staked Amount</BodySm>
108+
<BodySm>{`${formatTokenAmount(stakeAmount)} T`}</BodySm>
109+
</HStack>
110+
</ListItem>
111+
</List>
112+
<Alert mb={6} my={9} status="info" fontSize="sm">
105113
<AlertIcon />
106114
Take note! These addresses cannot be changed later.
107115
</Alert>

0 commit comments

Comments
 (0)