React client app #5

Merged
CrispyBaguette merged 18 commits from react-client-app into master 2021-12-12 17:42:16 +00:00
Showing only changes of commit a8f15df46d - Show all commits

View File

@ -1,9 +1,8 @@
import React, { useEffect } from "react";
import React from "react";
import "./App.css";
function App() {
const [imageSrc, setImageSrc] = React.useState("");
const [displayOutput, setDisplayOutput] = React.useState(false);
const fileInput = React.useRef<HTMLInputElement>(null);
const handleClick = async () => {
@ -12,7 +11,6 @@ function App() {
}
const workerProxy: any = await wasmWorker("main.wasm");
setDisplayOutput(false);
setImageSrc("");
// Check if a file was selected
@ -28,7 +26,6 @@ function App() {
const ditheredImage = await workerProxy.DitherNord(imageData);
const outputValue = `data:image/png;base64,${ditheredImage}`;
setImageSrc(outputValue);
setDisplayOutput(true);
}
};
};
@ -50,7 +47,7 @@ function App() {
id="output"
alt="dithering output"
src={imageSrc}
style={{ display: displayOutput ? "block" : "none" }}
style={{ display: imageSrc !== "" ? "block" : "none" }}
/>
</div>
</a>