diff --git a/src/app/components/Alert/index.tsx b/src/app/components/Alert/index.tsx
index 00a9be9862..e188849313 100644
--- a/src/app/components/Alert/index.tsx
+++ b/src/app/components/Alert/index.tsx
@@ -1,22 +1,51 @@
+import { PopiconsXLine } from "@popicons/react";
+import { useState } from "react";
import { classNames } from "~/app/utils";
type Props = {
type: "warn" | "info";
children: React.ReactNode;
+ showClose?: boolean;
+ onClose?: () => void; // Optional callback function
};
-export default function Alert({ type, children }: Props) {
+export default function Alert({
+ type,
+ children,
+ showClose = false,
+ onClose,
+}: Props) {
+ const [isVisible, setIsVisible] = useState(true);
+
+ const handleClose = () => {
+ setIsVisible(false);
+ if (onClose) {
+ onClose();
+ }
+ };
+
+ if (!isVisible) return null;
+
return (
- {children}
+ {showClose && (
+
+ )}
+
{children}
);
}
diff --git a/src/app/screens/Home/DefaultView/index.tsx b/src/app/screens/Home/DefaultView/index.tsx
index b74e603f18..1c7a283775 100644
--- a/src/app/screens/Home/DefaultView/index.tsx
+++ b/src/app/screens/Home/DefaultView/index.tsx
@@ -55,6 +55,8 @@ const DefaultView: FC = (props) => {
const [isBlockedUrl, setIsBlockedUrl] = useState(false);
const [currentAccount, setCurrentAccount] = useState();
const [nostrPublicKey, setNostrPublicKey] = useState("");
+ const [seenSharedNodeBanner, setSeenSharedNodeBanner] =
+ useState(true);
const { transactions, isLoadingTransactions, loadTransactions } =
useTransactions();
@@ -85,6 +87,8 @@ const DefaultView: FC = (props) => {
const userAccount = await api.getAccount();
const nostrPrivateKey = await api.nostr.getPrivateKey(userAccount.id);
+ setSeenSharedNodeBanner(userAccount.seenSharedNodeBanner);
+
setNostrPublicKey(
nostrPrivateKey ? await nostr.derivePublicKey(nostrPrivateKey) : ""
);
@@ -176,8 +180,16 @@ const DefaultView: FC = (props) => {
)}
- {account?.sharedNode && (
-
+ {account?.sharedNode && !seenSharedNodeBanner && (
+
+ await api.editAccount(account.id, {
+ seenSharedNodeBanner: true,
+ })
+ }
+ >
diff --git a/src/common/lib/api.ts b/src/common/lib/api.ts
index 7791c4991f..fef639cc0c 100644
--- a/src/common/lib/api.ts
+++ b/src/common/lib/api.ts
@@ -75,6 +75,7 @@ export interface GetAccountRes extends Pick
{
hasMnemonic: boolean;
isMnemonicBackupDone: boolean;
hasImportedNostrKey: boolean;
+ seenSharedNodeBanner: boolean;
bitcoinNetwork: BitcoinNetworkType;
useMnemonicForLnurlAuth: boolean;
}
diff --git a/src/extension/background-script/actions/accounts/__tests__/get.test.ts b/src/extension/background-script/actions/accounts/__tests__/get.test.ts
index 71f714eb89..6cae95a36f 100644
--- a/src/extension/background-script/actions/accounts/__tests__/get.test.ts
+++ b/src/extension/background-script/actions/accounts/__tests__/get.test.ts
@@ -63,6 +63,7 @@ describe("account info", () => {
nostrEnabled: false,
liquidEnabled: false,
hasMnemonic: false,
+ seenSharedNodeBanner: false,
hasImportedNostrKey: true,
bitcoinNetwork: "bitcoin",
useMnemonicForLnurlAuth: false,
@@ -91,6 +92,7 @@ describe("account info", () => {
nostrEnabled: true,
liquidEnabled: true,
hasMnemonic: true,
+ seenSharedNodeBanner: false,
hasImportedNostrKey: true,
bitcoinNetwork: "regtest",
useMnemonicForLnurlAuth: true,
diff --git a/src/extension/background-script/actions/accounts/edit.ts b/src/extension/background-script/actions/accounts/edit.ts
index 262c48fb75..ddcc853e72 100644
--- a/src/extension/background-script/actions/accounts/edit.ts
+++ b/src/extension/background-script/actions/accounts/edit.ts
@@ -27,6 +27,11 @@ const edit = async (message: MessageAccountEdit) => {
message.args.isMnemonicBackupDone;
}
+ if (message.args.seenSharedNodeBanner !== undefined) {
+ accounts[accountId].seenSharedNodeBanner =
+ message.args.seenSharedNodeBanner;
+ }
+
state.setState({ accounts });
// make sure we immediately persist the updated accounts
await state.getState().saveToStorage();
diff --git a/src/extension/background-script/actions/accounts/get.ts b/src/extension/background-script/actions/accounts/get.ts
index 2c2a8dc749..66a15f9f46 100644
--- a/src/extension/background-script/actions/accounts/get.ts
+++ b/src/extension/background-script/actions/accounts/get.ts
@@ -30,6 +30,7 @@ const get = async (message: MessageAccountGet) => {
// Note: undefined (default for new accounts) it is also considered imported
hasImportedNostrKey: account.hasImportedNostrKey !== false,
bitcoinNetwork: account.bitcoinNetwork || "bitcoin",
+ seenSharedNodeBanner: account.seenSharedNodeBanner || false,
useMnemonicForLnurlAuth: account.useMnemonicForLnurlAuth || false,
};
diff --git a/src/types.ts b/src/types.ts
index 60ffc958ac..c32937e31d 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -27,6 +27,7 @@ export interface Account {
nostrPrivateKey?: string | null;
mnemonic?: string | null;
hasImportedNostrKey?: boolean;
+ seenSharedNodeBanner?: boolean;
bitcoinNetwork?: BitcoinNetworkType;
isMnemonicBackupDone?: boolean;
useMnemonicForLnurlAuth?: boolean;
@@ -269,6 +270,7 @@ export interface MessageAccountEdit extends MessageDefault {
bitcoinNetwork?: BitcoinNetworkType;
useMnemonicForLnurlAuth?: boolean;
isMnemonicBackupDone?: boolean;
+ seenSharedNodeBanner?: boolean;
};
action: "editAccount";
}