diff --git a/extension/popup.jsx b/extension/popup.jsx index 118a332..4259559 100644 --- a/extension/popup.jsx +++ b/extension/popup.jsx @@ -6,24 +6,10 @@ import QRCode from 'react-qr-code' function Popup() { let [pubKey, setPubKey] = useState('') - let [privKey, setPrivKey] = useState('') let keys = useRef([]) - let [showQR, setShowQR] = useState('') - - const QrIcon = () => ( - - ) useEffect(() => { browser.storage.local.get(['private_key', 'relays']).then(results => { - setPrivKey(results.private_key) - if (results.private_key) { let hexKey = getPublicKey(results.private_key) let npubKey = nip19.npubEncode(hexKey) @@ -56,59 +42,51 @@ function Popup() { }, []) return ( - <> -
- you don't have a private key set. use the options page to set one. -
- ) : ( - <> -- ↩️ your public key: -
-+ <> +nos2x
+ {pubKey === null ? ( ++ you don't have a private key set. use the options page to set one. +
+ ) : ( + <> ++ ↩️ your public key: +
+- - - - - { showQR && ( -{pubKey}- {showQR === 'priv' ? (- )} - > - )} - > +PRIVATE KEY
) : (PUBLIC KEY
)} -- ++ > + )} + > ) function toggleKeyType(e) { e.preventDefault() let nextKeyType = - keys.current[(keys.current.indexOf(pubKey) + 1) % keys.current.length] + keys.current[(keys.current.indexOf(pubKey) + 1) % keys.current.length] setPubKey(nextKeyType) } }+