Skip to content

Commit

Permalink
[@tools-website] Disable button when 'mainnet' is selected in faucet (#…
Browse files Browse the repository at this point in the history
…1039)

* fix: disable button when mainnet is selected in faucet

* chore: changeset file

* chore: run formatter

* chore: change naming of vars

* chore: apply changes on fund new accounts page
  • Loading branch information
KristinaSpasevska authored Oct 20, 2023
1 parent 0d01891 commit adbd017
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .changeset/funny-boxes-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
8 changes: 5 additions & 3 deletions packages/apps/tools/src/pages/faucet/existing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ const ExistingAccountFaucetPage: FC = () => {
[chainID, t],
);

const showNotification = selectedNetwork !== 'testnet04';
const mainnetSelected: boolean = selectedNetwork === 'mainnet01';
const disabledButton: boolean =
requestStatus.status === 'processing' || mainnetSelected;

const {
register,
Expand All @@ -136,7 +138,7 @@ const ExistingAccountFaucetPage: FC = () => {
</Breadcrumbs.Root>
<Heading as="h4">{t('Add Funds to Existing Account')}</Heading>
<div className={notificationContainerStyle}>
{showNotification ? (
{mainnetSelected ? (
<Notification.Root
color="warning"
expanded={true}
Expand Down Expand Up @@ -180,7 +182,7 @@ const ExistingAccountFaucetPage: FC = () => {
icon="TrailingIcon"
iconAlign="right"
title={t('Fund X Coins', { amount: AMOUNT_OF_COINS_FUNDED })}
disabled={requestStatus.status === 'processing'}
disabled={disabledButton}
>
{t('Fund X Coins', { amount: AMOUNT_OF_COINS_FUNDED })}
</Button>
Expand Down
6 changes: 3 additions & 3 deletions packages/apps/tools/src/pages/faucet/new/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ const NewAccountFaucetPage: FC = () => {
[chainID, pred, pubKeys, t],
);

const testnetNotSelected: boolean = selectedNetwork !== 'testnet04';
const mainnetSelected: boolean = selectedNetwork === 'mainnet01';
const disabledButton: boolean =
requestStatus.status === 'processing' || testnetNotSelected;
requestStatus.status === 'processing' || mainnetSelected;

const addPublicKey = (
e: React.MouseEvent<HTMLButtonElement>,
Expand Down Expand Up @@ -243,7 +243,7 @@ const NewAccountFaucetPage: FC = () => {
</Breadcrumbs.Root>{' '}
<Heading as="h4">{t('Create and Fund New Account')}</Heading>
<div className={notificationContainerStyle}>
{testnetNotSelected ? (
{mainnetSelected ? (
<Notification.Root
color="warning"
expanded={true}
Expand Down

1 comment on commit adbd017

@vercel
Copy link

@vercel vercel bot commented on adbd017 Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tools – ./packages/apps/tools

kadena-js-transfer.vercel.app
tools-kadena-js.vercel.app
tools-git-main-kadena-js.vercel.app
tools.kadena.io

Please sign in to comment.