upgraded mobile styling

This commit is contained in:
lemonknowsall committed 2025-10-17 13:39:29 -07:00
1 parent 8ef018df8a
commit e4ee51335e
8 files changed
+206 -162

No files matched your search

+5 -5
View File
@@ -9,15 +9,15 @@ interface ActionButtonsProps {
export function ActionButtons({ onSendClick, onReceiveClick, isLoading }: ActionButtonsProps) {
return (
<div className="flex gap-6 justify-center py-8">
<div className="flex gap-8 justify-center py-8">
<Button
variant="outline"
size="icon"
onClick={onReceiveClick}
disabled={isLoading}
className="h-16 w-16 rounded-full shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105"
className="h-20 w-20 rounded-full bg-muted border-2 shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105 [&_svg]:size-6"
>
<Download className="h-7 w-7" />
<Download className="h-12 w-12" />
</Button>
<Button
@@ -25,9 +25,9 @@ export function ActionButtons({ onSendClick, onReceiveClick, isLoading }: Action
size="icon"
onClick={onSendClick}
disabled={isLoading}
className="h-16 w-16 rounded-full shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105"
className="h-20 w-20 rounded-full bg-muted border-2 shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105 [&_svg]:size-6"
>
<Send className="h-7 w-7" />
<Send className="h-12 w-12" />
</Button>
</div>
);
+34 -83
View File
@@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
import { Wallet, ChevronDown, Plus, X, Zap, Coins, HelpCircle, QrCode, Copy, Check, RefreshCw } from 'lucide-react';
import { Wallet, ChevronDown, Plus, X, QrCode, Copy, Check } from 'lucide-react';
import { useState, useEffect } from 'react';
import { exchangeRateService } from '@/lib/exchangeRateService';
@@ -16,8 +16,6 @@ interface BalanceDisplayProps {
balances: { [key: string]: number };
showSats: boolean;
setShowSats: (showSats: boolean) => void;
mode: 'tokens' | 'lightning';
setMode: (mode: 'tokens' | 'lightning') => void;
activeMintUrl: string | null;
setActiveMintUrl: (url: string | null) => void;
mints: CashuMint[];
@@ -43,8 +41,6 @@ export function BalanceDisplay({
balances,
showSats,
setShowSats,
mode,
setMode,
activeMintUrl,
setActiveMintUrl,
mints,
@@ -73,13 +69,13 @@ export function BalanceDisplay({
const convertCurrency = (sats: number, showSats: boolean): string => {
if (showSats) {
return `${sats.toLocaleString()} sats`;
return `₿${sats.toLocaleString()}`;
} else if (btcUsdRate) {
const btcAmount = sats / 100000000;
const usd = btcAmount * btcUsdRate;
return `$${usd.toFixed(2)}`;
} else {
return `${sats.toLocaleString()} sats`;
return `₿${sats.toLocaleString()}`;
}
};
@@ -91,41 +87,35 @@ export function BalanceDisplay({
className="text-5xl font-bold tabular-nums hover:opacity-80 transition-opacity cursor-pointer"
title={`Click to show in ${showSats ? 'USD' : 'sats'}`}
>
{convertCurrency(totalBalance, showSats)}
<span className="text-muted-foreground italic">
{showSats ? '₿' : '$'}
</span>
{showSats ? totalBalance.toLocaleString() : (btcUsdRate ? `${(totalBalance / 100000000 * btcUsdRate).toFixed(2)}` : totalBalance.toLocaleString())}
</button>
</div>
{/* Main Mode Toggle */}
<div className="mt-4 flex items-center justify-center">
<div className="flex gap-1 bg-muted rounded-lg p-1">
{/* Active Mint Dropdown */}
<div className="mt-3 flex items-center justify-center gap-2">
{activeMintUrl && (
<button
onClick={() => setMode('tokens')}
className={`px-4 py-2 rounded text-sm transition-colors flex items-center gap-2 ${
mode === 'tokens' ? 'bg-background shadow-sm' : 'hover:bg-muted/50'
}`}
onClick={() => activeMintUrl && onShowDenominations(activeMintUrl)}
className="p-2 rounded-lg hover:bg-muted transition-colors"
title="Show proof breakdown"
>
<Coins className="h-4 w-4" />
Cashu
<Wallet className="h-4 w-4" />
</button>
<button
onClick={() => setMode('lightning')}
className={`px-4 py-2 rounded text-sm transition-colors flex items-center gap-2 ${
mode === 'lightning' ? 'bg-background shadow-sm' : 'hover:bg-muted/50'
}`}
>
<Zap className="h-4 w-4" />
Lightning
</button>
</div>
</div>
{/* Active Mint Dropdown and Balance */}
<div className="mt-3 flex items-center justify-center gap-4">
)}
<DropdownMenu open={mintDropdownOpen} onOpenChange={setMintDropdownOpen}>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm" className="gap-2 text-muted-foreground hover:text-foreground">
<Wallet className="h-4 w-4" />
{activeMintUrl ? getCleanMintLabel({ url: activeMintUrl }) : 'Select Mint'}
<Button variant="ghost" size="sm" className="gap-2 text-muted-foreground hover:text-foreground text-base">
<div className="flex items-center gap-2">
<span>{activeMintUrl ? getCleanMintLabel({ url: activeMintUrl }) : 'Select Mint'}</span>
{activeMintUrl && (
<span>
{convertCurrency(balances[activeMintUrl] || 0, showSats)}
</span>
)}
</div>
<ChevronDown className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
@@ -143,6 +133,9 @@ export function BalanceDisplay({
>
<div className="flex items-center gap-2">
<span className="font-medium">{getCleanMintLabel(mint)}</span>
<span className="text-xs text-muted-foreground">
{convertCurrency(balances[mint.url] || 0, showSats)}
</span>
</div>
<Button
size="sm"
@@ -174,53 +167,6 @@ export function BalanceDisplay({
</div>
</DropdownMenuContent>
</DropdownMenu>
{/* Active Mint Balance */}
{activeMintUrl && (
<div className="flex items-center gap-2">
<button
onClick={() => activeMintUrl && onShowDenominations(activeMintUrl)}
className="text-sm font-semibold tabular-nums hover:opacity-80 transition-opacity cursor-pointer text-muted-foreground hover:text-foreground"
title="Click to see proof breakdown"
>
{convertCurrency(balances[activeMintUrl] || 0, showSats)}
</button>
{/* Help button */}
<Dialog>
<DialogTrigger asChild>
<Button variant="ghost" size="sm" className="h-8 w-8 p-0 text-muted-foreground hover:text-foreground">
<HelpCircle className="h-4 w-4" />
</Button>
</DialogTrigger>
<DialogContent className="max-w-md" aria-describedby="mint-description">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Wallet className="h-5 w-5" />
What is a Mint?
</DialogTitle>
</DialogHeader>
<div id="mint-description" className="space-y-3 text-left text-sm text-muted-foreground">
<p>
A <strong>mint</strong> is a server that issues and manages Cashu tokens. Think of it like a bank for digital cash.
</p>
<p>
<strong>Key features:</strong>
</p>
<ul className="list-disc list-inside space-y-1 ml-4">
<li>Issues tokens when you deposit Lightning payments</li>
<li>Redeems tokens when you receive them</li>
<li>Manages your token balance</li>
<li>Enables Lightning ↔ Cashu conversions</li>
</ul>
<p>
<strong>Note:</strong> Each mint maintains its own separate balance. You can add multiple mints to diversify your holdings and swap balances between them.
</p>
</div>
</DialogContent>
</Dialog>
</div>
)}
</div>
{/* Lightning Address */}
@@ -233,11 +179,16 @@ export function BalanceDisplay({
setLightningAddressCopied(true);
setTimeout(() => setLightningAddressCopied(false), 2000);
}}
className="flex items-center gap-2 px-3 py-1.5 bg-muted hover:bg-muted/80 rounded-md border text-sm font-mono transition-colors h-[34px]"
className="flex items-center gap-2 px-3 py-1.5 bg-muted hover:bg-muted/80 rounded-md border text-base font-mono transition-colors h-[34px]"
title="Click to copy Lightning address"
>
<span className="truncate max-w-[250px] sm:max-w-none">
{npubCashUsername}@npubx.cash
{(() => {
const lightningAddress = `${npubCashUsername}@npubx.cash`;
return lightningAddress.length > 33
? `${lightningAddress.substring(0, 15)}...${lightningAddress.substring(lightningAddress.length - 15)}`
: lightningAddress;
})()}
</span>
{lightningAddressCopied ? (
<Check className="h-4 w-4 text-green-600 flex-shrink-0" />
+15 -11
View File
@@ -13,13 +13,14 @@ import { useHistoryManager } from '@/hooks/cashu/useHistoryManager';
import { QRModal } from '@/components/ui/qr-modal';
import { BalanceDisplay } from './BalanceDisplay';
import { ActionButtons } from './ActionButtons';
import { ModeToggle } from './ModeToggle';
import { Drawer, DrawerContent, DrawerHeader, DrawerTitle } from '@/components/ui/drawer';
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';
import { LoginIcon } from '@/components/auth/LoginIcon';
export function CashuWallet() {
// ============================================================================
@@ -276,11 +277,16 @@ export function CashuWallet() {
return (
<>
<div className="max-w-4xl mx-auto py-1 px-3 sm:px-4 relative">
<div className="max-w-4xl mx-auto pt-16 pb-1 px-3 sm:px-4 relative">
{/* Login Area */}
<div className="absolute top-1 right-3 sm:right-4 z-10">
<LoginArea />
{/* Mode Toggle */}
<div className="absolute top-3 left-3 sm:left-4 z-10">
<ModeToggle mode={mode} setMode={setMode} />
</div>
{/* Login Icon */}
<div className="absolute top-3 right-3 sm:right-4 z-10">
<LoginIcon />
</div>
{/* Balance Display */}
@@ -289,8 +295,6 @@ export function CashuWallet() {
balances={balances}
showSats={showSats}
setShowSats={setShowSats}
mode={mode}
setMode={setMode}
activeMintUrl={activeMintUrl}
setActiveMintUrl={handleSetActiveMintSync}
mints={mints}
@@ -410,9 +414,9 @@ export function CashuWallet() {
{/* Bottom Drawer Modals */}
<Drawer open={showSendModal} onOpenChange={setShowSendModal}>
<DrawerContent className="min-h-[50vh] max-h-[85vh]">
<DrawerContent className="min-h-[50vh] max-h-[85vh] max-w-4xl mx-auto">
<DrawerHeader>
<DrawerTitle>Send</DrawerTitle>
<DrawerTitle></DrawerTitle>
</DrawerHeader>
<div className="px-4 pb-4">
<SendCard
@@ -445,9 +449,9 @@ export function CashuWallet() {
</Drawer>
<Drawer open={showReceiveModal} onOpenChange={setShowReceiveModal}>
<DrawerContent className="min-h-[50vh] max-h-[85vh]">
<DrawerContent className="min-h-[50vh] max-h-[85vh] max-w-4xl mx-auto">
<DrawerHeader>
<DrawerTitle>Receive</DrawerTitle>
<DrawerTitle></DrawerTitle>
</DrawerHeader>
<div className="px-4 pb-4">
<ReceiveCard
+37
View File
@@ -0,0 +1,37 @@
import { Zap, Coins } from 'lucide-react';
import { useToast } from '@/hooks/useToast';
interface ModeToggleProps {
mode: 'tokens' | 'lightning';
setMode: (mode: 'tokens' | 'lightning') => void;
}
export function ModeToggle({ mode, setMode }: ModeToggleProps) {
const { toast } = useToast();
const toggleMode = () => {
const newMode = mode === 'tokens' ? 'lightning' : 'tokens';
setMode(newMode);
toast({
title: `${newMode === 'tokens' ? 'Cashu' : 'Lightning'} Enabled!`,
description: newMode === 'tokens'
? 'Send and receive with Cashu eCash'
: 'Send and receive with Lightning',
});
};
return (
<button
onClick={toggleMode}
className="px-3 py-2 rounded-lg bg-background hover:bg-background/80 transition-colors flex items-center justify-center"
title={mode === 'tokens' ? 'Switch to Lightning' : 'Switch to Cashu Tokens'}
>
{mode === 'tokens' ? (
<Coins className="h-6 w-6" />
) : (
<Zap className="h-6 w-6" />
)}
</button>
);
}
+28 -22
View File
@@ -24,10 +24,13 @@ export function ReceiveCard({
isLoading,
}: ReceiveCardProps) {
return (
<div className="space-y-6">
{/* Description */}
<div className="space-y-8">
{/* Title */}
<div className="text-center">
<p className="text-muted-foreground">
<h2 className="text-3xl font-bold text-foreground">
Receive
</h2>
<p className="!text-xl text-muted-foreground mt-2">
{mode === 'tokens'
? 'Enter Cashu token to redeem'
: 'Deposit funds with Lightning'
@@ -54,19 +57,20 @@ export function ReceiveCard({
onReceive();
}
}}
className="w-full"
disabled={!activeMintUrl}
autoFocus
className="w-full h-16 !text-xl text-center border-0 bg-transparent focus:ring-0 focus:ring-offset-0"
/>
<Button
onClick={onReceive}
disabled={!tokenInput.trim() || !activeMintUrl || isLoading}
className="w-full"
size="lg"
>
<Download className="h-4 w-4 mr-2" />
Receive
</Button>
<div className="flex justify-center mt-4">
<Button
onClick={onReceive}
disabled={!tokenInput.trim() || !activeMintUrl || isLoading}
className="h-12 px-8 rounded-full"
size="lg"
>
<Download className="h-5 w-5" />
</Button>
</div>
</div>
</>
) : (
@@ -89,16 +93,18 @@ export function ReceiveCard({
}}
disabled={!activeMintUrl}
autoFocus
className="w-full h-16 !text-xl text-center border-0 bg-transparent focus:ring-0 focus:ring-offset-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield]"
/>
<Button
onClick={onReceive}
disabled={!quoteAmount || !activeMintUrl || isLoading}
className="w-full"
size="lg"
>
<Zap className="h-4 w-4 mr-2" />
Quote
</Button>
<div className="flex justify-center mt-4">
<Button
onClick={onReceive}
disabled={!quoteAmount || !activeMintUrl || isLoading}
className="h-12 px-8 rounded-full"
size="lg"
>
<Zap className="h-5 w-5" />
</Button>
</div>
</div>
</>
)}
+36 -35
View File
@@ -38,10 +38,13 @@ export function SendCard({
isLoading,
}: SendCardProps) {
return (
<div className="space-y-6">
{/* Description */}
<div className="space-y-8">
{/* Title */}
<div className="text-center">
<p className="text-muted-foreground">
<h2 className="text-3xl font-bold text-foreground">
Send
</h2>
<p className="!text-xl text-muted-foreground mt-2">
{mode === 'tokens'
? 'Generate Cashu token to send'
: pendingLightningAddress
@@ -51,7 +54,7 @@ export function SendCard({
<span className="font-semibold text-foreground">{pendingLightningAddress}</span>
</span>
)
: 'Pay Lightning invoices or addresses from balance'
: 'Pay invoices or addresses'
}
</p>
</div>
@@ -78,16 +81,18 @@ export function SendCard({
}}
disabled={!activeMintUrl}
autoFocus
className="w-full h-16 !text-xl text-center border-0 bg-transparent focus:ring-0 focus:ring-offset-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield]"
/>
<Button
onClick={onSend}
disabled={!sendAmount || !activeMintUrl || isLoading}
className="w-full"
size="lg"
>
<Send className="h-4 w-4 mr-2" />
Send
</Button>
<div className="flex justify-center mt-4">
<Button
onClick={onSend}
disabled={!sendAmount || !activeMintUrl || isLoading}
className="h-12 px-8 rounded-full"
size="lg"
>
<Send className="h-5 w-5" />
</Button>
</div>
</div>
</>
) : (
@@ -112,24 +117,19 @@ export function SendCard({
}}
autoFocus
disabled={!activeMintUrl}
className="w-full h-16 !text-xl text-center border-0 bg-transparent focus:ring-0 focus:ring-offset-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield]"
/>
<div className="flex gap-2">
<div className="flex justify-center gap-2 mt-4">
<Button
onClick={onSend}
disabled={!lightningAddressAmount || !activeMintUrl || isResolvingAddress || isLoading}
className="flex-1"
className="h-12 px-8 rounded-full"
size="lg"
>
{isResolvingAddress ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
Sending...
</>
<Loader2 className="h-5 w-5 animate-spin" />
) : (
<>
<Zap className="h-4 w-4 mr-2" />
Pay
</>
<Zap className="h-5 w-5" />
)}
</Button>
<Button
@@ -139,10 +139,10 @@ export function SendCard({
setPendingLightningAddress(null);
setLightningAddressAmount('');
}}
className="h-12 w-12"
className="h-12 w-12 rounded-full"
title="Cancel"
>
<X className="h-4 w-4" />
<X className="h-5 w-5" />
</Button>
</div>
</div>
@@ -167,19 +167,20 @@ export function SendCard({
onSend();
}
}}
className="w-full"
disabled={!activeMintUrl}
autoFocus
className="w-full h-16 !text-xl text-center border-0 bg-transparent focus:ring-0 focus:ring-offset-0"
/>
<Button
onClick={onSend}
disabled={(!lightningInvoice.trim() && !lightningAddressInput.trim()) || !activeMintUrl || isLoading}
className="w-full"
size="lg"
>
<Zap className="h-4 w-4 mr-2" />
Pay
</Button>
<div className="flex justify-center mt-4">
<Button
onClick={onSend}
disabled={(!lightningInvoice.trim() && !lightningAddressInput.trim()) || !activeMintUrl || isLoading}
className="h-12 px-8 rounded-full"
size="lg"
>
<Zap className="h-5 w-5" />
</Button>
</div>
</div>
)}
</>