Skip to content

[Dashboard] Fix asset page link and improve token claim UX #7193

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
text: "View asset page",
icon: <ExternalLinkIcon className="size-4" />,
target: "_blank",
link: `https://thirdweb.com/${chainSlug}/${contract.address}`,
link: `/${chainSlug}/${contract.address}`,
}}
trackingCategory="erc20-contract"
trackingLabel="view-asset-page"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export function ClaimTokenCardUI(props: {
}

async function sendAndConfirm() {
const receipt = await sendClaimTx.mutateAsync(transaction);
await waitForReceipt(receipt);
const result = await sendClaimTx.mutateAsync(transaction);
await waitForReceipt(result);
}

setStepsUI({
Expand Down Expand Up @@ -286,6 +286,7 @@ export function ClaimTokenCardUI(props: {
{account ? (
<TransactionButton
transactionCount={undefined}
checkBalance={false}
isLoggedIn={true}
isPending={approveAndClaim.isPending}
onClick={async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ export function useTokenPriceData(params: {
}
: { type: "no-data" as const };
},
refetchInterval: 5000,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ export function useTokenTransfers(params: {
const data = json.data as TokenTransfersData[];
return data;
},
refetchInterval: 5000,
});
}
12 changes: 10 additions & 2 deletions apps/dashboard/src/components/buttons/MismatchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,20 @@ type MistmatchButtonProps = React.ComponentProps<typeof Button> & {
txChainId: number;
isLoggedIn: boolean;
isPending: boolean;
checkBalance?: boolean;
};

export const MismatchButton = forwardRef<
HTMLButtonElement,
MistmatchButtonProps
>((props, ref) => {
const { txChainId, isLoggedIn, isPending, ...buttonProps } = props;
const {
txChainId,
isLoggedIn,
isPending,
checkBalance = true,
...buttonProps
} = props;
const account = useActiveAccount();
const wallet = useActiveWallet();
const activeWalletChain = useActiveWalletChain();
Expand Down Expand Up @@ -150,7 +157,8 @@ export const MismatchButton = forwardRef<
}

const isBalanceRequired =
wallet.id === "smart" ? false : !GAS_FREE_CHAINS.includes(txChainId);
checkBalance &&
(wallet.id === "smart" ? false : !GAS_FREE_CHAINS.includes(txChainId));

const notEnoughBalance =
(txChainBalance.data?.value || 0n) === 0n && isBalanceRequired;
Expand Down
3 changes: 3 additions & 0 deletions apps/dashboard/src/components/buttons/TransactionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type TransactionButtonProps = Omit<ButtonProps, "variant"> & {
txChainID: number;
variant?: "destructive" | "primary" | "default";
isLoggedIn: boolean;
checkBalance?: boolean;
};

export const TransactionButton: React.FC<TransactionButtonProps> = ({
Expand All @@ -38,6 +39,7 @@ export const TransactionButton: React.FC<TransactionButtonProps> = ({
txChainID,
variant,
isLoggedIn,
checkBalance,
...restButtonProps
}) => {
const activeWallet = useActiveWallet();
Expand Down Expand Up @@ -68,6 +70,7 @@ export const TransactionButton: React.FC<TransactionButtonProps> = ({
txChainId={txChainID}
{...restButtonProps}
disabled={disabled}
checkBalance={checkBalance}
className={cn("relative overflow-hidden", restButtonProps.className)}
style={{
paddingLeft: transactionCount
Expand Down
Loading