move files together

This commit is contained in:
lemonknowsall committed 2025-10-13 19:57:15 -07:00
1 parent 5ce402105c
commit aaf12120e6
11 files changed
+32 -41

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ import { ScrollToTop } from "./components/ScrollToTop";
import Index from "./pages/Index";
import { NIP19Page } from "./pages/NIP19Page";
import NotFound from "./pages/NotFound";
import { CashuWallet } from "./components/CashuWallet";
import { CashuWallet } from "./components/wallet/CashuWallet";
export function AppRouter() {
return (
+1 -1
View File
@@ -26,7 +26,7 @@ import { Badge } from '@/components/ui/badge';
import { Separator } from '@/components/ui/separator';
import { useNWC } from '@/hooks/useNWCContext';
import { useWallet } from '@/hooks/useWallet';
import { useCashu } from '@/hooks/useCashu';
import { useCashu } from '@/hooks/cashu/useCashu';
import { useToast } from '@/hooks/useToast';
import { useIsMobile } from '@/hooks/useIsMobile';
import type { NWCConnection, NWCInfo } from '@/hooks/useNWC';
+1 -1
View File
@@ -30,7 +30,7 @@ import { useAuthor } from '@/hooks/useAuthor';
import { useToast } from '@/hooks/useToast';
import { useZaps } from '@/hooks/useZaps';
import { useWallet } from '@/hooks/useWallet';
import { useCashu } from '@/hooks/useCashu';
import { useCashu } from '@/hooks/cashu/useCashu';
import { useIsMobile } from '@/hooks/useIsMobile';
import type { Event } from 'nostr-tools';
import QRCode from 'qrcode';
+1 -1
View File
@@ -30,7 +30,7 @@ import { useAuthor } from '@/hooks/useAuthor';
import { useToast } from '@/hooks/useToast';
import { useZaps } from '@/hooks/useZaps';
import { useWallet } from '@/hooks/useWallet';
import { useCashu } from '@/hooks/useCashu';
import { useCashu } from '@/hooks/cashu/useCashu';
import { useIsMobile } from '@/hooks/useIsMobile';
import type { Event } from 'nostr-tools';
import QRCode from 'qrcode';
@@ -1,21 +1,20 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import { nip19 } from 'nostr-tools';
import { useCashu, type HistoryEntry } from '@/hooks/useCashu';
import { useCashu, type HistoryEntry } from '@/hooks/cashu/useCashu';
import { useLightningAddress } from '@/hooks/useLightningAddress';
import { getCleanMintLabel } from '@/lib/cashuUtils';
import { useNpubCash, type NpubCashUserInfo } from '@/hooks/useNpubCash';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useToast } from '@/hooks/useToast';
import { useQRCode } from '@/hooks/useQRCode';
import { useCopyToClipboard } from '@/hooks/useCopyToClipboard';
import { QRModal } from '@/components/ui/qr-modal';
import { LoadingModal } from '@/components/wallet/LoadingModal';
import { BalanceDisplay } from '@/components/wallet/BalanceDisplay';
import { ReceiveCard } from '@/components/wallet/ReceiveCard';
import { SendCard } from '@/components/wallet/SendCard';
import { TransactionHistory } from '@/components/wallet/TransactionHistory';
import { ProofBreakdownModal } from '@/components/wallet/ProofBreakdownModal';
import { RemoveMintModal } from '@/components/wallet/RemoveMintModal';
import { LoadingModal } from './LoadingModal';
import { BalanceDisplay } from './BalanceDisplay';
import { ReceiveCard } from './ReceiveCard';
import { SendCard } from './SendCard';
import { TransactionHistory } from './TransactionHistory';
import { ProofBreakdownModal } from './ProofBreakdownModal';
import { RemoveMintModal } from './RemoveMintModal';
import { LoginArea } from '@/components/auth/LoginArea';
export function CashuWallet() {
@@ -133,7 +132,7 @@ export function CashuWallet() {
const totalBalance: number = (Object.values(balances) as number[]).reduce((sum: number, balance: number) => sum + balance, 0);
// ============================================================================
// HELPER FUNCTIONS - QR Code Generation
// HELPER FUNCTIONS - QR Code Generation & Formatting
// ============================================================================
// Generate QR code for sent token
@@ -146,6 +145,18 @@ export function CashuWallet() {
}
};
// Get clean mint label for display
const getCleanMintLabel = useCallback((mint: { name?: string; url: string }): string => {
if (mint.name && mint.name.trim().length > 0) {
return mint.name.replace(/^https?:\/\//, '');
}
try {
return new URL(mint.url).host;
} catch {
return mint.url.replace(/^https?:\/\//, '');
}
}, []);
// ============================================================================
// HELPER FUNCTIONS - Mint Management
// ============================================================================
@@ -807,3 +818,4 @@ export function CashuWallet() {
</>
);
}
+1 -1
View File
@@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react';
import type { HistoryEntry } from '@/hooks/useCashu';
import type { HistoryEntry } from '@/hooks/cashu/useCashu';
interface TransactionHistoryProps {
entries: HistoryEntry[];
+1 -1
View File
@@ -1,5 +1,5 @@
import { createContext, useContext, ReactNode } from 'react';
import { useCashu as useCashuHook, type UseCashuReturn } from '@/hooks/useCashu';
import { useCashu as useCashuHook, type UseCashuReturn } from '@/hooks/cashu/useCashu';
const CashuContext = createContext<UseCashuReturn | null>(null);
@@ -1,5 +1,5 @@
// Re-export the new modular useCashu hook and types
export { useCashu } from './cashu/index';
export { useCashu } from './index';
export type {
UseCashuReturn,
CashuBalance,
@@ -13,5 +13,5 @@ export type {
CashuMintError,
CashuQuoteError,
CashuTokenError
} from './cashu/types';
} from './types';
+1 -1
View File
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { useNWC } from '@/hooks/useNWCContext';
import { useCashu } from '@/hooks/useCashu';
import { useCashu } from '@/hooks/cashu/useCashu';
import type { WebLNProvider } from '@webbtc/webln-types';
export interface WalletStatus {
+1 -1
View File
@@ -4,7 +4,7 @@ import { useAuthor } from '@/hooks/useAuthor';
import { useAppContext } from '@/hooks/useAppContext';
import { useToast } from '@/hooks/useToast';
import { useNWC } from '@/hooks/useNWCContext';
import { useCashu } from '@/hooks/useCashu';
import { useCashu } from '@/hooks/cashu/useCashu';
import type { NWCConnection } from '@/hooks/useNWC';
import { nip57 } from 'nostr-tools';
import type { Event } from 'nostr-tools';
-21
View File
@@ -1,21 +0,0 @@
/**
* Cashu wallet utility functions
*/
/**
* Get a clean, readable label for a mint
* Strips protocol and uses hostname
*/
export function getCleanMintLabel(mint: { name?: string; url: string }): string {
if (mint.name && mint.name.trim().length > 0) {
// If name looks like a URL, strip protocol as well
return mint.name.replace(/^https?:\/\//, '');
}
try {
return new URL(mint.url).host; // host excludes protocol and preserves port if any
} catch {
// Fallback: manual strip
return mint.url.replace(/^https?:\/\//, '');
}
}