diff --git a/frontend/src/components/NewGameModal.jsx b/frontend/src/components/NewGameModal.jsx index 912b783..ad1e1fb 100644 --- a/frontend/src/components/NewGameModal.jsx +++ b/frontend/src/components/NewGameModal.jsx @@ -51,10 +51,11 @@ export default function NewGameModal({ }, [open, hasGame, gameFinished]); useEffect(() => { - if (!qrOpen || !created?.code) return; - QRCode.toDataURL(created.code, { width: 280, margin: 2, errorCorrectionLevel: "M", color: { dark: "#17161b", light: "#f5efdc" } }) + const qrValue = created?.code || currentCode; + if (!qrOpen || !qrValue) return; + QRCode.toDataURL(qrValue, { width: 280, margin: 2, errorCorrectionLevel: "M", color: { dark: "#17161b", light: "#f5efdc" } }) .then(setQrDataUrl).catch(() => setQrDataUrl("")); - }, [qrOpen, created?.code]); + }, [qrOpen, created?.code, currentCode]); useEffect(() => { if (!scannerOpen) return undefined; @@ -215,6 +216,13 @@ export default function NewGameModal({ > ⧉ {t("copy")} {language === "en" ? "code" : "Code"} + + {qrOpen && qrDataUrl &&