1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-15 18:32:33 +01:00
upscayl/renderer/pages/index.jsx

69 lines
2.3 KiB
React
Raw Normal View History

2022-08-15 10:23:14 +05:30
import { useState, useEffect, useRef } from "react";
const Home = () => {
2022-08-16 07:47:27 +05:30
const [imagePath, SetImagePath] = useState();
2022-08-17 08:07:50 +05:30
const [loaded, setLoaded] = useState(false);
2022-08-16 07:47:27 +05:30
2022-08-15 10:23:14 +05:30
useEffect(() => {
2022-08-17 11:20:57 +05:30
const handleMessage = (_event, args) => console.log(args)
window.electron.startListen(handleMessage)
2022-08-15 12:36:31 +05:30
// send(command, payload)
window.electron.send("sendMessage", { message: "Hello!" });
2022-08-17 08:07:50 +05:30
setLoaded(true);
window.electron.on("done", () => {
console.log("DONE");
});
2022-08-17 11:20:57 +05:30
return () => {
window.electron.stopListen(handleMessage)
}
2022-08-15 10:23:14 +05:30
}, []);
2022-08-16 07:47:27 +05:30
2022-08-15 15:42:48 +05:30
const imageHandler = async () => {
2022-08-17 08:07:50 +05:30
var path = await window.electron.send("open");
2022-08-16 07:47:27 +05:30
SetImagePath(path);
2022-08-17 08:07:50 +05:30
2022-08-16 07:47:27 +05:30
console.log(imagePath);
};
2022-08-15 10:23:14 +05:30
return (
2022-08-15 12:51:12 +05:30
<div className="flex h-screen w-screen flex-row bg-neutral-900">
<div className="flex h-screen w-96 flex-col bg-neutral-800 p-5">
<h1 className="text-3xl font-bold text-neutral-50">Upscayl</h1>
<div className="mt-10">
<p className="mb-2 font-medium text-neutral-100">Step 1</p>
2022-08-16 07:47:27 +05:30
<button className="rounded-lg bg-sky-400 p-3" onClick={imageHandler}>
Select Image
</button>
2022-08-15 12:51:12 +05:30
</div>
<div className="mt-10">
<p className="mb-2 font-medium text-neutral-100">Step 2</p>
<p className="mb-1 text-neutral-300">Select Scale Factor:</p>
<div className="flex flex-row gap-2">
<button className="rounded-lg bg-red-400 p-3">2x</button>
<button className="rounded-lg bg-red-400 p-3">4x</button>
<button className="rounded-lg bg-red-400 p-3">6x</button>
</div>
</div>
<div className="mt-10">
<p className="mb-2 font-medium text-neutral-100">Step 3</p>
<button className="rounded-lg bg-violet-400 p-3">
Set Output Folder
</button>
</div>
<div className="mt-10">
<p className="mb-2 font-medium text-neutral-100">Step 4</p>
<button className="rounded-lg bg-green-400 p-3">Upscayl</button>
</div>
</div>
<div className="flex h-screen w-full flex-col items-center justify-center p-5">
<p className="text-lg font-medium text-neutral-400">
Select an Image to Upscale
</p>
2022-08-15 10:23:14 +05:30
</div>
</div>
);
};
export default Home;