From 92d07d74bb213575c19acc24d7c2845630e24e1f Mon Sep 17 00:00:00 2001 From: Damian Date: Fri, 27 Oct 2023 12:37:07 -0300 Subject: [PATCH 1/2] Add copy to clipboard to TxReceipt --- .../scaffold-eth/Contract/TxReceipt.tsx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx b/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx index 12570b464..e287e2804 100644 --- a/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx +++ b/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx @@ -1,9 +1,14 @@ +import { useState } from "react"; +import { CopyToClipboard } from "react-copy-to-clipboard"; import { TransactionReceipt } from "viem"; +import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; import { displayTxResult } from "~~/components/scaffold-eth"; export const TxReceipt = ( txResult: string | number | bigint | Record | TransactionReceipt | undefined, ) => { + const [txResultCopied, setTxResultCopied] = useState(false); + return (
@@ -11,6 +16,27 @@ export const TxReceipt = ( Transaction Receipt
+ {txResultCopied ? ( +
From 0330e5475a4c18daa39f018f65d3d5527a0a5274 Mon Sep 17 00:00:00 2001 From: Damian Date: Fri, 27 Oct 2023 15:49:56 -0300 Subject: [PATCH 2/2] Move copy tx receipt icon to title left --- .../scaffold-eth/Contract/TxReceipt.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx b/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx index e287e2804..6308ed277 100644 --- a/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx +++ b/packages/nextjs/components/scaffold-eth/Contract/TxReceipt.tsx @@ -10,12 +10,8 @@ export const TxReceipt = ( const [txResultCopied, setTxResultCopied] = useState(false); return ( -
- -
- Transaction Receipt -
-
+
+
{txResultCopied ? ( )} -
{displayTxResult(txResult)}
+
+
+ +
+ Transaction Receipt +
+
+
{displayTxResult(txResult)}
+
);