remove dialog dependency for camera modal

This commit is contained in:
lemonknowsall committed 2025-10-27 15:47:18 -07:00
1 parent 025cd9ed5e
commit df6989baf9
2 files changed
+81 -36

No files matched your search

+12
View File
@@ -336,8 +336,20 @@ export function CashuWallet() {
// Start/stop QR scanner when modal opens/closes
useEffect(() => {
if (showQRScanner) {
// Lock body scroll on mobile
document.body.style.overflow = 'hidden';
document.body.style.position = 'fixed';
document.body.style.width = '100%';
document.body.style.height = '100%';
startScanning(handleQRScanResult);
} else {
// Restore body scroll
document.body.style.overflow = '';
document.body.style.position = '';
document.body.style.width = '';
document.body.style.height = '';
stopScanning();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
+69 -36
View File
@@ -5,7 +5,6 @@ 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';
@@ -484,50 +483,84 @@ export function WalletModals({
</div>
)}
{/* QR Scanner Modal */}
{/* QR Scanner Modal - Full Screen Overlay */}
{showQRScanner && (
<Dialog open={showQRScanner} onOpenChange={(open) => {
if (!open) {
setShowQRScanner(false);
stopScanning();
}
}}>
<DialogContent
className="max-w-none w-screen h-[100dvh] p-0 m-0 bg-black border-0 rounded-none !top-0 !left-0 !right-0 !bottom-0 !translate-x-0 !translate-y-0 flex flex-col overflow-hidden [&>button]:absolute [&>button]:top-4 [&>button]:right-4 [&>button]:z-50 [&>button]:text-white [&>button]:bg-black/50 [&>button]:hover:bg-black/70"
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
transform: 'none',
maxWidth: '100vw',
maxHeight: '100dvh',
height: '100dvh',
width: '100vw',
margin: 0,
padding: 0,
inset: 0
<div
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'
}}
>
{/* 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"
>
<div id="qr-reader" style={{
<X className="h-6 w-6 text-white" />
</button>
{/* Camera view */}
<div
id="qr-reader"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
width: '100%',
height: '100%'
}}></div>
{/* Error message */}
{qrError && (
<div className="absolute bottom-20 left-4 right-4 p-3 bg-destructive text-destructive-foreground rounded z-50">
{qrError}
</div>
)}
</DialogContent>
</Dialog>
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'
}}
>
{qrError}
</div>
)}
</div>
)}
</>
);