diff --git a/src/Title.tsx b/src/Title.tsx index 0a017f7..6e39795 100644 --- a/src/Title.tsx +++ b/src/Title.tsx @@ -6,6 +6,7 @@ import { OnResultFunction } from "@blackbox-vision/react-qr-reader/dist-types/ty import { BarcodeFormat } from "@zxing/library"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faQrcode } from "@fortawesome/free-solid-svg-icons/faQrcode"; +import { Dialog } from "@headlessui/react"; import useKeyboardShortcut from "use-keyboard-shortcut"; import PriceBox from "./PriceBox"; import { RuntimeContext } from "./useRuntime"; @@ -35,9 +36,9 @@ const Title: React.FC = () => { searchRef.current?.focus(); }); - const [isScanning, setScanning] = useState(); + const [isScanning, setScanning] = useState(false); const onScan = () => { - setScanning(!isScanning); + setScanning(true); }; const evaluateScan: OnResultFunction = (result, error, codeReader) => { console.log("scan"); @@ -49,68 +50,79 @@ const Title: React.FC = () => { return; } - if (searchRef.current) { - searchRef.current.value = text; - searchRef.current.dispatchEvent(new Event("input", { bubbles: true })); - } + history.push(`/search?q=${text}`); setScanning(false); } }; return ( -
- -
- An otter scanning - Otterscan -
- -
- {provider?.network.chainId === 1 && } -
- - - {isScanning && ( + <> + setScanning(false)} + > +
+ + + Point an ETH address QR code to camera + +
- )} -
+
+
+ +
+ An otter scanning + Otterscan +
+ +
+ {provider?.network.chainId === 1 && } + - Search - - + + + + +
-
+ ); };