diff --git a/src/components/LatestTransactions/LatestTransactions.jsx b/src/components/LatestTransactions/LatestTransactions.jsx index f0afcba..d7c5acb 100644 --- a/src/components/LatestTransactions/LatestTransactions.jsx +++ b/src/components/LatestTransactions/LatestTransactions.jsx @@ -12,10 +12,9 @@ const LatestTransactions = () => { const toast = useToast() const { colorMode} = useColorMode(); - const { transactions } = useContext(GlobalStateContext); - - - function copyToClipboard(text) { + const { transactions } = useContext(GlobalStateContext); + + function copyToClipboard(text) { navigator.clipboard .writeText(text) .then(() => { @@ -63,19 +62,19 @@ const LatestTransactions = () => { - {transaction.description} + {transaction.description} Sender : - {transaction.sender} + {transaction.sender} copyToClipboard(transaction.sender)} /> Receiver : - {transaction.receiver} + {transaction.receiver} copyToClipboard(transaction.receiver)} /> @@ -90,7 +89,7 @@ const LatestTransactions = () => { Smart contract ID dd : - {transaction.contract} + {transaction.contract} @@ -115,7 +114,7 @@ const LatestTransactions = () => { Transaction type : - {transaction.transactionType} + {transaction.transactionType} diff --git a/src/components/NavBar/NavBar.jsx b/src/components/NavBar/NavBar.jsx index d14c209..d2a6e12 100644 --- a/src/components/NavBar/NavBar.jsx +++ b/src/components/NavBar/NavBar.jsx @@ -74,7 +74,7 @@ const NavBar = () => { ({ fontSize: "14px", fontWeight: "400", diff --git a/src/index.css b/src/index.css index 4271550..5e9fa8d 100644 --- a/src/index.css +++ b/src/index.css @@ -19,7 +19,7 @@ } a { - font-weight: 500; + /* font-weight: 500; */ color: #646cff; text-decoration: inherit; } diff --git a/src/pages/DidInfo.jsx b/src/pages/DidInfo.jsx index 736764a..0281d44 100644 --- a/src/pages/DidInfo.jsx +++ b/src/pages/DidInfo.jsx @@ -6,15 +6,36 @@ import { HStack, Text, useColorMode, + useToast, } from "@chakra-ui/react"; import React from "react"; import { MdContentCopy} from "react-icons/md"; import { Link } from "react-router-dom"; import RelatedTransactions from "../components/RelatedTransactions/RelatedTransactions"; import bannerImage from "../assets/images/bannerImg.png"; +import ToastBox from "../components/ToastBox"; const DidInfo = () => { const { colorMode } = useColorMode(); + + const toast = useToast() + + function copyToClipboard(text) { + navigator.clipboard + .writeText(text) + .then(() => { + // console.log('Text copied to clipboard'); + // alert('Text copied to clipboard'); + toast({ + render: () => ( + + ), + }); + }) + .catch((err) => { + console.error("Failed to copy text: ", err); + }); + } return ( <> diff --git a/src/pages/MainNet.jsx b/src/pages/MainNet.jsx index bbd11a6..d8850a9 100644 --- a/src/pages/MainNet.jsx +++ b/src/pages/MainNet.jsx @@ -1,15 +1,36 @@ -import { Box, Container, Grid, GridItem, Heading, HStack, Select, Text, useColorMode } from "@chakra-ui/react"; +import { Box, Container, Grid, GridItem, Heading, HStack, Select, Text, useColorMode, useToast } from "@chakra-ui/react"; import React, { useContext } from "react"; import bannerImage from "../assets/images/bannerImg.png"; import GlobalStateContext from "../Contexts/GlobalStateContext"; import Pagination from "../components/Pagination"; -import { MdOutlineErrorOutline } from "react-icons/md"; +import { MdContentCopy, MdOutlineErrorOutline } from "react-icons/md"; +import ToastBox from "../components/ToastBox"; +import { Link } from "react-router-dom"; const MainNet = () => { const { overview } = useContext(GlobalStateContext); const { colorMode} = useColorMode(); + const toast = useToast() + + function copyToClipboard(text) { + navigator.clipboard + .writeText(text) + .then(() => { + // console.log('Text copied to clipboard'); + // alert('Text copied to clipboard'); + toast({ + render: () => ( + + ), + }); + }) + .catch((err) => { + console.error("Failed to copy text: ", err); + }); + } + return ( { mb={2} color={colorMode === "light" ? "#230A79" : "#B09AFF"} > - {transaction.description} + {transaction.description} Sender : - - {transaction.sender} - + + {transaction.sender} + + copyToClipboard(transaction.sender)} /> + Receiver : - - {transaction.receiver} - + + {transaction.receiver} + copyToClipboard(transaction.receiver)} /> + { mb={2} color={colorMode === "light" ? "#7B7B7B" : "#E8E8E8"} > - Smart contract ID dd : + Smart contract ID dd: - {transaction.contract} + {transaction.contract} @@ -166,7 +190,7 @@ const MainNet = () => { - {transaction.subnetID} + {transaction.subnetID} diff --git a/src/pages/SmartContract.jsx b/src/pages/SmartContract.jsx index e1c6cb8..8e4c4d9 100644 --- a/src/pages/SmartContract.jsx +++ b/src/pages/SmartContract.jsx @@ -6,15 +6,36 @@ import { HStack, Text, useColorMode, + useToast, } from "@chakra-ui/react"; import React from "react"; import { MdContentCopy} from "react-icons/md"; import { Link } from "react-router-dom"; import RelatedTransactions from "../components/RelatedTransactions/RelatedTransactions"; import bannerImage from "../assets/images/bannerImg.png"; +import ToastBox from "../components/ToastBox"; const Transaction = () => { const { colorMode } = useColorMode(); + + const toast = useToast() + + function copyToClipboard(text) { + navigator.clipboard + .writeText(text) + .then(() => { + // console.log('Text copied to clipboard'); + // alert('Text copied to clipboard'); + toast({ + render: () => ( + + ), + }); + }) + .catch((err) => { + console.error("Failed to copy text: ", err); + }); + } return ( <> diff --git a/src/pages/Subnet.jsx b/src/pages/Subnet.jsx index 964da80..6b46db4 100644 --- a/src/pages/Subnet.jsx +++ b/src/pages/Subnet.jsx @@ -1,16 +1,36 @@ -import { Box, Container, Grid, GridItem, Heading, HStack, Select, Text, useColorMode } from "@chakra-ui/react"; +import { Box, Container, Grid, GridItem, Heading, HStack, Select, Text, useColorMode, useToast } from "@chakra-ui/react"; import React, { useContext } from "react"; import { Link } from "react-router-dom"; import LatestTransactions from "../components/LatestTransactions/LatestTransactions"; import GlobalStateContext from "../Contexts/GlobalStateContext"; import Pagination from "../components/Pagination"; -import { MdOutlineErrorOutline } from "react-icons/md"; +import { MdContentCopy, MdOutlineErrorOutline } from "react-icons/md"; import bannerImage from "../assets/images/bannerImg.png"; +import ToastBox from "../components/ToastBox"; const Subnet = () => { const { overview } = useContext(GlobalStateContext); - const { colorMode, toggleColorMode } = useColorMode(); + const { colorMode} = useColorMode(); + + const toast = useToast() + + function copyToClipboard(text) { + navigator.clipboard + .writeText(text) + .then(() => { + // console.log('Text copied to clipboard'); + // alert('Text copied to clipboard'); + toast({ + render: () => ( + + ), + }); + }) + .catch((err) => { + console.error("Failed to copy text: ", err); + }); + } return ( @@ -76,23 +96,26 @@ const Subnet = () => { mb={2} color={colorMode === "light" ? "#230A79" : "#B09AFF"} > - {transaction.description} + {transaction.description} Sender : - - {transaction.sender} - + + {transaction.sender} + + copyToClipboard(transaction.sender)} /> + Receiver : - - {transaction.receiver} - + + {transaction.receiver} + copyToClipboard(transaction.receiver)} /> + { - {transaction.contract} + {transaction.contract} @@ -168,7 +191,7 @@ const Subnet = () => { - {transaction.subnetID} + {transaction.subnetID} diff --git a/src/pages/SubnetInner.jsx b/src/pages/SubnetInner.jsx index ca73909..29b9c7a 100644 --- a/src/pages/SubnetInner.jsx +++ b/src/pages/SubnetInner.jsx @@ -1,4 +1,4 @@ -import { Box, Container, Grid, GridItem, Heading, HStack, Link, Select, Text, useColorMode } from "@chakra-ui/react"; +import { Box, Container, Grid, GridItem, Heading, HStack, Link, Select, Text, useColorMode, useToast } from "@chakra-ui/react"; import React, { useContext } from "react"; import GlobalStateContext from "../Contexts/GlobalStateContext"; import Pagination from "../components/Pagination"; @@ -11,6 +11,8 @@ const SubnetInner = () => { const { overview } = useContext(GlobalStateContext); const { colorMode} = useColorMode(); + const toast = useToast() + function copyToClipboard(text) { navigator.clipboard .writeText(text) @@ -98,19 +100,19 @@ const SubnetInner = () => { Sender : - - {transaction.sender} - copyToClipboard(transaction.sender)} /> - + + {transaction.sender} + copyToClipboard(transaction.sender)} /> + Receiver : - - {transaction.receiver} - copyToClipboard(transaction.receiver)} /> - + + {transaction.receiver} + copyToClipboard(transaction.receiver)} /> + { const { colorMode } = useColorMode(); + const toast = useToast() + + function copyToClipboard(text) { + navigator.clipboard + .writeText(text) + .then(() => { + // console.log('Text copied to clipboard'); + // alert('Text copied to clipboard'); + toast({ + render: () => ( + + ), + }); + }) + .catch((err) => { + console.error("Failed to copy text: ", err); + }); + } + return ( <> , }, { - path: "/mainNet", + path: "/main-net", element: , }, {