From 4a65994d3549f9287d539b591e1a63dbf0f3ef29 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Tue, 8 Apr 2025 22:51:43 +0100 Subject: [PATCH] refactor: cleanup --- src/app/components/carousel.tsx | 2 +- src/app/components/submit/qr-scanner.tsx | 140 +++++++++++------------ 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/app/components/carousel.tsx b/src/app/components/carousel.tsx index 73749cc..db49c9e 100644 --- a/src/app/components/carousel.tsx +++ b/src/app/components/carousel.tsx @@ -25,7 +25,7 @@ export default function Carousel({ images, className }: Props) { const scrollNext = useCallback(() => emblaApi && emblaApi.scrollNext(), [emblaApi]); return ( -
+
{images.map((src, index) => ( diff --git a/src/app/components/submit/qr-scanner.tsx b/src/app/components/submit/qr-scanner.tsx index 216fead..d401163 100644 --- a/src/app/components/submit/qr-scanner.tsx +++ b/src/app/components/submit/qr-scanner.tsx @@ -104,82 +104,82 @@ export default function QrScanner({ isOpen, setIsOpen, setQrBytesRaw }: Props) { requestRef.current = requestAnimationFrame(scanQRCode); }, [permissionGranted]); - if (isOpen) - return ( -
-
-
-

Scan QR Code

- -
+ if (!isOpen) return null; - {devices.length > 0 && ( -
- -
- {/* Toggle button to open the dropdown */} - +
- - + {devices.length > 0 && ( +
+ +
+ {/* Toggle button to open the dropdown */} +
+ + + + {/* Dropdown menu */} +
    + {isDropdownOpen && + cameraItems.map((item, index) => ( +
  • + {item.label} +
  • + ))} +
+
+ )} + +
+ {!permissionGranted ? ( +
+

Camera access denied

+

Please allow camera access in your browser settings to scan QR codes

+ +
+ ) : ( + <> + + + + )} +
-
- {!permissionGranted ? ( -
-

Camera access denied

-

Please allow camera access in your browser settings to scan QR codes

- -
- ) : ( - <> - - - - - )} -
- -
- -
+
+
- ); - else return null; +
+ ); }