ln decoder, default mint, drawer formatting

This commit is contained in:
lemonknowsall committed 2025-10-19 11:05:35 -07:00
1 parent 7390dd6c19
commit 617edd1784
8 files changed
+422 -130

No files matched your search

+48 -7
View File
@@ -111,6 +111,10 @@ export function CashuWallet() {
setLightningAddressAmount,
pendingLightningAddress,
setPendingLightningAddress,
decodedInvoiceAmount,
setDecodedInvoiceAmount,
pendingInvoice,
setPendingInvoice,
sentToken,
setSentToken,
sentTokenQRCode,
@@ -120,6 +124,7 @@ export function CashuWallet() {
setCurrentInvoice,
handleReceive,
handleSend,
handleConfirmInvoicePayment,
mintQuoteUnsubscribeRef,
} = useWalletTransactions({
coco,
@@ -147,7 +152,7 @@ export function CashuWallet() {
// ============================================================================
const [showSats, setShowSats] = useState(true);
const [mode, setMode] = useState<'tokens' | 'lightning'>('tokens');
const [mode, setMode] = useState<'tokens' | 'lightning'>('lightning');
const [showProofBreakdown, setShowProofBreakdown] = useState(false);
const [proofBreakdown, setProofBreakdown] = useState<{
mintUrl: string;
@@ -163,6 +168,30 @@ export function CashuWallet() {
const [showReceiveModal, setShowReceiveModal] = useState(false);
const [showHistoryModal, setShowHistoryModal] = useState(false);
// Handle drawer close with state reset
const handleSendDrawerClose = (open: boolean) => {
setShowSendModal(open);
if (!open) {
// Reset all send-related state when drawer closes
setSendAmount('');
setLightningInvoice('');
setLightningAddressInput('');
setLightningAddressAmount('');
setPendingLightningAddress(null);
setDecodedInvoiceAmount(null);
setPendingInvoice(null);
}
};
const handleReceiveDrawerClose = (open: boolean) => {
setShowReceiveModal(open);
if (!open) {
// Reset all receive-related state when drawer closes
setTokenInput('');
setQuoteAmount('');
}
};
// Ref to track if we've fetched npub.cash user info
const hasCheckedNpubCashRef = useRef(false);
@@ -374,8 +403,8 @@ export function CashuWallet() {
/>
{/* Bottom Drawer Modals */}
<Drawer open={showSendModal} onOpenChange={setShowSendModal}>
<DrawerContent className="h-[50vh] max-w-4xl mx-auto">
<Drawer open={showSendModal} onOpenChange={handleSendDrawerClose}>
<DrawerContent className="h-[40vh] max-w-4xl mx-auto">
<DrawerHeader>
<DrawerTitle className="text-center text-3xl font-bold">Send</DrawerTitle>
</DrawerHeader>
@@ -393,6 +422,10 @@ export function CashuWallet() {
setLightningAddressAmount={setLightningAddressAmount}
pendingLightningAddress={pendingLightningAddress}
setPendingLightningAddress={setPendingLightningAddress}
decodedInvoiceAmount={decodedInvoiceAmount}
setDecodedInvoiceAmount={setDecodedInvoiceAmount}
pendingInvoice={pendingInvoice}
setPendingInvoice={setPendingInvoice}
tokenInput=""
setTokenInput={() => {}}
quoteAmount=""
@@ -406,6 +439,10 @@ export function CashuWallet() {
}
}}
onReceive={() => {}}
onConfirmInvoice={() => {
handleConfirmInvoicePayment();
setShowSendModal(false);
}}
isResolvingAddress={isResolvingAddress}
isLoading={isLoading || isNpubCashLoading}
/>
@@ -413,8 +450,8 @@ export function CashuWallet() {
</DrawerContent>
</Drawer>
<Drawer open={showReceiveModal} onOpenChange={setShowReceiveModal}>
<DrawerContent className="h-[50vh] max-w-4xl mx-auto">
<Drawer open={showReceiveModal} onOpenChange={handleReceiveDrawerClose}>
<DrawerContent className="h-[40vh] max-w-4xl mx-auto">
<DrawerHeader>
<DrawerTitle className="text-center text-3xl font-bold">Receive</DrawerTitle>
</DrawerHeader>
@@ -432,6 +469,10 @@ export function CashuWallet() {
setLightningAddressAmount={() => {}}
pendingLightningAddress={null}
setPendingLightningAddress={() => {}}
decodedInvoiceAmount={null}
setDecodedInvoiceAmount={() => {}}
pendingInvoice={null}
setPendingInvoice={() => {}}
tokenInput={tokenInput}
setTokenInput={setTokenInput}
quoteAmount={quoteAmount}
@@ -450,11 +491,11 @@ export function CashuWallet() {
</Drawer>
<Drawer open={showHistoryModal} onOpenChange={setShowHistoryModal}>
<DrawerContent className="max-h-[90vh] max-w-4xl mx-auto">
<DrawerContent className="max-h-[80vh] max-w-4xl mx-auto">
<DrawerHeader>
<DrawerTitle className="text-center text-3xl font-bold">Transactions</DrawerTitle>
</DrawerHeader>
<ScrollArea className="h-[90vh] px-4 pb-4">
<ScrollArea className="h-[80vh] px-4 pb-4">
<TransactionHistory
entries={historyEntries}
isLoading={isLoadingHistory}