fix: a couple of qr-scanner issues

This commit is contained in:
trafficlunar 2025-05-23 16:08:41 +01:00
parent 36f0ff8398
commit 0ace0f1703

View file

@ -104,6 +104,7 @@ export default function QrScanner({ isOpen, setIsOpen, setQrBytesRaw }: Props) {
if (!isOpen) return; if (!isOpen) return;
requestPermission(); requestPermission();
if (!navigator.mediaDevices.enumerateDevices) return;
navigator.mediaDevices.enumerateDevices().then((devices) => { navigator.mediaDevices.enumerateDevices().then((devices) => {
const videoDevices = devices.filter((d) => d.kind === "videoinput"); const videoDevices = devices.filter((d) => d.kind === "videoinput");
setDevices(videoDevices); setDevices(videoDevices);
@ -136,7 +137,7 @@ export default function QrScanner({ isOpen, setIsOpen, setQrBytesRaw }: Props) {
> >
<div className="flex justify-between items-center mb-2"> <div className="flex justify-between items-center mb-2">
<h2 className="text-xl font-bold">Scan QR Code</h2> <h2 className="text-xl font-bold">Scan QR Code</h2>
<button onClick={close} className="text-red-400 hover:text-red-500 text-2xl cursor-pointer"> <button type="button" onClick={close} className="text-red-400 hover:text-red-500 text-2xl cursor-pointer">
<Icon icon="material-symbols:close-rounded" /> <Icon icon="material-symbols:close-rounded" />
</button> </button>
</div> </div>