redesigned camera modal with paste button

This commit is contained in:
lemonknowsall committed 2025-10-27 16:00:15 -07:00
1 parent df6989baf9
commit 5687faa746
3 files changed
+65 -72

No files matched your search

+36 -59
View File
@@ -5,6 +5,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { X, Coins, AlertTriangle, RefreshCw, Key, ArrowRightLeft, Loader2 } from 'lucide-react';
import { QRModal } from '@/components/ui/qr-modal';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { nip19 } from 'nostr-tools';
import { useToast } from '@/hooks/useToast';
import { UTXO } from '@/lib/bitcoin';
@@ -86,6 +87,7 @@ interface WalletModalProps {
setShowQRScanner: (show: boolean) => void;
stopScanning: () => Promise<void>;
qrError: string | null;
onPasteQRCode?: () => Promise<void>;
}
export function WalletModals({
@@ -124,6 +126,7 @@ export function WalletModals({
setShowQRScanner,
stopScanning,
qrError,
onPasteQRCode,
}: WalletModalProps) {
const { toast } = useToast();
@@ -483,85 +486,59 @@ export function WalletModals({
</div>
)}
{/* QR Scanner Modal - Full Screen Overlay */}
{showQRScanner && (
<div
style={{
{/* QR Scanner Modal */}
<Dialog open={showQRScanner} onOpenChange={(open) => {
if (!open) {
setShowQRScanner(false);
stopScanning();
}
}}>
<DialogContent
className="max-w-none w-screen h-screen !h-[100dvh] p-6 bg-background border-0 rounded-none !top-0 !left-0 !right-0 !bottom-0 !translate-x-0 !translate-y-0 flex flex-col"
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
width: '100vw',
height: '100dvh',
zIndex: 9999,
backgroundColor: '#000',
margin: 0,
padding: 0,
overflow: 'hidden'
transform: 'none',
maxWidth: '100vw',
maxHeight: '100vh',
}}
>
{/* Close button */}
<button
onClick={() => {
setShowQRScanner(false);
stopScanning();
}}
style={{
position: 'absolute',
top: '16px',
right: '16px',
zIndex: 10000,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
border: 'none',
borderRadius: '8px',
padding: '12px',
cursor: 'pointer',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
aria-label="Close scanner"
>
<X className="h-6 w-6 text-white" />
</button>
{/* Camera view */}
{/* Camera view with rounded corners */}
<div
id="qr-reader"
className="flex-1 rounded-2xl overflow-hidden"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
width: '100%',
height: '100%',
overflow: 'hidden'
}}
/>
{/* Error message */}
{qrError && (
<div
style={{
position: 'absolute',
bottom: '80px',
left: '16px',
right: '16px',
padding: '12px',
backgroundColor: 'rgb(239, 68, 68)',
color: 'white',
borderRadius: '8px',
zIndex: 10000,
textAlign: 'center'
}}
>
<div className="absolute bottom-28 left-6 right-6 p-3 bg-destructive text-destructive-foreground rounded-lg text-center z-50">
{qrError}
</div>
)}
</div>
)}
{/* Paste Button */}
<div className="mt-4 pb-safe flex justify-center">
<Button
onClick={async () => {
if (onPasteQRCode) {
await onPasteQRCode();
}
}}
className="rounded-full px-8"
size="lg"
>
Paste
</Button>
</div>
</DialogContent>
</Dialog>
</>
);
}