Skip to content

Commit 000f6c0

Browse files
Merge pull request #271 from threshold-network/post-auth-modal-updates
Update MAS success modal Display copy and buttons based on the number of authorized applications. When two applications have been successfully authorized, we should change the `Authorize Other Apps` button to be `Node Setup Doc` and the secondary button to be `Dismiss` since there aren't any more apps to authorize.
2 parents e8bea71 + 12aa55b commit 000f6c0

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

src/components/Modal/StakingApplications/StakingApplicationsAuthorized.tsx

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
BodySm,
1717
Divider,
1818
FlowStepStatus,
19+
ButtonProps,
1920
} from "@threshold-network/components"
2021
import InfoBox from "../../InfoBox"
2122
import Link from "../../Link"
@@ -57,6 +58,8 @@ const StakingApplicationsAuthorizedBase: FC<
5758
navigate(`/staking/${stakingProvider}/authorize`)
5859
}
5960

61+
const numberOfAuthorizedApps = authorizedStakingApplications.length
62+
6063
return (
6164
<>
6265
<ModalHeader>Step 2 Completed</ModalHeader>
@@ -88,7 +91,9 @@ const StakingApplicationsAuthorizedBase: FC<
8891
</List>
8992
<InfoBox variant="modal">
9093
<H5>
91-
You can authorize more apps, or continue to Step 3 to set up nodes.
94+
{numberOfAuthorizedApps === 2
95+
? "Continue to Step 3 to set up nodes."
96+
: "You can authorize more apps, or continue to Step 3 to set up nodes."}
9297
</H5>
9398
<BodyLg mt="4">
9499
You can adjust the authorization amount at any time from the{" "}
@@ -104,7 +109,7 @@ const StakingApplicationsAuthorizedBase: FC<
104109
]}
105110
/>
106111
<BodySm align="center" mt="12">
107-
{authorizedStakingApplications.length === 1 ? (
112+
{numberOfAuthorizedApps === 1 ? (
108113
<>
109114
<ViewInBlockExplorer
110115
text="View"
@@ -123,9 +128,7 @@ const StakingApplicationsAuthorizedBase: FC<
123128
id={_.txHash}
124129
type={ExplorerDataType.TRANSACTION}
125130
/>
126-
{index + 1 === authorizedStakingApplications.length
127-
? " "
128-
: " and "}
131+
{index + 1 === numberOfAuthorizedApps ? " " : " and "}
129132
</Fragment>
130133
))}
131134
on Etherscan
@@ -135,22 +138,36 @@ const StakingApplicationsAuthorizedBase: FC<
135138
<Divider mt="4" />
136139
</ModalBody>
137140
<ModalFooter>
138-
<ButtonLink
139-
variant="outline"
140-
isExternal
141-
mr={2}
142-
href={ExternalHref.setupNodes}
143-
>
144-
Node Setup Doc
145-
</ButtonLink>
146-
<Button onClick={onAuthorizeOtherApps} mr={2}>
147-
Authorize Other Apps
148-
</Button>
141+
{numberOfAuthorizedApps === 2 ? (
142+
<>
143+
<Button variant={"outline"} onClick={closeModal} mr="2">
144+
Dismiss
145+
</Button>
146+
<SetupNodesButton />
147+
</>
148+
) : (
149+
<>
150+
<SetupNodesButton variant={"outline"} />
151+
<Button onClick={onAuthorizeOtherApps} ml={2}>
152+
Authorize Other Apps
153+
</Button>
154+
</>
155+
)}
149156
</ModalFooter>
150157
</>
151158
)
152159
}
153160

161+
const SetupNodesButton: FC<{ variant?: ButtonProps["variant"] }> = ({
162+
variant,
163+
}) => {
164+
return (
165+
<ButtonLink variant={variant} href={ExternalHref.setupNodes} isExternal>
166+
Node Setup Doc
167+
</ButtonLink>
168+
)
169+
}
170+
154171
export const StakingApplicationsAuthorized = withBaseModal(
155172
StakingApplicationsAuthorizedBase
156173
)

src/enums/externalHref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export enum ExternalHref {
1818
ankr = "https://www.ankr.com/",
1919
p2pValidator = "https://p2p.org/",
2020
infStones = "https://infstones.com/",
21-
setupNodes = "https://docs.threshold.network/",
21+
setupNodes = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup",
2222
tbtcNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup",
2323
randomBeaconNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup",
2424
}

0 commit comments

Comments
 (0)