mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
added qr code scanner
This commit is contained in:
1 parent
97613fc5b2
commit
a432716f47
5 files changed
+285
-6
No files matched your search
@@ -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';
|
||||
@@ -80,6 +81,12 @@ interface WalletModalProps {
|
||||
isRestoring: boolean;
|
||||
mints: Array<{ url: string; name?: string }>;
|
||||
activeMintUrl: string | null;
|
||||
|
||||
// QR Scanner Modal
|
||||
showQRScanner: boolean;
|
||||
setShowQRScanner: (show: boolean) => void;
|
||||
stopScanning: () => Promise<void>;
|
||||
qrError: string | null;
|
||||
}
|
||||
|
||||
export function WalletModals({
|
||||
@@ -114,6 +121,10 @@ export function WalletModals({
|
||||
isRestoring,
|
||||
mints,
|
||||
activeMintUrl,
|
||||
showQRScanner,
|
||||
setShowQRScanner,
|
||||
stopScanning,
|
||||
qrError,
|
||||
}: WalletModalProps) {
|
||||
const { toast } = useToast();
|
||||
|
||||
@@ -472,6 +483,28 @@ export function WalletModals({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* QR Scanner Modal */}
|
||||
{showQRScanner && (
|
||||
<Dialog open={showQRScanner} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
setShowQRScanner(false);
|
||||
stopScanning();
|
||||
}
|
||||
}}>
|
||||
<DialogContent className="max-w-full h-screen flex flex-col items-center justify-center p-0 bg-black border-0 [&>button]:text-white [&>button]:hover:bg-black/70">
|
||||
{/* Centered QR Scanner */}
|
||||
<div className="flex-1 w-full relative flex items-center justify-center">
|
||||
<div id="qr-reader" className="w-full h-full"></div>
|
||||
{qrError && (
|
||||
<div className="absolute top-4 left-4 right-4 p-3 bg-destructive text-destructive-foreground rounded">
|
||||
{qrError}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user