From 590551fa924af569a174bffb8cf8fa5bd3dec01e Mon Sep 17 00:00:00 2001 From: Ilja Date: Tue, 22 Feb 2022 13:50:08 +0200 Subject: [PATCH] Add ability to copy account address --- .DS_Store | Bin 0 -> 6148 bytes wallets/.DS_Store | Bin 0 -> 6148 bytes wallets/react-wallet-v2/package.json | 6 ++-- .../public/icons/checkmark-icon.svg | 3 ++ .../public/icons/copy-icon.svg | 4 +++ .../src/components/AccountCard.tsx | 27 +++++++++++++++++- wallets/react-wallet-v2/yarn.lock | 24 ++++++++-------- 7 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 .DS_Store create mode 100644 wallets/.DS_Store create mode 100644 wallets/react-wallet-v2/public/icons/checkmark-icon.svg create mode 100644 wallets/react-wallet-v2/public/icons/copy-icon.svg diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2a41f050f747665fde977308ee6b4d932ee283b2 GIT binary patch literal 6148 zcmeHK!EVz)5S>la##V)t14z9fS>jrSKmmccm^3}~z@p0I2 zP;rjqTz^h-onX!h#r}T<_}z7BK&O;ZwfX+kcdQMrjF|`7rj%lu;VL&H=~XMzrxQAY zcTBH=13II$#rV-;^r%Me9M_bpc7ApL@6kzJ&fM?rBAMk`Sq+Dms5CckjW&mnW02`B|aQje?}`KQVU4;Tl-$ zmImLVd6Dbl6f0}iI$BT^5Cuemns-uX@o5bhyu4z0p1@1G{(?jW6^9K=u8O! z?80pfWAo_`4A=n-9X1x>fhkJ`TB>p-hH{mIvUIG6F21p7>7>k^k;mOxxe7(O!b1fn zoK$F0dQm_W*i>N4PWycRAN{%h-z3RQ6c7b&l>(|ej>aQAk~>?kJsh940oo@tHjZm7 m{-R)Dj$*{}QM`v{4E}%zz|di15gwR)2pAcp69xXM0zUz8?tFv* literal 0 HcmV?d00001 diff --git a/wallets/.DS_Store b/wallets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..99a39a896d6cc59696ac78084a5d6743294ac727 GIT binary patch literal 6148 zcmeHK!EVz)5S>i}brd0T0I5eyy{2tQ0D-ue&>niND>$@OuoDX`jJHah`Vd9(8GeW_ z>F=~}b~jb4fO2a?HDk@b@$Agn`_|g^5RvLnN3V!lMC3skYYjAi5$j&R?e$B{-34_IGd+wm9V3!IlaJ8dD&JlGsl4X;y_&p{ zFdz&(Fax|l_)x~cVP(;59cWAm0Ib7p1UCO9a*ppXa9CMH4@B8ipiNb-#85UJe&59f z4l9c`os=s+lzXyr6^b%X$N0VpCly$fRu~Wl?lQo&AEd?S|G~fOe-k8)Fdz&(P6kwc zKiuzQZtiSdnkApLKJ+V;h2tuVHz_d8QH)qVinpLf;P=@81`aEW@Id58z|bI#FmSI7 FTm!w0U(Wyl literal 0 HcmV?d00001 diff --git a/wallets/react-wallet-v2/package.json b/wallets/react-wallet-v2/package.json index 36b8131..63e28e5 100644 --- a/wallets/react-wallet-v2/package.json +++ b/wallets/react-wallet-v2/package.json @@ -16,18 +16,18 @@ "react": "17.0.2", "react-dom": "17.0.2", "react-qr-reader-es6": "2.2.1-2", - "framer-motion": "6.2.6", + "framer-motion": "6.2.7", "ethers": "5.5.4", "valtio": "1.3.0", "react-code-blocks": "0.0.9-0" }, "devDependencies": { "@walletconnect/types": "2.0.0-beta.22", - "@types/node": "17.0.18", + "@types/node": "17.0.19", "@types/react": "17.0.39", "eslint": "8.9.0", "eslint-config-next": "12.1.0", - "eslint-config-prettier": "8.3.0", + "eslint-config-prettier": "8.4.0", "prettier": "2.5.1", "typescript": "4.5.5" } diff --git a/wallets/react-wallet-v2/public/icons/checkmark-icon.svg b/wallets/react-wallet-v2/public/icons/checkmark-icon.svg new file mode 100644 index 0000000..31822d1 --- /dev/null +++ b/wallets/react-wallet-v2/public/icons/checkmark-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/wallets/react-wallet-v2/public/icons/copy-icon.svg b/wallets/react-wallet-v2/public/icons/copy-icon.svg new file mode 100644 index 0000000..76253a9 --- /dev/null +++ b/wallets/react-wallet-v2/public/icons/copy-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/wallets/react-wallet-v2/src/components/AccountCard.tsx b/wallets/react-wallet-v2/src/components/AccountCard.tsx index 0350aff..180c499 100644 --- a/wallets/react-wallet-v2/src/components/AccountCard.tsx +++ b/wallets/react-wallet-v2/src/components/AccountCard.tsx @@ -1,5 +1,7 @@ import { truncate } from '@/utils/HelperUtil' -import { Avatar, Card, Text } from '@nextui-org/react' +import { Avatar, Button, Card, Text, Tooltip } from '@nextui-org/react' +import Image from 'next/image' +import { useState } from 'react' interface Props { name: string @@ -9,6 +11,14 @@ interface Props { } export default function AccountCard({ name, logo, rgb, address }: Props) { + const [copied, setCopied] = useState(false) + + function onCopy() { + navigator?.clipboard?.writeText(address) + setCopied(true) + setTimeout(() => setCopied(false), 1000) + } + return ( + + + + ) diff --git a/wallets/react-wallet-v2/yarn.lock b/wallets/react-wallet-v2/yarn.lock index d707d1a..2deb539 100644 --- a/wallets/react-wallet-v2/yarn.lock +++ b/wallets/react-wallet-v2/yarn.lock @@ -805,10 +805,10 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/node@17.0.18": - version "17.0.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074" - integrity sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA== +"@types/node@17.0.19": + version "17.0.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.19.tgz#726171367f404bfbe8512ba608a09ebad810c7e6" + integrity sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA== "@types/prop-types@*": version "15.7.4" @@ -1626,10 +1626,10 @@ eslint-config-next@12.1.0: eslint-plugin-react "^7.27.0" eslint-plugin-react-hooks "^4.3.0" -eslint-config-prettier@8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" - integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== +eslint-config-prettier@8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.4.0.tgz#8e6d17c7436649e98c4c2189868562921ef563de" + integrity sha512-CFotdUcMY18nGRo5KGsnNxpznzhkopOcOo0InID+sgQssPrzjvsyKZPvOgymTFeHrFuC3Tzdf2YndhXtULK9Iw== eslint-import-resolver-node@^0.3.4, eslint-import-resolver-node@^0.3.6: version "0.3.6" @@ -1964,10 +1964,10 @@ format@^0.2.0: resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" integrity sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs= -framer-motion@6.2.6: - version "6.2.6" - resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-6.2.6.tgz#75277b4944a1234beaf7453da19028bbf4f75cce" - integrity sha512-7eGav5MxEEzDHozQTDY6+psTIOw2i2kM1QVoJOC3bCp9VOKoo+mKR5n7aT5JPh7ksEKFYJYz0GJDils/9S+oLA== +framer-motion@6.2.7: + version "6.2.7" + resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-6.2.7.tgz#14e71ca933b63dc85327b3ea9ba2f1564f116dd3" + integrity sha512-RExmZCFpJ3OCakoXmZz8iW8ZI5MoaHmVadydetvTSrNaKmZ7ZC/JDQpNyw1NoDG+fchRGP86lXoiTFSQuin+Cg== dependencies: framesync "6.0.1" hey-listen "^1.0.8"