diff --git a/src/app/auth/unlock.tsx b/src/app/auth/unlock.tsx index b9248d8e..2a235dfd 100644 --- a/src/app/auth/unlock.tsx +++ b/src/app/auth/unlock.tsx @@ -58,9 +58,6 @@ export function UnlockScreen() { const privkey = await db.secureLoad(db.account.pubkey); const uri = await db.secureLoad('walletConnectURL', 'alby'); - console.log('found privkey: ', privkey); - console.log('found wallet conenct url: ', uri); - if (privkey) setPrivkey(privkey); if (uri) setWalletConnectURL(uri); // redirect to home diff --git a/src/shared/alby.tsx b/src/shared/alby.tsx index a7c3f899..94c365ef 100644 --- a/src/shared/alby.tsx +++ b/src/shared/alby.tsx @@ -47,9 +47,8 @@ export function AlbyConnectButton() { webview.listen('tauri://close-requested', async () => { await db.secureSave('walletConnectURL', walletConnectURL, 'alby'); setWalletConnectURL(walletConnectURL); - setIsloading(false); - setIsOpen(false); setIsConnected(true); + setIsloading(false); }); } catch (e) { setIsloading(false); diff --git a/src/shared/notes/actions/zap.tsx b/src/shared/notes/actions/zap.tsx index 2026a6db..44822174 100644 --- a/src/shared/notes/actions/zap.tsx +++ b/src/shared/notes/actions/zap.tsx @@ -3,7 +3,7 @@ import { SendPaymentResponse } from '@getalby/sdk/dist/types'; import * as Dialog from '@radix-ui/react-dialog'; import { message } from '@tauri-apps/api/dialog'; import { QRCodeSVG } from 'qrcode.react'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import CurrencyInput from 'react-currency-input-field'; import TextareaAutosize from 'react-textarea-autosize'; @@ -26,6 +26,7 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) { const [zapMessage, setZapMessage] = useState(''); const [invoice, setInvoice] = useState(null); const [isOpen, setIsOpen] = useState(false); + const [isCompleted, setIsCompleted] = useState(false); const walletConnectURL = useStronghold((state) => state.walletConnectURL); @@ -59,15 +60,25 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) { // eose nwc.close(); - setIsOpen(false); - setAmount(''); - setZapMessage(''); + setIsCompleted(true); + + // reset after 3 secs + const timeout = setTimeout(() => setIsCompleted(false), 3000); + clearTimeout(timeout); } } catch (e) { await message(JSON.stringify(e), { title: 'Zap', type: 'error' }); } }; + useEffect(() => { + return () => { + setAmount(''); + setZapMessage(''); + setIsCompleted(false); + }; + }, []); + return ( @@ -168,7 +179,7 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) { onClick={() => createZapRequest()} className="inline-flex h-11 w-full items-center justify-center rounded-lg bg-orange-100 px-4 font-medium text-black hover:bg-orange-200" > -

Tip with Alby

+

{isCompleted ? 'Successfully tipped' : 'Tip with Alby'}

) : (