Skip to content

Commit f2d1085

Browse files
committed
[Dashboard] Remove AddressCopyButton (#5077)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on removing the `AddressCopyButton` component from various files and replacing it with `CopyTextButton` and `CopyAddressButton` components to optimize bundle size and improve code consistency. ### Detailed summary - Deleted `AddressCopyButton.tsx` file. - Removed all imports of `AddressCopyButton` from multiple files. - Replaced instances of `AddressCopyButton` with `CopyTextButton` in `webhooks-table.tsx` and `token-id.tsx`. - Replaced `AddressCopyButton` with `CopyAddressButton` in `transaction-timeline.tsx` and `contract-subscriptions-table.tsx`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent a68830c commit f2d1085

File tree

6 files changed

+18
-122
lines changed

6 files changed

+18
-122
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155";
2626
import { useReadContract } from "thirdweb/react";
2727
import { resolveScheme } from "thirdweb/storage";
2828
import { Badge, Button, Card, CodeBlock, Heading, Text } from "tw-components";
29-
import { AddressCopyButton } from "tw-components/AddressCopyButton";
3029
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
3130
import { shortenString } from "utils/usedapp-external";
3231
import { NftProperty } from "../components/nft-property";
@@ -210,10 +209,11 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
210209
<Heading size="label.md">Token ID</Heading>
211210
</GridItem>
212211
<GridItem colSpan={8}>
213-
<AddressCopyButton
214-
size="xs"
215-
address={nft.id?.toString()}
216-
title="Token ID"
212+
<CopyTextButton
213+
textToCopy={nft.id?.toString()}
214+
textToShow={nft.id?.toString()}
215+
tooltip="Token ID"
216+
copyIconPosition="right"
217217
/>
218218
</GridItem>
219219

apps/dashboard/src/components/engine/configuration/webhooks-table.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CopyTextButton } from "@/components/ui/CopyTextButton";
12
import {
23
type EngineWebhook,
34
useEngineRevokeWebhook,
@@ -23,7 +24,7 @@ import { useTxNotifications } from "hooks/useTxNotifications";
2324
import { Trash2Icon } from "lucide-react";
2425
import { useState } from "react";
2526
import { Button, Card, FormLabel, Text } from "tw-components";
26-
import { AddressCopyButton } from "tw-components/AddressCopyButton";
27+
import { shortenString } from "utils/usedapp-external";
2728

2829
export function beautifyString(str: string): string {
2930
return str
@@ -58,10 +59,11 @@ const columns = [
5859
header: "Secret",
5960
cell: (cell) => {
6061
return (
61-
<AddressCopyButton
62-
address={cell.getValue() || ""}
63-
title="secret"
64-
size="xs"
62+
<CopyTextButton
63+
textToCopy={cell.getValue() || ""}
64+
textToShow={shortenString(cell.getValue() || "")}
65+
tooltip="Secret"
66+
copyIconPosition="right"
6567
/>
6668
);
6769
},

apps/dashboard/src/components/engine/contract-subscription/contract-subscriptions-table.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 { CopyAddressButton } from "@/components/ui/CopyAddressButton";
34
import { useThirdwebClient } from "@/constants/thirdweb.client";
45
import {
56
type EngineContractSubscription,
@@ -34,7 +35,6 @@ import { useState } from "react";
3435
import { eth_getBlockByNumber, getRpcClient } from "thirdweb";
3536
import { shortenAddress as shortenAddresThrows } from "thirdweb/utils";
3637
import { Button, Card, FormLabel, LinkButton, Text } from "tw-components";
37-
import { AddressCopyButton } from "../../../tw-components/AddressCopyButton";
3838

3939
function shortenAddress(address: string) {
4040
if (!address) {
@@ -93,9 +93,9 @@ export const ContractSubscriptionTable: React.FC<
9393
const explorer = chain?.explorers?.[0];
9494
if (!explorer) {
9595
return (
96-
<AddressCopyButton
96+
<CopyAddressButton
9797
address={cell.getValue()}
98-
title="Contract address"
98+
copyIconPosition="right"
9999
/>
100100
);
101101
}

apps/dashboard/src/components/engine/overview/transaction-timeline.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { WalletAddress } from "@/components/blocks/wallet-address";
2+
import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
23
import type { Transaction } from "@3rdweb-sdk/react/hooks/useEngine";
34
import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser";
45
import {
@@ -22,7 +23,6 @@ import { useTxNotifications } from "hooks/useTxNotifications";
2223
import { CheckIcon } from "lucide-react";
2324
import { useRef } from "react";
2425
import { Button, FormLabel, Text } from "tw-components";
25-
import { AddressCopyButton } from "tw-components/AddressCopyButton";
2626

2727
interface TimelineStep {
2828
step: string;
@@ -242,10 +242,9 @@ const CancelTransactionButton = ({
242242
</FormControl>
243243
<FormControl>
244244
<FormLabel>To</FormLabel>
245-
<AddressCopyButton
245+
<CopyAddressButton
246246
address={transaction.toAddress ?? ""}
247-
size="xs"
248-
shortenAddress={false}
247+
copyIconPosition="right"
249248
/>
250249
</FormControl>
251250
<FormControl>

apps/dashboard/src/tw-components/AddressCopyButton.tsx

Lines changed: 0 additions & 99 deletions
This file was deleted.

apps/dashboard/src/tw-components/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@ export * from "./link";
1010
export * from "./menu";
1111
export * from "./table-container";
1212
export * from "./text";
13-
14-
/**
15-
* ❗️❗️❗️ @DANGER
16-
* Do not export `AddressCopyButton` from here
17-
* It will result in a HUGE bundle size
18-
*/

0 commit comments

Comments
 (0)