mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
updated modal and full scan camera
This commit is contained in:
1 parent
204fc46c48
commit
1b285ff53f
2 files changed
+26
-10
No files matched your search
@@ -493,15 +493,32 @@ export function WalletModals({
|
|||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<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">
|
<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 */}
|
{/* Full-screen camera container */}
|
||||||
<div className="flex-1 w-full relative flex items-center justify-center">
|
<div className="absolute inset-0">
|
||||||
<div id="qr-reader" className="w-full h-full"></div>
|
<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>
|
</div>
|
||||||
|
|
||||||
|
{/* Dark overlay with centered square cutout */}
|
||||||
|
<div className="absolute inset-0 pointer-events-none">
|
||||||
|
{/* Top overlay */}
|
||||||
|
<div className="absolute top-0 left-0 right-0 h-[calc(50vh-150px)] bg-black/60"></div>
|
||||||
|
{/* Bottom overlay */}
|
||||||
|
<div className="absolute bottom-0 left-0 right-0 h-[calc(50vh-150px)] bg-black/60"></div>
|
||||||
|
{/* Left overlay */}
|
||||||
|
<div className="absolute top-[calc(50vh-150px)] bottom-[calc(50vh-150px)] left-0 right-[calc(50vw+150px)] bg-black/60"></div>
|
||||||
|
{/* Right overlay */}
|
||||||
|
<div className="absolute top-[calc(50vh-150px)] bottom-[calc(50vh-150px)] left-[calc(50vw+150px)] right-0 bg-black/60"></div>
|
||||||
|
|
||||||
|
{/* Centered square boundary box */}
|
||||||
|
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[300px] h-[300px] border-2 border-white rounded-lg"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Error message */}
|
||||||
|
{qrError && (
|
||||||
|
<div className="absolute top-20 left-4 right-4 p-3 bg-destructive text-destructive-foreground rounded z-50">
|
||||||
|
{qrError}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export function useQRCode(): UseQRCodeReturn {
|
|||||||
|
|
||||||
// Use the rear camera by default, or first available
|
// Use the rear camera by default, or first available
|
||||||
const cameraId = devices.length > 1
|
const cameraId = devices.length > 1
|
||||||
? devices.find(d => d.label.toLowerCase().includes('back') || d.label.toLowerCase().includes('rear') || d.label.toLowerCase().includes('environment'))?.id || devices[0].id
|
? devices.find(d => d.label.toLowerCase().includes('back') || d.label.toLowerCase().includes('rear'))?.id || devices[0].id
|
||||||
: devices[0].id;
|
: devices[0].id;
|
||||||
|
|
||||||
// Initialize scanner
|
// Initialize scanner
|
||||||
@@ -122,8 +122,7 @@ export function useQRCode(): UseQRCodeReturn {
|
|||||||
await scanner.start(
|
await scanner.start(
|
||||||
cameraId,
|
cameraId,
|
||||||
{
|
{
|
||||||
fps: 10,
|
fps: 10
|
||||||
qrbox: { width: 250, height: 250 },
|
|
||||||
},
|
},
|
||||||
(decodedText) => {
|
(decodedText) => {
|
||||||
const result = classifyQRCode(decodedText);
|
const result = classifyQRCode(decodedText);
|
||||||
|
|||||||
Reference in new issue
Block a user