From 2f4caa36c0b84df3e032b38db159a7fd938eed5c Mon Sep 17 00:00:00 2001 From: LuyandraBranco Date: Wed, 14 Jan 2026 21:57:12 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20copyable=20tok?= =?UTF-8?q?en=20fuction=20to=20arrow=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_components/mobile-market-stats.tsx | 2 +- .../copyable-token/copyable-token.types.ts | 5 +++++ .../index.tsx} | 20 +++++++++---------- src/components/tokens/token-card.tsx | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 src/components/shared/copyable-token/copyable-token.types.ts rename src/components/shared/{copyable-token.tsx => copyable-token/index.tsx} (71%) diff --git a/src/app/(root)/token/[coinType]/_components/mobile-market-stats.tsx b/src/app/(root)/token/[coinType]/_components/mobile-market-stats.tsx index 4372656e..99079735 100644 --- a/src/app/(root)/token/[coinType]/_components/mobile-market-stats.tsx +++ b/src/app/(root)/token/[coinType]/_components/mobile-market-stats.tsx @@ -6,8 +6,8 @@ import { BsTwitterX } from "react-icons/bs" import { TokenAvatar } from "@/components/tokens/token-avatar" import { ProtectionBadges } from "@/components/shared/protection-badges" import { RelativeAge } from "@/components/shared/relative-age" -import { CopyableToken } from "@/components/shared/copyable-token" import { CreatorDisplay } from "@/components/creator/creator-display" +import CopyableToken from "@/components/shared/copyable-token" import { UpdateMetadataDialog } from "./update-metadata-dialog" import { useApp } from "@/context/app.context" import type { Token } from "@/types/token" diff --git a/src/components/shared/copyable-token/copyable-token.types.ts b/src/components/shared/copyable-token/copyable-token.types.ts new file mode 100644 index 00000000..eea94465 --- /dev/null +++ b/src/components/shared/copyable-token/copyable-token.types.ts @@ -0,0 +1,5 @@ +export interface CopyableTokenProps { + symbol: string + coinType: string + className?: string +} \ No newline at end of file diff --git a/src/components/shared/copyable-token.tsx b/src/components/shared/copyable-token/index.tsx similarity index 71% rename from src/components/shared/copyable-token.tsx rename to src/components/shared/copyable-token/index.tsx index ee3ba7c2..1b480197 100644 --- a/src/components/shared/copyable-token.tsx +++ b/src/components/shared/copyable-token/index.tsx @@ -1,18 +1,14 @@ "use client" -import { formatAddress } from "@mysten/sui/utils" +import { FC } from "react" import { Check, Copy } from "lucide-react" -import { useClipboard } from "@/hooks/use-clipboard" -import { cn } from "@/utils" -interface CopyableTokenProps { - symbol: string - coinType: string - className?: string -} +import { cn } from "@/utils" +import { useClipboard } from "@/hooks/use-clipboard" +import { CopyableTokenProps } from "./copyable-token.types" -export function CopyableToken({ symbol, coinType, className }: CopyableTokenProps) { - const { copy, copied } = useClipboard() +const CopyableToken: FC = ({ symbol, coinType, className }) => { + const { copy, copied } = useClipboard(); return (
: }
- ) + ); } + +export default CopyableToken; diff --git a/src/components/tokens/token-card.tsx b/src/components/tokens/token-card.tsx index d36e8adc..5887b07b 100644 --- a/src/components/tokens/token-card.tsx +++ b/src/components/tokens/token-card.tsx @@ -10,8 +10,8 @@ import { RelativeAge } from "@/components/shared/relative-age" import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import type { Token } from "@/types/token" import { formatNumberWithSuffix } from "@/utils/format" -import { CopyableToken } from "../shared/copyable-token" import { QuickBuy } from "./quick-buy" +import CopyableToken from "../shared/copyable-token" import { TokenAvatar } from "./token-avatar" import CreatorHoverCard from "../creator/creator-hover-card"