diff --git a/package.json b/package.json index 7d2c74ab..83b67e6e 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,10 @@ }, "dependencies": { "@evilmartians/harmony": "^1.1.0", - "@formkit/auto-animate": "^0.8.0", "@getalby/sdk": "^2.5.0", "@nostr-dev-kit/ndk": "^2.0.3", "@nostr-dev-kit/ndk-cache-dexie": "^2.0.3", - "@nostr-fetch/adapter-ndk": "^0.12.2", + "@nostr-fetch/adapter-ndk": "^0.13.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-collapsible": "^1.0.3", @@ -33,7 +32,7 @@ "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-toolbar": "^1.0.4", "@radix-ui/react-tooltip": "^1.0.7", - "@tanstack/react-query": "^4.36.1", + "@tanstack/react-query": "4.36.1", "@tauri-apps/api": "2.0.0-alpha.8", "@tauri-apps/cli": "2.0.0-alpha.15", "@tauri-apps/plugin-app": "2.0.0-alpha.1", @@ -81,7 +80,6 @@ "react-markdown": "^8.0.7", "react-router-dom": "^6.17.0", "react-string-replace": "^1.1.1", - "react-xarrows": "^2.0.2", "reactflow": "^11.9.4", "remark-gfm": "^3.0.1", "sonner": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 335964cc..ab3e1f91 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ dependencies: '@evilmartians/harmony': specifier: ^1.1.0 version: 1.1.0 - '@formkit/auto-animate': - specifier: ^0.8.0 - version: 0.8.0 '@getalby/sdk': specifier: ^2.5.0 version: 2.5.0 @@ -21,8 +18,8 @@ dependencies: specifier: ^2.0.3 version: 2.0.3(typescript@5.2.2) '@nostr-fetch/adapter-ndk': - specifier: ^0.12.2 - version: 0.12.2(@nostr-dev-kit/ndk@2.0.3)(nostr-fetch@0.13.0) + specifier: ^0.13.0 + version: 0.13.0(@nostr-dev-kit/ndk@2.0.3)(nostr-fetch@0.13.0) '@radix-ui/react-alert-dialog': specifier: ^1.0.5 version: 1.0.5(@types/react-dom@18.2.14)(@types/react@18.2.29)(react-dom@18.2.0)(react@18.2.0) @@ -51,7 +48,7 @@ dependencies: specifier: ^1.0.7 version: 1.0.7(@types/react-dom@18.2.14)(@types/react@18.2.29)(react-dom@18.2.0)(react@18.2.0) '@tanstack/react-query': - specifier: ^4.36.1 + specifier: 4.36.1 version: 4.36.1(react-dom@18.2.0)(react@18.2.0) '@tauri-apps/api': specifier: 2.0.0-alpha.8 @@ -194,9 +191,6 @@ dependencies: react-string-replace: specifier: ^1.1.1 version: 1.1.1 - react-xarrows: - specifier: ^2.0.2 - version: 2.0.2(react@18.2.0) reactflow: specifier: ^11.9.4 version: 11.9.4(@types/react@18.2.29)(react-dom@18.2.0)(react@18.2.0) @@ -865,10 +859,6 @@ packages: resolution: {integrity: sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==} dev: false - /@formkit/auto-animate@0.8.0: - resolution: {integrity: sha512-G8f7489ka0mWyi+1IEZT+xgIwcpWtRMmE2x+IrVoQ+KM1cP6VDj/TbujZjwxdb0P8w8b16/qBfViRmydbYHwMw==} - dev: false - /@getalby/sdk@2.5.0: resolution: {integrity: sha512-MRLgI6WxCCLgrar+qDqm/UhKs+V6yXzNm4y1bJRAuN72nkKT+TjTJHCmk9GjTngR3FrOfLbeMsPwBxCmbvfrLQ==} engines: {node: '>=14'} @@ -1003,24 +993,17 @@ packages: - typescript dev: false - /@nostr-fetch/adapter-ndk@0.12.2(@nostr-dev-kit/ndk@2.0.3)(nostr-fetch@0.13.0): - resolution: {integrity: sha512-+7EVuxS5DDZvNo6qbfFp7xRHwIyjyi36hYkiQFDjbQ4gX5LKo9RIPB1P+1XGkOSDFshypTbovZCaFunscJ/zhQ==} + /@nostr-fetch/adapter-ndk@0.13.0(@nostr-dev-kit/ndk@2.0.3)(nostr-fetch@0.13.0): + resolution: {integrity: sha512-pTpAmwdaDUymdaVbYDoBV0A+LvOj6VIQqhrcfsWlr2+O4vbOy5DLqE3189xFZhkW0I+eT9m18H9YxbHUZS85hw==} peerDependencies: - '@nostr-dev-kit/ndk': ^0.7.5 - nostr-fetch: ^0.12.2 + '@nostr-dev-kit/ndk': ^0.8.4 + nostr-fetch: ^0.13.0 dependencies: '@nostr-dev-kit/ndk': 2.0.3(typescript@5.2.2) - '@nostr-fetch/kernel': 0.12.2 + '@nostr-fetch/kernel': 0.13.0 nostr-fetch: 0.13.0 dev: false - /@nostr-fetch/kernel@0.12.2: - resolution: {integrity: sha512-ja7StOV33NmdtAMGfQIS0/R0dAkLRm3QxN6u/YAQdp5mXER4BYxiQKxUS/dCoTCSX986MH2zp9Fm0f76u4VaNQ==} - dependencies: - '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 - dev: false - /@nostr-fetch/kernel@0.13.0: resolution: {integrity: sha512-KoF6pCezZvGP9ZQo23Ib4UDwJRd08xqVeVTQ44Z/b+gxBBrZCR0lnwOPS6KYBvdOfduynQEryNt5if5ZLxpRlg==} dependencies: @@ -4832,6 +4815,7 @@ packages: /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true /log-update@5.0.1: resolution: {integrity: sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==} @@ -6094,17 +6078,6 @@ packages: tslib: 2.6.2 dev: false - /react-xarrows@2.0.2(react@18.2.0): - resolution: {integrity: sha512-tDlAqaxHNmy0vegW/6NdhoWyXJq1LANX/WUAlHyzoHe9BwFVnJPPDghmDjYeVr7XWFmBrVTUrHsrW7GKYI6HtQ==} - peerDependencies: - react: '>=16.8.0' - dependencies: - '@types/prop-types': 15.7.9 - lodash: 4.17.21 - prop-types: 15.8.1 - react: 18.2.0 - dev: false - /react@18.2.0: resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} engines: {node: '>=0.10.0'} diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index c2bb213f..279dfe60 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -5,7 +5,7 @@ { "width": 1080, "height": 800, - "minWidth": 1080, + "minWidth": 560, "minHeight": 800, "resizable": true, "title": "Lume", diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index af0c5181..68e7d7e0 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -5,7 +5,7 @@ { "width": 1080, "height": 800, - "minWidth": 1080, + "minWidth": 560, "minHeight": 800, "resizable": true, "title": "Lume", diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index daabd37a..e3b444c5 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -5,7 +5,7 @@ { "width": 1080, "height": 800, - "minWidth": 1080, + "minWidth": 560, "minHeight": 800, "resizable": true, "title": "Lume", diff --git a/src/app/auth/create.tsx b/src/app/auth/create.tsx index caf0c2d2..62be2095 100644 --- a/src/app/auth/create.tsx +++ b/src/app/auth/create.tsx @@ -52,6 +52,8 @@ export function CreateAccountScreen() { name: data.name, display_name: data.name, bio: data.about, + picture: picture, + avatar: picture, }; const userPrivkey = generatePrivateKey(); @@ -105,7 +107,7 @@ export function CreateAccountScreen() { if (filePath) { await writeTextFile( filePath, - `Generated by Lume (lume.nu)\nPublic key: ${keys.npub}\nPrivate key: ${keys.nsec}` + `Nostr account, generated by Lume (lume.nu)\nPublic key: ${keys.npub}\nPrivate key: ${keys.nsec}` ); setDownloaded(true); diff --git a/src/app/nwc/components/alby.tsx b/src/app/nwc/components/alby.tsx deleted file mode 100644 index b4e9c500..00000000 --- a/src/app/nwc/components/alby.tsx +++ /dev/null @@ -1,150 +0,0 @@ -import { webln } from '@getalby/sdk'; -import * as Dialog from '@radix-ui/react-dialog'; -import { message } from '@tauri-apps/plugin-dialog'; -import { useState } from 'react'; - -import { useStorage } from '@libs/storage/provider'; - -import { - AlbyIcon, - ArrowRightCircleIcon, - CancelIcon, - CheckCircleIcon, - LoaderIcon, -} from '@shared/icons'; - -export function NWCAlby() { - const { db } = useStorage(); - - const [isOpen, setIsOpen] = useState(false); - const [isLoading, setIsloading] = useState(false); - const [isConnected, setIsConnected] = useState(false); - - const initAlby = async () => { - try { - setIsloading(true); - - const provider = webln.NostrWebLNProvider.withNewSecret(); - const walletConnectURL = provider.getNostrWalletConnectUrl(true); - - // get auth url - const authURL = provider.getAuthorizationUrl({ name: 'Lume' }); - - // open auth window - /* - const webview = new WebviewWindow('alby', { - title: 'Connect Alby', - url: authURL.href, - center: true, - width: 400, - height: 650, - }); - - webview.listen('tauri://close-requested', async () => { - await db.secureSave('nwc', walletConnectURL); - setIsConnected(true); - setIsloading(false); - }); - */ - } catch (e) { - setIsloading(false); - await message(e.toString(), { title: 'Connect Alby', type: 'error' }); - } - }; - - return ( - -
-
-
- -
-
-
Alby
-

- Require alby account -

-
-
- - - -
- - - -
-
-
-
- - Alby integration (Beta) - - - - -
-
-
-
-
-
- Lume Logo -
-
-
- -
- {isConnected ? ( -
- -
- ) : null} -
-
-

- When you click "Connect", a new window will open and you need - to click the "Connect Wallet" button to grant Lume permission - to integrate with your Alby account. -

-

- All information will be encrypted and stored on the local machine. -

-
- -
-
- - - - ); -} diff --git a/src/app/nwc/components/form.tsx b/src/app/nwc/components/form.tsx new file mode 100644 index 00000000..035a0e20 --- /dev/null +++ b/src/app/nwc/components/form.tsx @@ -0,0 +1,66 @@ +import { useState } from 'react'; +import { toast } from 'sonner'; + +import { useStorage } from '@libs/storage/provider'; + +import { LoaderIcon } from '@shared/icons'; + +export function NWCForm({ setWalletConnectURL }) { + const { db } = useStorage(); + + const [uri, setUri] = useState(''); + const [loading, setLoading] = useState(false); + + const submit = async () => { + try { + setLoading(true); + + if (!uri.startsWith('nostr+walletconnect:')) { + toast.error( + 'Connect URI is required and must start with format nostr+walletconnect:, please check again' + ); + setLoading(false); + return; + } + + const uriObj = new URL(uri); + const params = new URLSearchParams(uriObj.search); + + if (params.has('relay') && params.has('secret')) { + await db.secureSave(`${db.account.pubkey}-nwc`, uri); + setWalletConnectURL(uri); + setLoading(false); + } else { + setLoading(false); + toast.error('Connect URI is not valid, please check again'); + return; + } + } catch (e) { + setLoading(false); + toast.error(e); + } + }; + + return ( +
+
+