Skip to content

Commit a1b518c

Browse files
committed
[Dashboard] Remove tw-components Button from contract action-buttons (#5369)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the button components across various files to standardize the usage of the `Button` component from the `@/components/ui/button` module, updating properties for consistency, and improving the UI elements. ### Detailed summary - Replaced `Button` imports from `tw-components` with `@/components/ui/button`. - Changed `colorScheme` to `variant` for button styling. - Updated `isDisabled` to `disabled` for button state management. - Added `className="gap-2"` for consistent spacing. - Modified button content to include icons before text. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 8c1fa1b commit a1b518c

File tree

13 files changed

+52
-81
lines changed

13 files changed

+52
-81
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/batch-lazy-mint-button.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -17,7 +18,6 @@ import type { ThirdwebContract } from "thirdweb";
1718
import * as ERC721Ext from "thirdweb/extensions/erc721";
1819
import * as ERC1155Ext from "thirdweb/extensions/erc1155";
1920
import { useReadContract, useSendAndConfirmTransaction } from "thirdweb/react";
20-
import { Button } from "tw-components";
2121

2222
interface BatchLazyMintButtonProps {
2323
canCreateDelayedRevealBatch: boolean;
@@ -55,10 +55,8 @@ export const BatchLazyMintButton: React.FC<BatchLazyMintButtonProps> = ({
5555
<MinterOnly contract={contract}>
5656
<Sheet onOpenChange={setOpen} open={open}>
5757
<SheetTrigger asChild>
58-
<Button
59-
colorScheme="primary"
60-
leftIcon={<FileStackIcon className="size-4" />}
61-
>
58+
<Button variant="primary" className="gap-2">
59+
<FileStackIcon className="size-4" />
6260
Batch Upload
6361
</Button>
6462
</SheetTrigger>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -18,7 +19,6 @@ import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
1819
import { getApprovalForTransaction } from "thirdweb/extensions/erc20";
1920
import { claimTo } from "thirdweb/extensions/erc721";
2021
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
21-
import { Button } from "tw-components";
2222
import { FormErrorMessage, FormHelperText, FormLabel } from "tw-components";
2323

2424
const CLAIM_FORM_ID = "nft-claim-form";
@@ -45,8 +45,8 @@ export const NFTClaimButton: React.FC<NFTClaimButtonProps> = ({ contract }) => {
4545
return (
4646
<Sheet open={open} onOpenChange={setOpen}>
4747
<SheetTrigger asChild>
48-
<Button colorScheme="primary" leftIcon={<GemIcon className="size-4" />}>
49-
Claim
48+
<Button variant="primary" className="gap-2">
49+
<GemIcon className="size-4" /> Claim
5050
</Button>
5151
</SheetTrigger>
5252
<SheetContent className="overflow-y-auto sm:w-[540px] sm:max-w-[90%] lg:w-[700px]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-button.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use client";
2+
import { Button } from "@/components/ui/button";
23
import {
34
Sheet,
45
SheetContent,
@@ -10,7 +11,6 @@ import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
1011
import { PlusIcon } from "lucide-react";
1112
import { useState } from "react";
1213
import type { ThirdwebContract } from "thirdweb";
13-
import { Button } from "tw-components";
1414
import { LazyMintNftForm } from "./lazy-mint-form";
1515

1616
interface NFTLazyMintButtonProps {
@@ -28,11 +28,8 @@ export const NFTLazyMintButton: React.FC<NFTLazyMintButtonProps> = ({
2828
<MinterOnly contract={contract}>
2929
<Sheet open={open} onOpenChange={setOpen}>
3030
<SheetTrigger asChild>
31-
<Button
32-
colorScheme="primary"
33-
leftIcon={<PlusIcon className="size-5" />}
34-
{...restButtonProps}
35-
>
31+
<Button variant="primary" className="gap-2" {...restButtonProps}>
32+
<PlusIcon className="size-5" />
3633
Single Upload
3734
</Button>
3835
</SheetTrigger>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Accordion,
56
AccordionButton,
@@ -25,7 +26,6 @@ import { lazyMint as lazyMint721 } from "thirdweb/extensions/erc721";
2526
import { lazyMint as lazyMint1155 } from "thirdweb/extensions/erc1155";
2627
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
2728
import {
28-
Button,
2929
FormErrorMessage,
3030
FormHelperText,
3131
FormLabel,
@@ -313,9 +313,9 @@ export const LazyMintNftForm: React.FC<LazyMintNftFormParams> = ({
313313
</form>
314314
<div className="mt-8 flex flex-row justify-end gap-3">
315315
<Button
316-
isDisabled={sendAndConfirmTx.isPending}
316+
disabled={sendAndConfirmTx.isPending}
317317
variant="outline"
318-
mr={3}
318+
className="mr-3"
319319
onClick={() => setOpen(false)}
320320
>
321321
Cancel

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/mint-button.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -11,7 +12,6 @@ import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
1112
import { PlusIcon } from "lucide-react";
1213
import { useState } from "react";
1314
import type { ThirdwebContract } from "thirdweb";
14-
import { Button } from "tw-components";
1515
import { NFTMintForm } from "./mint-form";
1616

1717
interface NFTMintButtonProps {
@@ -30,11 +30,8 @@ export const NFTMintButton: React.FC<NFTMintButtonProps> = ({
3030
<MinterOnly contract={contract}>
3131
<Sheet open={open} onOpenChange={setOpen}>
3232
<SheetTrigger asChild>
33-
<Button
34-
colorScheme="primary"
35-
leftIcon={<PlusIcon className="size-5" />}
36-
{...restButtonProps}
37-
>
33+
<Button variant="primary" className="gap-2" {...restButtonProps}>
34+
<PlusIcon className="size-5" />
3835
Mint
3936
</Button>
4037
</SheetTrigger>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/reveal-button.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -18,7 +19,7 @@ import { toast } from "sonner";
1819
import type { ThirdwebContract } from "thirdweb";
1920
import { getBatchesToReveal, reveal } from "thirdweb/extensions/erc721";
2021
import { useReadContract, useSendAndConfirmTransaction } from "thirdweb/react";
21-
import { Button, FormErrorMessage, FormLabel } from "tw-components";
22+
import { FormErrorMessage, FormLabel } from "tw-components";
2223

2324
interface NFTRevealButtonProps {
2425
contract: ThirdwebContract;
@@ -48,11 +49,8 @@ export const NFTRevealButton: React.FC<NFTRevealButtonProps> = ({
4849
<MinterOnly contract={contract}>
4950
<Sheet open={open} onOpenChange={setOpen}>
5051
<SheetTrigger asChild>
51-
<Button
52-
colorScheme="primary"
53-
leftIcon={<EyeIcon className="size-4" />}
54-
>
55-
Reveal NFTs
52+
<Button variant="primary" className="gap-2">
53+
<EyeIcon className="size-4" /> Reveal NFTs
5654
</Button>
5755
</SheetTrigger>
5856
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/shared-metadata-button.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use client";
2+
import { Button } from "@/components/ui/button";
23
import {
34
Sheet,
45
SheetContent,
@@ -10,7 +11,6 @@ import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
1011
import { PlusIcon } from "lucide-react";
1112
import { useState } from "react";
1213
import type { ThirdwebContract } from "thirdweb";
13-
import { Button } from "tw-components";
1414
import { SharedMetadataForm } from "./shared-metadata-form";
1515

1616
interface NFTSharedMetadataButtonProps {
@@ -25,12 +25,8 @@ export const NFTSharedMetadataButton: React.FC<
2525
<MinterOnly contract={contract}>
2626
<Sheet open={open} onOpenChange={setOpen}>
2727
<SheetTrigger asChild>
28-
<Button
29-
colorScheme="primary"
30-
leftIcon={<PlusIcon className="size-5" />}
31-
{...restButtonProps}
32-
>
33-
Set NFT Metadata
28+
<Button variant="primary" className="gap-2" {...restButtonProps}>
29+
<PlusIcon className="size-5" /> Set NFT Metadata
3430
</Button>
3531
</SheetTrigger>
3632
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import { useSplitDistributeFunds } from "@3rdweb-sdk/react/hooks/useSplit";
45
import { MismatchButton } from "components/buttons/MismatchButton";
56
import { TransactionButton } from "components/buttons/TransactionButton";
67
import { useTrack } from "hooks/analytics/useTrack";
78
import { useTxNotifications } from "hooks/useTxNotifications";
89
import { useMemo } from "react";
910
import type { ThirdwebContract } from "thirdweb";
10-
import { Button } from "tw-components";
1111
import type { Balance } from "../ContractSplitPage";
1212

1313
interface DistributeButtonProps {
@@ -90,7 +90,7 @@ export const DistributeButton: React.FC<DistributeButtonProps> = ({
9090

9191
if (numTransactions === 0) {
9292
return (
93-
<Button isDisabled colorScheme="primary" {...restButtonProps}>
93+
<Button disabled variant="primary" {...restButtonProps}>
9494
Nothing to distribute
9595
</Button>
9696
);

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/airdrop-button.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
67
SheetHeader,
78
SheetTitle,
89
SheetTrigger,
910
} from "@/components/ui/sheet";
10-
import { Droplet } from "lucide-react";
11+
import { DropletIcon } from "lucide-react";
1112
import { useState } from "react";
1213
import type { ThirdwebContract } from "thirdweb";
1314
import { balanceOf } from "thirdweb/extensions/erc20";
1415
import { useActiveAccount, useReadContract } from "thirdweb/react";
15-
import { Button } from "tw-components";
1616
import { TokenAirdropForm } from "./airdrop-form";
1717
interface TokenAirdropButtonProps {
1818
contract: ThirdwebContract;
@@ -33,12 +33,12 @@ export const TokenAirdropButton: React.FC<TokenAirdropButtonProps> = ({
3333
<Sheet open={open} onOpenChange={setOpen}>
3434
<SheetTrigger asChild>
3535
<Button
36-
colorScheme="primary"
37-
leftIcon={<Droplet size={16} />}
36+
variant="primary"
3837
{...restButtonProps}
39-
isDisabled={!hasBalance}
38+
disabled={!hasBalance}
39+
className="gap-2"
4040
>
41-
Airdrop
41+
<DropletIcon size={16} /> Airdrop
4242
</Button>
4343
</SheetTrigger>
4444
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/burn-button.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -23,7 +24,6 @@ import {
2324
useSendAndConfirmTransaction,
2425
} from "thirdweb/react";
2526
import {
26-
Button,
2727
FormErrorMessage,
2828
FormHelperText,
2929
FormLabel,
@@ -59,12 +59,12 @@ export const TokenBurnButton: React.FC<TokenBurnButtonProps> = ({
5959
<Sheet open={open} onOpenChange={setOpen}>
6060
<SheetTrigger asChild>
6161
<Button
62-
colorScheme="primary"
63-
leftIcon={<Flame size={16} />}
62+
variant="primary"
6463
{...restButtonProps}
65-
isDisabled={!hasBalance}
64+
disabled={!hasBalance}
65+
className="gap-2"
6666
>
67-
Burn
67+
<Flame size={16} /> Burn
6868
</Button>
6969
</SheetTrigger>
7070
<SheetContent className="z-[10000]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/claim-button.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -11,7 +12,7 @@ import {
1112
import { FormControl, Input } from "@chakra-ui/react";
1213
import { TransactionButton } from "components/buttons/TransactionButton";
1314
import { useTrack } from "hooks/analytics/useTrack";
14-
import { Gem } from "lucide-react";
15+
import { GemIcon } from "lucide-react";
1516
import { useState } from "react";
1617
import { useForm } from "react-hook-form";
1718
import { toast } from "sonner";
@@ -22,12 +23,7 @@ import {
2223
useReadContract,
2324
useSendAndConfirmTransaction,
2425
} from "thirdweb/react";
25-
import {
26-
Button,
27-
FormErrorMessage,
28-
FormHelperText,
29-
FormLabel,
30-
} from "tw-components";
26+
import { FormErrorMessage, FormHelperText, FormLabel } from "tw-components";
3127

3228
interface TokenClaimButtonProps {
3329
contract: ThirdwebContract;
@@ -52,12 +48,8 @@ export const TokenClaimButton: React.FC<TokenClaimButtonProps> = ({
5248
return (
5349
<Sheet open={open} onOpenChange={setOpen}>
5450
<SheetTrigger asChild>
55-
<Button
56-
colorScheme="primary"
57-
leftIcon={<Gem size={16} />}
58-
{...restButtonProps}
59-
>
60-
Claim
51+
<Button variant="primary" className="gap-2" {...restButtonProps}>
52+
<GemIcon size={16} /> Claim
6153
</Button>
6254
</SheetTrigger>
6355
<SheetContent className="z-[10000]">

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/mint-button.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { Button } from "@/components/ui/button";
34
import {
45
Sheet,
56
SheetContent,
@@ -12,7 +13,7 @@ import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
1213
import { FormControl, Input } from "@chakra-ui/react";
1314
import { TransactionButton } from "components/buttons/TransactionButton";
1415
import { useTrack } from "hooks/analytics/useTrack";
15-
import { Plus } from "lucide-react";
16+
import { PlusIcon } from "lucide-react";
1617
import { useState } from "react";
1718
import { useForm } from "react-hook-form";
1819
import { toast } from "sonner";
@@ -23,7 +24,7 @@ import {
2324
useReadContract,
2425
useSendAndConfirmTransaction,
2526
} from "thirdweb/react";
26-
import { Button, FormErrorMessage, FormLabel } from "tw-components";
27+
import { FormErrorMessage, FormLabel } from "tw-components";
2728

2829
interface TokenMintButtonProps {
2930
contract: ThirdwebContract;
@@ -50,12 +51,8 @@ export const TokenMintButton: React.FC<TokenMintButtonProps> = ({
5051
<MinterOnly contract={contract}>
5152
<Sheet open={open} onOpenChange={setOpen}>
5253
<SheetTrigger asChild>
53-
<Button
54-
colorScheme="primary"
55-
leftIcon={<Plus size={16} />}
56-
{...restButtonProps}
57-
>
58-
Mint
54+
<Button variant="primary" {...restButtonProps} className="gap-2">
55+
<PlusIcon size={16} /> Mint
5956
</Button>
6057
</SheetTrigger>
6158
<SheetContent className="z-[10000]">

0 commit comments

Comments
 (0)