From 9cf28d4d0334bf04fcdaeffcf8bda0af97113ca3 Mon Sep 17 00:00:00 2001 From: lanford33 Date: Tue, 3 Oct 2023 23:02:54 +0800 Subject: [PATCH] feat: show address qr code --- components/common/Layout.js | 103 ++++++++++++++++++++++-------------- package.json | 1 + yarn.lock | 5 ++ 3 files changed, 69 insertions(+), 40 deletions(-) diff --git a/components/common/Layout.js b/components/common/Layout.js index c78fd2d..3430da1 100644 --- a/components/common/Layout.js +++ b/components/common/Layout.js @@ -23,6 +23,7 @@ import { StarIcon as SolidStar } from "@heroicons/react/solid" import { getBookmark } from "../../flow/bookmark_scripts"; import { removeAccountBookmark } from "../../flow/bookmark_transactions"; import NoteEditorModal from "../bookmark/NoteEditorModal"; +import { QRCodeCanvas } from "qrcode.react"; const accountBookmarkFetcher = async (funcName, owner, target) => { if (publicConfig.chainEnv == "emulator") { @@ -137,54 +138,76 @@ export default function Layout({ children }) { return ( <>
-
+
-
- -
- - { - await navigator.clipboard.writeText(account) - setShowBasicNotification(true) - setBasicNotificationContent({ type: "information", title: "Copied!", detail: null }) - }} /> - {showStarIcon(bookmark)} -
- { - bookmark ? +
+
+
+
- -
{bookmark.note}
+ + { + await navigator.clipboard.writeText(account) + setShowBasicNotification(true) + setBasicNotificationContent({ type: "information", title: "Copied!", detail: null }) + }} /> + {showStarIcon(bookmark)} +
+ { + bookmark ? +
+ +
{bookmark.note}
+
+ : null + } +
+ + {currentDefaultDomains && currentDefaultDomains.domains.length > 0 ? +
+ +
{ + currentDefaultDomains.domains.map((domain, index) => { + return ( + + ) + })} +
: null - } + } +
+
+ +
- {currentDefaultDomains && currentDefaultDomains.domains.length > 0 ? -
- -
{ - currentDefaultDomains.domains.map((domain, index) => { - return ( - - ) - })} -
-
- : null - }
{children} diff --git a/package.json b/package.json index ca6b08f..deedf91 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "multiformats": "^10.0.2", "next": "13.0.3", "postcss": "^8.4.19", + "qrcode.react": "^3.1.0", "react": "18.2.0", "react-dom": "18.2.0", "react-syntax-highlighter": "^15.5.0", diff --git a/yarn.lock b/yarn.lock index da4c753..93fcbd0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,6 +1941,11 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +qrcode.react@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8" + integrity sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q== + queue-microtask@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.1.2.tgz#139bf8186db0c545017ec66c2664ac646d5c571e"