diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx index 2b6a9f1..66513e0 100644 --- a/packages/ui/src/App.tsx +++ b/packages/ui/src/App.tsx @@ -5,13 +5,13 @@ import { QRCodeSVG } from 'qrcode.react'; export const App = () => { const [word, setWord] = useState(''); - const [qrCode, setQrCode] = useState(''); const onSubmit = (e: React.FormEvent) => { e.preventDefault(); - setQrCode(constructAddWordUiCommand({ word, contractId: import.meta.env.VITE_CONTRACT_ADDRESS ?? '' })); }; + const qrCode = constructAddWordUiCommand({ word, contractId: import.meta.env.VITE_CONTRACT_ADDRESS ?? '' }); + return (
@@ -28,28 +28,24 @@ export const App = () => { value={word} onChange={(e) => setWord(e.target.value)} /> -
- { - navigator.clipboard.writeText(qrCode).catch((err) => { - console.error(err); - }); - }} - value={qrCode} - size={320} - level="L" - className="hover:cursor-pointer" - bgColor="transparent" - fgColor="black" - /> + {word && ( + { + navigator.clipboard.writeText(qrCode).catch((err) => { + console.error(err); + }); + }} + value={qrCode} + size={320} + level="L" + className="hover:cursor-pointer" + bgColor="transparent" + fgColor="black" + /> + )}
);