From 2d46b00e9e927198032727288580c2b4dafd0130 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Thu, 25 Apr 2024 19:37:30 +0530 Subject: [PATCH 01/12] feat: no limit warning --- src/app/screens/Home/DefaultView/index.tsx | 26 +++++-- src/common/lib/api.ts | 7 +- .../background-script/connectors/alby.ts | 68 +++++++++++++++++++ 3 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index a28fa0abc9..82556ef06a 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -5,6 +5,7 @@ import { PopiconsArrowDownLine, PopiconsArrowRightLine, PopiconsBulbLine, + PopiconsCircleExclamationLine, PopiconsKeyLine, } from "@popicons/react"; import dayjs from "dayjs"; @@ -21,7 +22,7 @@ import toast from "~/app/components/Toast"; import { useAccount } from "~/app/context/AccountContext"; import { useTransactions } from "~/app/hooks/useTransactions"; import { PublisherLnData } from "~/app/screens/Home/PublisherLnData"; -import api, { GetAccountRes } from "~/common/lib/api"; +import api, { AccountInfoRes, GetAccountRes } from "~/common/lib/api"; import msg from "~/common/lib/msg"; import utils from "~/common/lib/utils"; import type { Battery } from "~/types"; @@ -48,6 +49,7 @@ const DefaultView: FC = (props) => { const [isBlockedUrl, setIsBlockedUrl] = useState(false); const [currentAccount, setCurrentAccount] = useState(); + const [accountInfo, setAccountInfo] = useState(); const { transactions, isLoadingTransactions, loadTransactions } = useTransactions(); @@ -76,13 +78,15 @@ const DefaultView: FC = (props) => { (async () => { try { const account = await api.getAccount(); + const accountInfo = await api.getAccountInfo(); + setAccountInfo(accountInfo); setCurrentAccount(account); } catch (e) { console.error(e); if (e instanceof Error) toast.error(`Error: ${e.message}`); } })(); - }, []); + }, [account]); const unblock = async () => { try { @@ -120,7 +124,7 @@ const DefaultView: FC = (props) => { )} -
+
{isBlockedUrl && (
@@ -139,7 +143,21 @@ const DefaultView: FC = (props) => {
)} - + {accountInfo && accountInfo.info.limit ? ( + +
+
+ +
+ + Your Alby Account needs a wallet. Connect a wallet to your + account on getalby.com + +
+
+ ) : ( + + )} {(accountLoading || lightningAddress) && (
client.accountInformation({}) ); + + const limits = await this.getLimit(); const returnValue = { data: { ...info, + limit: limits, alias: "🐝 getalby.com", }, }; @@ -406,4 +428,50 @@ export default class Alby implements Connector { throw new Error("Invalid token"); } } + + async getLimit() { + const url = "https://api.getalby.com/internal/users"; + + const requestOptions = { + method: "GET", + headers: { + "Content-Type": "application/json", + ...(await this._authUser?.getAuthHeader()), + "User-Agent": `lightning-browser-extension:${process.env.VERSION}`, + "X-User-Agent": `lightning-browser-extension:${process.env.VERSION}`, + }, + }; + + try { + const details = await this._genericRequest( + url, + requestOptions + ); + const limits = details.limits; + const custodial = details.custodial; + + const hasZeroLimit = Object.values(limits).some((limit) => limit === 0); + + if (custodial && hasZeroLimit) return true; + return false; + } catch (error) { + console.error("Error fetching limits:", error); + throw error; + } + } + + private async _genericRequest( + url: RequestInfo, + init: RequestInit + ): Promise { + const res = await fetch(url, init); + + if (!res.ok) { + throw new Error(`HTTP error! status: ${res.status}`); + } + + const data: T = await res.json(); + + return data; + } } From 6eb788d9b10dacf23eeee145a4306e00a9912fd0 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Fri, 26 Apr 2024 12:20:02 +0530 Subject: [PATCH 02/12] feat: improve loading time --- src/app/context/AccountContext.tsx | 1 + src/app/screens/Home/DefaultView/index.tsx | 10 ++++------ src/common/lib/api.ts | 1 + src/types.ts | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/context/AccountContext.tsx b/src/app/context/AccountContext.tsx index 71c64b2675..29d2e06bb8 100644 --- a/src/app/context/AccountContext.tsx +++ b/src/app/context/AccountContext.tsx @@ -22,6 +22,7 @@ interface AccountContextType { avatarUrl?: AccountInfo["avatarUrl"]; connectorType?: AccountInfo["connectorType"]; lightningAddress?: AccountInfo["lightningAddress"]; + limit?: AccountInfo["limit"]; } | null; balancesDecorated: { fiatBalance: string; diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index 82556ef06a..c6be754e8a 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -22,7 +22,7 @@ import toast from "~/app/components/Toast"; import { useAccount } from "~/app/context/AccountContext"; import { useTransactions } from "~/app/hooks/useTransactions"; import { PublisherLnData } from "~/app/screens/Home/PublisherLnData"; -import api, { AccountInfoRes, GetAccountRes } from "~/common/lib/api"; +import api, { GetAccountRes } from "~/common/lib/api"; import msg from "~/common/lib/msg"; import utils from "~/common/lib/utils"; import type { Battery } from "~/types"; @@ -46,10 +46,10 @@ const DefaultView: FC = (props) => { const { account, accountLoading } = useAccount(); const lightningAddress = account?.lightningAddress || ""; + const limit = account?.limit || false; const [isBlockedUrl, setIsBlockedUrl] = useState(false); const [currentAccount, setCurrentAccount] = useState(); - const [accountInfo, setAccountInfo] = useState(); const { transactions, isLoadingTransactions, loadTransactions } = useTransactions(); @@ -78,15 +78,13 @@ const DefaultView: FC = (props) => { (async () => { try { const account = await api.getAccount(); - const accountInfo = await api.getAccountInfo(); - setAccountInfo(accountInfo); setCurrentAccount(account); } catch (e) { console.error(e); if (e instanceof Error) toast.error(`Error: ${e.message}`); } })(); - }, [account]); + }, []); const unblock = async () => { try { @@ -143,7 +141,7 @@ const DefaultView: FC = (props) => {
)} - {accountInfo && accountInfo.info.limit ? ( + {accountLoading || limit ? (
diff --git a/src/common/lib/api.ts b/src/common/lib/api.ts index e93765851d..80890b0f22 100644 --- a/src/common/lib/api.ts +++ b/src/common/lib/api.ts @@ -119,6 +119,7 @@ export const swrGetAccountInfo = async ( currency: currency || "BTC", // set default currency for every account avatarUrl, lightningAddress: response.info.lightning_address, + limit: response.info.limit, }; storeAccounts({ ...accountsCache, diff --git a/src/types.ts b/src/types.ts index 2062a20270..272d143c41 100644 --- a/src/types.ts +++ b/src/types.ts @@ -35,6 +35,7 @@ export interface Accounts { } export interface NodeInfo { + limit: NodeInfo | undefined; node: WebLNNode; } export interface AccountInfo { @@ -46,6 +47,7 @@ export interface AccountInfo { currency: ACCOUNT_CURRENCIES; avatarUrl?: string; lightningAddress?: string; + limit?: boolean; } export interface MetaData { From 38637acd4efc45f96eea800e34b96a1879599f09 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Fri, 26 Apr 2024 12:37:50 +0530 Subject: [PATCH 03/12] fix: allow caching only when limit value don't change --- src/extension/background-script/connectors/alby.ts | 11 ++++++----- src/types.ts | 13 +++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index 523d5dad1c..f5102edfd5 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -2,7 +2,6 @@ import { auth, Client } from "@getalby/sdk"; import { CreateSwapParams, CreateSwapResponse, - GetAccountInformationResponse, Invoice, RequestOptions, SwapInfoResponse, @@ -10,7 +9,7 @@ import { } from "@getalby/sdk/dist/types"; import browser from "webextension-polyfill"; import { decryptData, encryptData } from "~/common/lib/crypto"; -import { Account, OAuthToken } from "~/types"; +import { Account, GetAccountInformationResponse, OAuthToken } from "~/types"; import state from "../state"; import Connector, { CheckPaymentArgs, @@ -141,7 +140,10 @@ export default class Alby implements Connector { const cacheValue = this._cache.get(cacheKey) as GetInfoResponse< WebLNNode & GetAccountInformationResponse >; - if (cacheValue) { + + const limit = await this.getLimit(); + + if (cacheValue && cacheValue.data.limit === limit) { return cacheValue; } @@ -150,11 +152,10 @@ export default class Alby implements Connector { client.accountInformation({}) ); - const limits = await this.getLimit(); const returnValue = { data: { ...info, - limit: limits, + limit: limit, alias: "🐝 getalby.com", }, }; diff --git a/src/types.ts b/src/types.ts index 272d143c41..3ae6ef5161 100644 --- a/src/types.ts +++ b/src/types.ts @@ -50,6 +50,19 @@ export interface AccountInfo { limit?: boolean; } +export type GetAccountInformationResponse = { + identifier: string; + email: string; + name?: string; + avatar?: string; + keysend_custom_key: string; + keysend_custom_value: string; + keysend_pubkey: string; + lightning_address?: string; + nostr_pubkey?: string; + limit?: boolean; +}; + export interface MetaData { title?: string; description?: string; From bb747675ddb5c4e7a7dbe9076a35917dca9bf3af Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Fri, 26 Apr 2024 14:00:11 +0530 Subject: [PATCH 04/12] fix: types --- src/types.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index 3ae6ef5161..7a3fe37b01 100644 --- a/src/types.ts +++ b/src/types.ts @@ -35,7 +35,6 @@ export interface Accounts { } export interface NodeInfo { - limit: NodeInfo | undefined; node: WebLNNode; } export interface AccountInfo { From 211aa0484f4d350f61ae741b6f5ddfedc563ce2e Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Fri, 26 Apr 2024 14:15:12 +0530 Subject: [PATCH 05/12] fix: ui cleanup --- src/app/screens/Home/DefaultView/index.tsx | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index c6be754e8a..f007fb38c5 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -142,17 +142,23 @@ const DefaultView: FC = (props) => { )} {accountLoading || limit ? ( - -
-
- -
- - Your Alby Account needs a wallet. Connect a wallet to your - account on getalby.com - +
) : ( )} From 4f6f53df6ec40a4466abfb39a31f8a99cf52a47b Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Mon, 29 Apr 2024 14:41:56 +0530 Subject: [PATCH 06/12] feat: use new node_required data --- src/app/context/AccountContext.tsx | 2 +- src/app/screens/Home/DefaultView/index.tsx | 4 ++-- src/common/lib/api.ts | 4 ++-- src/extension/background-script/connectors/alby.ts | 14 ++++++-------- src/types.ts | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/app/context/AccountContext.tsx b/src/app/context/AccountContext.tsx index 29d2e06bb8..d187faa4bf 100644 --- a/src/app/context/AccountContext.tsx +++ b/src/app/context/AccountContext.tsx @@ -22,7 +22,7 @@ interface AccountContextType { avatarUrl?: AccountInfo["avatarUrl"]; connectorType?: AccountInfo["connectorType"]; lightningAddress?: AccountInfo["lightningAddress"]; - limit?: AccountInfo["limit"]; + nodeRequired?: AccountInfo["nodeRequired"]; } | null; balancesDecorated: { fiatBalance: string; diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index f007fb38c5..4c2dab81a0 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -46,7 +46,7 @@ const DefaultView: FC = (props) => { const { account, accountLoading } = useAccount(); const lightningAddress = account?.lightningAddress || ""; - const limit = account?.limit || false; + const nodeRequired = account?.nodeRequired || false; const [isBlockedUrl, setIsBlockedUrl] = useState(false); const [currentAccount, setCurrentAccount] = useState(); @@ -141,7 +141,7 @@ const DefaultView: FC = (props) => {
)} - {accountLoading || limit ? ( + {accountLoading || nodeRequired ? (
diff --git a/src/common/lib/api.ts b/src/common/lib/api.ts index 80890b0f22..9d3cfa0fe1 100644 --- a/src/common/lib/api.ts +++ b/src/common/lib/api.ts @@ -51,7 +51,7 @@ export interface AccountInfoRes { alias: string; pubkey?: string; lightning_address?: string; - limit?: boolean; + node_required?: boolean; }; name: string; avatarUrl?: string; @@ -119,7 +119,7 @@ export const swrGetAccountInfo = async ( currency: currency || "BTC", // set default currency for every account avatarUrl, lightningAddress: response.info.lightning_address, - limit: response.info.limit, + nodeRequired: response.info.node_required, }; storeAccounts({ ...accountsCache, diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index f5102edfd5..23b5bfa109 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -42,7 +42,8 @@ interface UserDetails { name: string; avatar: string | null; lightning_address: string; - custodial: boolean; + shared_node: boolean; + node_required: boolean; limits: { max_send_volume: number; max_send_amount: number; @@ -141,9 +142,9 @@ export default class Alby implements Connector { WebLNNode & GetAccountInformationResponse >; - const limit = await this.getLimit(); + const node_required = await this.getLimit(); - if (cacheValue && cacheValue.data.limit === limit) { + if (cacheValue && cacheValue.data.node_required === node_required) { return cacheValue; } @@ -155,7 +156,7 @@ export default class Alby implements Connector { const returnValue = { data: { ...info, - limit: limit, + node_required: node_required, alias: "🐝 getalby.com", }, }; @@ -448,12 +449,9 @@ export default class Alby implements Connector { url, requestOptions ); - const limits = details.limits; - const custodial = details.custodial; - const hasZeroLimit = Object.values(limits).some((limit) => limit === 0); + if (details.node_required) return true; - if (custodial && hasZeroLimit) return true; return false; } catch (error) { console.error("Error fetching limits:", error); diff --git a/src/types.ts b/src/types.ts index 7a3fe37b01..bfaffa659e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -46,7 +46,7 @@ export interface AccountInfo { currency: ACCOUNT_CURRENCIES; avatarUrl?: string; lightningAddress?: string; - limit?: boolean; + nodeRequired?: boolean; } export type GetAccountInformationResponse = { @@ -59,7 +59,7 @@ export type GetAccountInformationResponse = { keysend_pubkey: string; lightning_address?: string; nostr_pubkey?: string; - limit?: boolean; + node_required?: boolean; }; export interface MetaData { From 228b631deb48b23de05ea28ae592e504902d9792 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Mon, 29 Apr 2024 14:45:57 +0530 Subject: [PATCH 07/12] feat: no-limit-warning --- .../background-script/connectors/alby.ts | 6 +++--- src/types.ts | 16 +++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index 23b5bfa109..9225cba422 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -9,7 +9,7 @@ import { } from "@getalby/sdk/dist/types"; import browser from "webextension-polyfill"; import { decryptData, encryptData } from "~/common/lib/crypto"; -import { Account, GetAccountInformationResponse, OAuthToken } from "~/types"; +import { Account, GetAccountInformationResponses, OAuthToken } from "~/types"; import state from "../state"; import Connector, { CheckPaymentArgs, @@ -135,11 +135,11 @@ export default class Alby implements Connector { } async getInfo(): Promise< - GetInfoResponse + GetInfoResponse > { const cacheKey = "getInfo"; const cacheValue = this._cache.get(cacheKey) as GetInfoResponse< - WebLNNode & GetAccountInformationResponse + WebLNNode & GetAccountInformationResponses >; const node_required = await this.getLimit(); diff --git a/src/types.ts b/src/types.ts index bfaffa659e..a967de45ff 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,7 @@ -import { CreateSwapParams } from "@getalby/sdk/dist/types"; +import { + CreateSwapParams, + GetAccountInformationResponse, +} from "@getalby/sdk/dist/types"; import { PaymentRequestObject } from "bolt11"; import { Runtime } from "webextension-polyfill"; import { ACCOUNT_CURRENCIES, CURRENCIES } from "~/common/constants"; @@ -49,16 +52,7 @@ export interface AccountInfo { nodeRequired?: boolean; } -export type GetAccountInformationResponse = { - identifier: string; - email: string; - name?: string; - avatar?: string; - keysend_custom_key: string; - keysend_custom_value: string; - keysend_pubkey: string; - lightning_address?: string; - nostr_pubkey?: string; +export type GetAccountInformationResponses = GetAccountInformationResponse & { node_required?: boolean; }; From b67f87b62a76cf60f83e68cf99adae30d40463a3 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Wed, 1 May 2024 11:40:16 +0530 Subject: [PATCH 08/12] fix: ui --- src/app/screens/Home/DefaultView/index.tsx | 51 +++++++++++++--------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index 4c2dab81a0..ff8775f473 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -141,27 +141,36 @@ const DefaultView: FC = (props) => {
)} - {accountLoading || nodeRequired ? ( -
-
- -
- - Your Alby Account needs a wallet. Connect a wallet to your account - on{" "} - - getalby.com - - -
- ) : ( - - )} +
+ {!accountLoading ? ( + <> + {nodeRequired ? ( +
+
+ +
+ + Your Alby Account needs a wallet. Connect a wallet to your + account on{" "} + + getalby.com + + +
+ ) : ( + + )} + + ) : ( + + )} +
+ {(accountLoading || lightningAddress) && (
Date: Wed, 1 May 2024 11:50:00 +0530 Subject: [PATCH 09/12] fix: cleanup --- src/extension/background-script/connectors/alby.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/extension/background-script/connectors/alby.ts b/src/extension/background-script/connectors/alby.ts index 9225cba422..78475aabdd 100644 --- a/src/extension/background-script/connectors/alby.ts +++ b/src/extension/background-script/connectors/alby.ts @@ -142,7 +142,7 @@ export default class Alby implements Connector { WebLNNode & GetAccountInformationResponses >; - const node_required = await this.getLimit(); + const node_required = await this._isNodeRequired(); if (cacheValue && cacheValue.data.node_required === node_required) { return cacheValue; @@ -431,8 +431,8 @@ export default class Alby implements Connector { } } - async getLimit() { - const url = "https://api.getalby.com/internal/users"; + private async _isNodeRequired() { + const url = `${process.env.ALBY_API_URL}/internal/users`; const requestOptions = { method: "GET", @@ -450,9 +450,7 @@ export default class Alby implements Connector { requestOptions ); - if (details.node_required) return true; - - return false; + return details.node_required; } catch (error) { console.error("Error fetching limits:", error); throw error; From f9debd3618c871febc26329941da9a96f6158db7 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Thu, 2 May 2024 16:44:56 +0530 Subject: [PATCH 10/12] fix: translations --- src/app/screens/Home/DefaultView/index.tsx | 29 ++++++++++++---------- src/i18n/locales/en/translation.json | 3 ++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index ff8775f473..159ea9c235 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -11,7 +11,7 @@ import { import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import { FC, useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; +import { Trans, useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import Alert from "~/app/components/Alert"; import BalanceBox from "~/app/components/BalanceBox"; @@ -145,21 +145,24 @@ const DefaultView: FC = (props) => { {!accountLoading ? ( <> {nodeRequired ? ( -
+ ) : ( diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 434efe018e..87e660e8bc 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -383,7 +383,8 @@ "title": "Receive bitcoin", "description": "Fund your account and receive via your lightning address or an invoice" } - } + }, + "node_required": "Your Alby Account needs a wallet. Connect a wallet to your account on <0>getalby.com" } }, "accounts": { From f10aa16abeccc4d1ff3820038eb0bfcb3b678535 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Tue, 14 May 2024 14:37:52 +0530 Subject: [PATCH 11/12] fix: ui update --- src/app/screens/Home/DefaultView/index.tsx | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index 3bb7c64bcd..9f3eddccc4 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -125,7 +125,7 @@ const DefaultView: FC = (props) => {
{isBlockedUrl && ( -
+

{t("default_view.is_blocked_hint", { @@ -142,6 +142,30 @@ const DefaultView: FC = (props) => {

)} + {isAlbyLNDHubAccount(account?.alias, account?.connectorType) && ( + +
+
+ +
+ + , + ]} + /> + +
+
+ )}
{!accountLoading ? ( <> @@ -175,31 +199,6 @@ const DefaultView: FC = (props) => { )}
- {isAlbyLNDHubAccount(account?.alias, account?.connectorType) && ( - -
-
- -
- - , - ]} - /> - -
-
- )} - {(accountLoading || lightningAddress) && (
Date: Tue, 14 May 2024 14:58:40 +0530 Subject: [PATCH 12/12] fix: ui --- src/app/screens/Home/DefaultView/index.tsx | 59 ++++++++++------------ 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx index 9f3eddccc4..7418420d33 100644 --- a/src/app/screens/Home/DefaultView/index.tsx +++ b/src/app/screens/Home/DefaultView/index.tsx @@ -47,7 +47,6 @@ const DefaultView: FC = (props) => { const { account, accountLoading } = useAccount(); const lightningAddress = account?.lightningAddress || ""; - const nodeRequired = account?.nodeRequired || false; const [isBlockedUrl, setIsBlockedUrl] = useState(false); const [currentAccount, setCurrentAccount] = useState(); @@ -166,38 +165,32 @@ const DefaultView: FC = (props) => {
)} -
- {!accountLoading ? ( - <> - {nodeRequired ? ( -
-
- -
- - , - ]} - /> - -
- ) : ( - - )} - - ) : ( - - )} -
+ {account?.nodeRequired ? ( + +
+
+ +
+ + , + ]} + /> + +
+
+ ) : ( + + )} {(accountLoading || lightningAddress) && (