From 3301af5cbb2c568d17355e724adc470b0b251160 Mon Sep 17 00:00:00 2001 From: reya Date: Mon, 15 Jan 2024 15:33:05 +0700 Subject: [PATCH] feat: move nwc to settings --- apps/desktop/src/router.tsx | 14 +- apps/desktop/src/routes/nwc/index.tsx | 125 -------------- .../components/walletConnectForm.tsx} | 2 + apps/desktop/src/routes/settings/nwc.tsx | 154 ++++++++++++++++++ packages/ark/src/ark.ts | 36 +++- .../ark/src/components/note/buttons/reply.tsx | 4 +- packages/ark/src/components/note/child.tsx | 95 +++++------ packages/ark/src/components/note/content.tsx | 59 ++----- .../ark/src/components/note/mentions/user.tsx | 16 +- packages/ark/src/components/user/about.tsx | 37 +++++ .../ark/src/components/user/followButton.tsx | 19 ++- packages/ark/src/components/user/index.ts | 2 + packages/ark/src/provider.tsx | 3 + packages/lume-column-user/src/home.tsx | 114 +++---------- packages/ui/src/layouts/settings.tsx | 26 ++- packages/ui/src/navigation.tsx | 3 - packages/ui/src/routes/user.tsx | 114 +++---------- packages/utils/src/state.ts | 3 +- 18 files changed, 378 insertions(+), 448 deletions(-) delete mode 100644 apps/desktop/src/routes/nwc/index.tsx rename apps/desktop/src/routes/{nwc/components/form.tsx => settings/components/walletConnectForm.tsx} (96%) create mode 100644 apps/desktop/src/routes/settings/nwc.tsx create mode 100644 packages/ark/src/components/user/about.tsx diff --git a/apps/desktop/src/router.tsx b/apps/desktop/src/router.tsx index 47bc921a..ad471711 100644 --- a/apps/desktop/src/router.tsx +++ b/apps/desktop/src/router.tsx @@ -35,13 +35,6 @@ export default function Router() { return { Component: HomeScreen }; }, }, - { - path: "nwc", - async lazy() { - const { NWCScreen } = await import("./routes/nwc"); - return { Component: NWCScreen }; - }, - }, { path: "settings", element: , @@ -100,6 +93,13 @@ export default function Router() { return { Component: AdvancedSettingScreen }; }, }, + { + path: "nwc", + async lazy() { + const { NWCScreen } = await import("./routes/settings/nwc"); + return { Component: NWCScreen }; + }, + }, { path: "about", async lazy() { diff --git a/apps/desktop/src/routes/nwc/index.tsx b/apps/desktop/src/routes/nwc/index.tsx deleted file mode 100644 index 96ac0efd..00000000 --- a/apps/desktop/src/routes/nwc/index.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { CheckCircleIcon } from "@lume/icons"; -import { useStorage } from "@lume/storage"; -import { useEffect, useState } from "react"; -import { NWCForm } from "./components/form"; - -export function NWCScreen() { - const storage = useStorage(); - const [walletConnectURL, setWalletConnectURL] = useState(null); - - const remove = async () => { - await storage.removePrivkey(`${ark.account.pubkey}-nwc`); - setWalletConnectURL(null); - }; - - useEffect(() => { - async function getNWC() { - const nwc = await storage.loadPrivkey(`${ark.account.pubkey}-nwc`); - if (nwc) setWalletConnectURL(nwc); - } - getNWC(); - }, []); - - return ( -
-
-
-

- Nostr Wallet Connect -

-

- Sending zap easily via Bitcoin Lightning. -

-
-
- {!walletConnectURL ? ( - - ) : ( -
-
- -
You're using nostr wallet connect
-
-
-