From 207b3ca5df0aa4c18e7d6fc2a2e06569fc87a593 Mon Sep 17 00:00:00 2001 From: michael1011 Date: Fri, 15 Nov 2024 13:06:32 +0100 Subject: [PATCH 1/2] feat: show when no browser wallet found --- src/components/ConnectWallet.tsx | 19 ++++++++++++++++++- src/components/Warning.tsx | 5 +++++ src/i18n/i18n.ts | 1 + src/pages/Error.tsx | 3 ++- src/pages/RefundStep.tsx | 3 ++- src/style/web3.scss | 8 ++++++++ 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/components/Warning.tsx diff --git a/src/components/ConnectWallet.tsx b/src/components/ConnectWallet.tsx index c392b6f9..5ba25987 100644 --- a/src/components/ConnectWallet.tsx +++ b/src/components/ConnectWallet.tsx @@ -13,11 +13,12 @@ import { import type { EIP6963ProviderInfo } from "../consts/Types"; import { useCreateContext } from "../context/Create"; import { useGlobalContext } from "../context/Global"; -import { useWeb3Signer } from "../context/Web3"; +import { customDerivationPathRdns, useWeb3Signer } from "../context/Web3"; import "../style/web3.scss"; import { formatError } from "../utils/errors"; import { cropString, isMobile } from "../utils/helper"; import HardwareDerivationPaths, { connect } from "./HardwareDerivationPaths"; +import Warning from "./Warning"; const Modal = (props: { derivationPath: string; @@ -32,6 +33,13 @@ const Modal = (props: { const [hardwareProvider, setHardwareProvider] = createSignal(undefined); + const hasBrowserWallet = createMemo(() => { + return Object.values(providers()).some( + (provider) => + !customDerivationPathRdns.includes(provider.info.rdns), + ); + }); + const Provider = (providerProps: { provider: EIP6963ProviderInfo }) => { return (

+ +
+ +
+ +

{t("no_browser_wallet")}

+
+
+
a.info.name diff --git a/src/components/Warning.tsx b/src/components/Warning.tsx new file mode 100644 index 00000000..a17e29b5 --- /dev/null +++ b/src/components/Warning.tsx @@ -0,0 +1,5 @@ +const Warning = () => { + return

⚠️

; +}; + +export default Warning; diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index 6828bc20..e802d0a7 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -220,6 +220,7 @@ const dict = { wallet_connect_failed: "Wallet connection failed: {{ error }}", ledger_open_app_prompt: "Open Ethereum or RSK app", copy_preimage: "Copy preimage", + no_browser_wallet: "No browser wallet detected", }, de: { language: "Deutsch", diff --git a/src/pages/Error.tsx b/src/pages/Error.tsx index c156d0a2..50fcb236 100644 --- a/src/pages/Error.tsx +++ b/src/pages/Error.tsx @@ -1,10 +1,11 @@ +import Warning from "../components/Warning"; import { useGlobalContext } from "../context/Global"; const Error = (props: { error?: string; subline?: string }) => { const { t } = useGlobalContext(); return (
-

⚠️

+

{props.error || t("error")}

{props.subline || t("error_subline")}

diff --git a/src/pages/RefundStep.tsx b/src/pages/RefundStep.tsx index 90e5b735..b3b88a0f 100644 --- a/src/pages/RefundStep.tsx +++ b/src/pages/RefundStep.tsx @@ -3,6 +3,7 @@ import log from "loglevel"; import { For, createResource } from "solid-js"; import DownloadRefund from "../components/DownloadRefund"; +import Warning from "../components/Warning"; import { useGlobalContext } from "../context/Global"; import { usePayContext } from "../context/Pay"; import type { DictKey } from "../i18n/i18n"; @@ -39,7 +40,7 @@ const RefundStep = () => {
-

⚠️

+

{t("backup_refund_skip")}


diff --git a/src/style/web3.scss b/src/style/web3.scss index fd9574ad..753ce51a 100644 --- a/src/style/web3.scss +++ b/src/style/web3.scss @@ -33,3 +33,11 @@ height: 4rem; min-width: 5rem; } + +.no-browser-wallet { + display: flex; + justify-content: center; + align-items: center; + + gap: 1rem; +} From 4e6c15f51de15d8440c4ddd105be2637450a9ef6 Mon Sep 17 00:00:00 2001 From: Kilian <19181985+kilrau@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:57:47 +0100 Subject: [PATCH 2/2] chore: add missing strings --- src/components/ConnectWallet.tsx | 2 -- src/i18n/i18n.ts | 4 ++++ src/style/web3.scss | 6 +----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/ConnectWallet.tsx b/src/components/ConnectWallet.tsx index 5ba25987..94d124e1 100644 --- a/src/components/ConnectWallet.tsx +++ b/src/components/ConnectWallet.tsx @@ -18,7 +18,6 @@ import "../style/web3.scss"; import { formatError } from "../utils/errors"; import { cropString, isMobile } from "../utils/helper"; import HardwareDerivationPaths, { connect } from "./HardwareDerivationPaths"; -import Warning from "./Warning"; const Modal = (props: { derivationPath: string; @@ -102,7 +101,6 @@ const Modal = (props: {
-

{t("no_browser_wallet")}


diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index e802d0a7..86a3228d 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -453,6 +453,7 @@ const dict = { "Verbindung zu Wallet fehlgeschlagen: {{ error }}", ledger_open_app_prompt: "Ethereum oder RSK app öffnen", copy_preimage: "Preimage Kopieren", + no_browser_wallet: "Kein Browser Wallet gefunden", }, es: { language: "Español", @@ -683,6 +684,7 @@ const dict = { wallet_connect_failed: "Fallo en la conexión del monedero: {{ error }}", ledger_open_app_prompt: "Abrir aplicación Ethereum o RSK", copy_preimage: "Copiar preimagen", + no_browser_wallet: "No se detectó monedero en el navegador", }, zh: { language: "中文", @@ -886,6 +888,7 @@ const dict = { wallet_connect_failed: "钱包连接失败:{{ error }}", ledger_open_app_prompt: "打开以太坊或 RSK 应用", copy_preimage: "复制预图像", + no_browser_wallet: "未检测到浏览器钱包", }, ja: { language: "日本語", @@ -1113,6 +1116,7 @@ const dict = { wallet_connect_failed: "ウォレット接続の失敗: {{ error }}", ledger_open_app_prompt: "イーサリアムもしくはRSKのアプリを開く", copy_preimage: "コピー前画像", + no_browser_wallet: "ブラウザのウォレットが検出されない", }, }; diff --git a/src/style/web3.scss b/src/style/web3.scss index 753ce51a..1a13090d 100644 --- a/src/style/web3.scss +++ b/src/style/web3.scss @@ -35,9 +35,5 @@ } .no-browser-wallet { - display: flex; - justify-content: center; - align-items: center; - - gap: 1rem; + margin: 1rem; }