wip
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { webln } from '@getalby/sdk';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { message } from '@tauri-apps/plugin-dialog';
|
||||
import { WebviewWindow } from '@tauri-apps/plugin-window';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
@@ -14,8 +13,6 @@ import {
|
||||
LoaderIcon,
|
||||
} from '@shared/icons';
|
||||
|
||||
import { useStronghold } from '@stores/stronghold';
|
||||
|
||||
export function NWCAlby() {
|
||||
const { db } = useStorage();
|
||||
|
||||
@@ -23,8 +20,6 @@ export function NWCAlby() {
|
||||
const [isLoading, setIsloading] = useState(false);
|
||||
const [isConnected, setIsConnected] = useState(false);
|
||||
|
||||
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
|
||||
|
||||
const initAlby = async () => {
|
||||
try {
|
||||
setIsloading(true);
|
||||
@@ -36,6 +31,7 @@ export function NWCAlby() {
|
||||
const authURL = provider.getAuthorizationUrl({ name: 'Lume' });
|
||||
|
||||
// open auth window
|
||||
/*
|
||||
const webview = new WebviewWindow('alby', {
|
||||
title: 'Connect Alby',
|
||||
url: authURL.href,
|
||||
@@ -45,11 +41,11 @@ export function NWCAlby() {
|
||||
});
|
||||
|
||||
webview.listen('tauri://close-requested', async () => {
|
||||
await db.secureSave('walletConnectURL', walletConnectURL, 'nwc');
|
||||
setWalletConnectURL(walletConnectURL);
|
||||
await db.secureSave('nwc', walletConnectURL);
|
||||
setIsConnected(true);
|
||||
setIsloading(false);
|
||||
});
|
||||
*/
|
||||
} catch (e) {
|
||||
setIsloading(false);
|
||||
await message(e.toString(), { title: 'Connect Alby', type: 'error' });
|
||||
|
||||
@@ -6,8 +6,6 @@ import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
import { ArrowRightCircleIcon, CancelIcon, LoaderIcon, WorldIcon } from '@shared/icons';
|
||||
|
||||
import { useStronghold } from '@stores/stronghold';
|
||||
|
||||
type FormValues = {
|
||||
uri: string;
|
||||
};
|
||||
@@ -38,8 +36,6 @@ export function NWCOther() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isLoading, setIsloading] = useState(false);
|
||||
|
||||
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
|
||||
|
||||
const onSubmit = async (data: { [x: string]: string }) => {
|
||||
try {
|
||||
if (!data.uri.startsWith('nostr+walletconnect:')) {
|
||||
@@ -57,8 +53,7 @@ export function NWCOther() {
|
||||
const params = new URLSearchParams(uriObj.search);
|
||||
|
||||
if (params.has('relay') && params.has('secret')) {
|
||||
await db.secureSave('walletConnectURL', data.uri, 'nwc');
|
||||
setWalletConnectURL(data.uri);
|
||||
await db.secureSave('nwc', data.uri);
|
||||
setIsloading(false);
|
||||
setIsOpen(false);
|
||||
}
|
||||
@@ -95,7 +90,7 @@ export function NWCOther() {
|
||||
</button>
|
||||
</Dialog.Trigger>
|
||||
</div>
|
||||
<Dialog.Portal className="relative z-10">
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/80 backdrop-blur-2xl" />
|
||||
<Dialog.Content className="fixed inset-0 z-50 flex min-h-full items-center justify-center">
|
||||
<div className="relative h-min w-full max-w-xl rounded-xl bg-white/10 backdrop-blur-xl">
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
import { NWCAlby } from '@app/nwc/components/alby';
|
||||
import { NWCOther } from '@app/nwc/components/other';
|
||||
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
import { CheckCircleIcon } from '@shared/icons';
|
||||
|
||||
import { useStronghold } from '@stores/stronghold';
|
||||
|
||||
export function NWCScreen() {
|
||||
const { db } = useStorage();
|
||||
|
||||
const [walletConnectURL, setWalletConnectURL] = useStronghold((state) => [
|
||||
state.walletConnectURL,
|
||||
state.setWalletConnectURL,
|
||||
]);
|
||||
const walletConnectURL = 'test';
|
||||
|
||||
const remove = async () => {
|
||||
setWalletConnectURL('');
|
||||
await db.secureSave('walletConnectURL', '', 'nwc');
|
||||
// setWalletConnectURL('');
|
||||
// await db.secureSave('walletConnectURL', '', 'nwc');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user