From adfb82185752d39d91ec00f43c4b9fd4c7ac8c24 Mon Sep 17 00:00:00 2001 From: EdSDR Date: Fri, 18 Oct 2024 18:33:41 -0300 Subject: [PATCH] fix: Copy validator address to clipboard in tutorial page Refactor the tutorial page to use the `handleCopyClick` function to copy the validator address to the clipboard. This ensures that the address is copied successfully and displays a success toast message. This improves the user experience and makes it easier for users to copy the validator address. --- .../src/app/(expanded-pages)/tutorial/page.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/commune-validator/src/app/(expanded-pages)/tutorial/page.tsx b/apps/commune-validator/src/app/(expanded-pages)/tutorial/page.tsx index b039a56..ac920b0 100644 --- a/apps/commune-validator/src/app/(expanded-pages)/tutorial/page.tsx +++ b/apps/commune-validator/src/app/(expanded-pages)/tutorial/page.tsx @@ -11,9 +11,15 @@ import { } from "@heroicons/react/24/outline"; import { useCommune } from "@commune-ts/providers/use-commune"; -import { Button, CopyButton } from "@commune-ts/ui"; +import { toast } from "@commune-ts/providers/use-toast"; +import { Button } from "@commune-ts/ui"; import { copyToClipboard } from "@commune-ts/utils"; +function handleCopyClick(text: string) { + copyToClipboard(text); + toast.success("Copied validator address to clipboard"); +} + export const tutorialData = { "1": { icon: , @@ -35,7 +41,7 @@ export const tutorialData = { variant="link" className="px-1 text-base text-green-500" onClick={() => - copyToClipboard("5Hgik8Kf7nq5VBtW41psbpXu1kinXpqRs4AHotPe6u1w6QX2") + handleCopyClick("5Hgik8Kf7nq5VBtW41psbpXu1kinXpqRs4AHotPe6u1w6QX2") } > Copy Validator Address