Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson committed Nov 28, 2023
1 parent 74989f9 commit 2dc8d21
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions taxonium_website/src/components/InputSupplier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,25 @@ export const InputSupplier = ({ inputHelper, className }) => {
});

const [tempURL, setTempURL] = useState("");
const [useProxy, setUseProxy] = useState(true); // New state for proxy usage


const { inputs, setInputs } = inputHelper;
const [addingText, setAddingText] = useState(false);
const [text, setText] = useState("");


const addFromTempURL = useCallback(() => {
if (tempURL) {
inputHelper.addFromURL(tempURL);
let finalURL = tempURL;
if (useProxy) {
finalURL = `https://proxy.taxonium.org/proxy?url=${encodeURIComponent(tempURL)}`;
}
if (finalURL) {
inputHelper.addFromURL(finalURL);
setTempURL("");
}
}, [tempURL, inputHelper]);
}, [tempURL, useProxy, inputHelper]); // Include useProxy in the dependency array


return (
<div className={className}>
Expand Down Expand Up @@ -196,6 +204,17 @@ export const InputSupplier = ({ inputHelper, className }) => {
}
}}
/>{" "}
{
tempURL !== "" && <>
<input
type="checkbox"
checked={useProxy}
onChange={(e) => setUseProxy(e.target.checked)}
/>{" "}
Use Proxy
</>
}

<Button onClick={addFromTempURL} className="">
Add
</Button>
Expand Down

0 comments on commit 2dc8d21

Please sign in to comment.