Skip to content

Commit 6713fa2

Browse files
[Dashboard] Fix asset page link and improve token claim UX
1 parent 1a1ff88 commit 6713fa2

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/ContractOverviewPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
5353
text: "View asset page",
5454
icon: <ExternalLinkIcon className="size-4" />,
5555
target: "_blank",
56-
link: `https://thirdweb.com/${chainSlug}/${contract.address}`,
56+
link: `/${chainSlug}/${contract.address}`,
5757
}}
5858
trackingCategory="erc20-contract"
5959
trackingLabel="view-asset-page"

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
padHex,
2323
sendAndConfirmTransaction,
2424
toTokens,
25-
waitForReceipt,
2625
} from "thirdweb";
2726
import type { ChainMetadata } from "thirdweb/chains";
2827
import {
@@ -122,8 +121,7 @@ export function ClaimTokenCardUI(props: {
122121
}
123122

124123
async function sendAndConfirm() {
125-
const receipt = await sendClaimTx.mutateAsync(transaction);
126-
await waitForReceipt(receipt);
124+
await sendClaimTx.mutateAsync(transaction);
127125
}
128126

129127
setStepsUI({
@@ -286,6 +284,7 @@ export function ClaimTokenCardUI(props: {
286284
{account ? (
287285
<TransactionButton
288286
transactionCount={undefined}
287+
checkBalance={false}
289288
isLoggedIn={true}
290289
isPending={approveAndClaim.isPending}
291290
onClick={async () => {

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_hooks/useTokenPriceData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ export function useTokenPriceData(params: {
5151
}
5252
: { type: "no-data" as const };
5353
},
54+
refetchInterval: 5000,
5455
});
5556
}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_hooks/useTokenTransfers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ export function useTokenTransfers(params: {
4949
const data = json.data as TokenTransfersData[];
5050
return data;
5151
},
52+
refetchInterval: 5000,
5253
});
5354
}

apps/dashboard/src/components/buttons/MismatchButton.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,20 @@ type MistmatchButtonProps = React.ComponentProps<typeof Button> & {
8080
txChainId: number;
8181
isLoggedIn: boolean;
8282
isPending: boolean;
83+
checkBalance?: boolean;
8384
};
8485

8586
export const MismatchButton = forwardRef<
8687
HTMLButtonElement,
8788
MistmatchButtonProps
8889
>((props, ref) => {
89-
const { txChainId, isLoggedIn, isPending, ...buttonProps } = props;
90+
const {
91+
txChainId,
92+
isLoggedIn,
93+
isPending,
94+
checkBalance = true,
95+
...buttonProps
96+
} = props;
9097
const account = useActiveAccount();
9198
const wallet = useActiveWallet();
9299
const activeWalletChain = useActiveWalletChain();
@@ -150,7 +157,8 @@ export const MismatchButton = forwardRef<
150157
}
151158

152159
const isBalanceRequired =
153-
wallet.id === "smart" ? false : !GAS_FREE_CHAINS.includes(txChainId);
160+
checkBalance &&
161+
(wallet.id === "smart" ? false : !GAS_FREE_CHAINS.includes(txChainId));
154162

155163
const notEnoughBalance =
156164
(txChainBalance.data?.value || 0n) === 0n && isBalanceRequired;

apps/dashboard/src/components/buttons/TransactionButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type TransactionButtonProps = Omit<ButtonProps, "variant"> & {
2929
txChainID: number;
3030
variant?: "destructive" | "primary" | "default";
3131
isLoggedIn: boolean;
32+
checkBalance?: boolean;
3233
};
3334

3435
export const TransactionButton: React.FC<TransactionButtonProps> = ({
@@ -38,6 +39,7 @@ export const TransactionButton: React.FC<TransactionButtonProps> = ({
3839
txChainID,
3940
variant,
4041
isLoggedIn,
42+
checkBalance,
4143
...restButtonProps
4244
}) => {
4345
const activeWallet = useActiveWallet();
@@ -68,6 +70,7 @@ export const TransactionButton: React.FC<TransactionButtonProps> = ({
6870
txChainId={txChainID}
6971
{...restButtonProps}
7072
disabled={disabled}
73+
checkBalance={checkBalance}
7174
className={cn("relative overflow-hidden", restButtonProps.className)}
7275
style={{
7376
paddingLeft: transactionCount

0 commit comments

Comments
 (0)