From f7dccde7467eb0be6087069a820905efe1fc6fea Mon Sep 17 00:00:00 2001 From: codytseng Date: Mon, 9 Jun 2025 21:55:42 +0800 Subject: [PATCH] fix: QR code not scannable in dark mode --- .../AccountManager/NostrConnectionLogin.tsx | 32 ++++++++++--------- src/components/QrCodePopover/index.tsx | 13 ++++++-- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/components/AccountManager/NostrConnectionLogin.tsx b/src/components/AccountManager/NostrConnectionLogin.tsx index 487be07..a1f07f6 100644 --- a/src/components/AccountManager/NostrConnectionLogin.tsx +++ b/src/components/AccountManager/NostrConnectionLogin.tsx @@ -48,12 +48,12 @@ export default function NostrConnectLogin({ relays: DEFAULT_NOSTRCONNECT_RELAY, secret: Math.random().toString(36).substring(7), name: document.location.host, - url: document.location.origin, + url: document.location.origin } const newConnectionString = createNostrConnectURI(newMeta) return { privKey: newPrivKey, - connectionString: newConnectionString, + connectionString: newConnectionString } }) @@ -83,17 +83,18 @@ export default function NostrConnectLogin({ }, []) useEffect(() => { - if (!loginDetails.privKey || !loginDetails.connectionString) return; + if (!loginDetails.privKey || !loginDetails.connectionString) return setNostrConnectionErrMsg(null) nostrConnectionLogin(loginDetails.privKey, loginDetails.connectionString) .then(() => onLoginSuccess()) .catch((err) => { - console.error("NostrConnectionLogin Error:", err) - setNostrConnectionErrMsg(err.message ? `${err.message}. Please reload.` : 'Connection failed. Please reload.') + console.error('NostrConnectionLogin Error:', err) + setNostrConnectionErrMsg( + err.message ? `${err.message}. Please reload.` : 'Connection failed. Please reload.' + ) }) }, [loginDetails, nostrConnectionLogin, onLoginSuccess]) - const copyConnectionString = async () => { if (!loginDetails.connectionString) return @@ -106,19 +107,22 @@ export default function NostrConnectLogin({ <>
- + {nostrConnectionErrMsg && ( -
- {nostrConnectionErrMsg} -
+
{nostrConnectionErrMsg}
)}
0 ? `${Math.max(150, Math.min(qrCodeSize, 320))}px` : 'auto', + width: qrCodeSize > 0 ? `${Math.max(150, Math.min(qrCodeSize, 320))}px` : 'auto' }} onClick={copyConnectionString} role="button" @@ -127,9 +131,7 @@ export default function NostrConnectLogin({
{loginDetails.connectionString}
-
- {copied ? : } -
+
{copied ? : }
@@ -159,4 +161,4 @@ export default function NostrConnectLogin({ ) -} \ No newline at end of file +} diff --git a/src/components/QrCodePopover/index.tsx b/src/components/QrCodePopover/index.tsx index ccbdc92..a388693 100644 --- a/src/components/QrCodePopover/index.tsx +++ b/src/components/QrCodePopover/index.tsx @@ -21,7 +21,12 @@ export default function QrCodePopover({ pubkey }: { pubkey: string }) {
- +
@@ -36,7 +41,11 @@ export default function QrCodePopover({ pubkey }: { pubkey: string }) { - + )