Skip to content

Commit 89f2c0a

Browse files
author
man2k
committed
UI refactor
1 parent 1d185b2 commit 89f2c0a

File tree

12 files changed

+146
-77
lines changed

12 files changed

+146
-77
lines changed

Server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22

3+
.jpg

Windows_Client_Tauri/Encryption_Client_Windows/package-lock.json

Lines changed: 35 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Windows_Client_Tauri/Encryption_Client_Windows/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"canvas": "^2.11.2",
1616
"crypto-js": "^4.1.1",
1717
"file-saver": "^2.0.5",
18+
"framer-motion": "^10.12.4",
1819
"jimp": "^0.22.7",
1920
"js-file-download": "^0.4.12",
2021
"js-sha256": "^0.9.0",

Windows_Client_Tauri/Encryption_Client_Windows/src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"fullscreen": false,
4242
"resizable": true,
4343
"title": "client",
44-
"width": 800,
45-
"height": 600
44+
"width": 1280,
45+
"height": 720
4646
}
4747
]
4848
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}

Windows_Client_Tauri/Encryption_Client_Windows/src/App.jsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ import Card from "./Components/Card";
1616
import SelectBox from "./Components/SelectBox";
1717
import ImgSteganography from "./Components/ImgSteganography";
1818

19-
const baseUrl = "http://localhost:3000";
19+
const baseUrl = "https://enc-dec-uem-prod.vercel.app";
2020

2121
function App() {
2222
//States
2323
const [file, setFile] = useState();
24+
const [fileDec, setFileDec] = useState();
2425
const [UserChoice, setChoice] = useState("");
2526
const [UserDecChoice, setDecChoice] = useState("");
2627
const [key, setKey] = useState("");
@@ -32,21 +33,28 @@ function App() {
3233
const handleFile = (e) => {
3334
setFile(e.target.files[0]);
3435
};
36+
const handleFileDec = (e) => {
37+
setFileDec(e.target.files[0]);
38+
// console.log(fileDec);
39+
};
3540

36-
const handleForm = async (e) => {
41+
const handleForm = async (e, opname) => {
3742
e.preventDefault();
43+
// console.log(opname);
3844
const formData = new FormData();
3945
try {
40-
formData.append("file", file);
41-
formData.append("fileName", file.name);
46+
formData.append("file", opname === "enc" ? file : fileDec);
47+
formData.append("fileName", opname === "enc" ? file.name : fileDec.name);
4248
const config = {
4349
headers: {
4450
"Content-Type": "multipart/form-data; boundary=MyBoundary",
4551
},
4652
};
47-
await axios.post(`${baseUrl}/upload`, formData, config).then((res) => {
48-
setUploaded(true);
49-
});
53+
await axios
54+
.post(`${baseUrl}/upload/${opname}`, formData, config)
55+
.then((res) => {
56+
setUploaded(true);
57+
});
5058
} catch (error) {
5159
console.log(error);
5260
}
@@ -69,7 +77,7 @@ function App() {
6977
};
7078

7179
const handleDecrypt = async () => {
72-
const url = `${baseUrl}/decrypt/${UserChoice}`;
80+
const url = `${baseUrl}/decrypt/${UserDecChoice}`;
7381

7482
const json = JSON.stringify({ key: keyDec });
7583
let fileName;
@@ -104,7 +112,11 @@ function App() {
104112
<div>
105113
<h1 className="w-full mb-5">Encryption</h1>
106114
<div className="flex flex-col w-full space-y-5">
107-
<FormBox handleForm={handleForm} handleFile={handleFile} />
115+
<FormBox
116+
name="enc"
117+
handleForm={handleForm}
118+
handleFile={handleFile}
119+
/>
108120
<SelectBox setChoice={setChoice} type="Encryption" />
109121
<div>
110122
<ButtonEnc
@@ -121,19 +133,27 @@ function App() {
121133
<div>
122134
<h1 className="w-full mb-5">Decryption</h1>
123135
<div className="flex flex-col w-full space-y-5">
124-
<FormBox handleForm={handleForm} handleFile={handleFile} />
136+
<FormBox
137+
name="dec"
138+
handleForm={handleForm}
139+
handleFile={handleFileDec}
140+
/>
125141
<SelectBox setChoice={setDecChoice} type="Decryption" />
126142
{UserDecChoice && <InputKeyBox setKeyDec={setKeyDec} />}
127143
<div>
128144
{keyDec && (
129-
<ButtonDec handleDecrypt={handleDecrypt} keyDec={keyDec} />
145+
<ButtonDec
146+
handleDecrypt={handleDecrypt}
147+
keyDec={keyDec}
148+
UserChoice={UserDecChoice}
149+
/>
130150
)}
131151
</div>
132152
</div>
133153
</div>
134154
</div>
135155

136-
<div className="flex flex-row justify-around mb-5">
156+
<div className="flex flex-row justify-between mb-10 gap-5">
137157
<EncodeDecodeKey />
138158
<ImgSteganography />
139159
</div>

Windows_Client_Tauri/Encryption_Client_Windows/src/Components/EncodeDecodeKey.jsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from "react";
22
import ZwspSteg from "zwsp-steg";
3-
3+
import { motion } from "framer-motion";
44
const EncodeDecodeKey = () => {
55
const [input, setInput] = useState("");
66
const [decInput, setDecInput] = useState("");
@@ -43,7 +43,12 @@ const EncodeDecodeKey = () => {
4343
}
4444

4545
return (
46-
<div className="flex flex-col mt-16 bg-gray-900">
46+
<motion.div
47+
className="flex flex-col mt-16 bg-inherit p-5 w-full h-full"
48+
animate={{ transform: "rotateY(360deg)" }}
49+
transition={{ type: "spring", stiffness: 100, mass: 1, duration: 0.1 }}
50+
key={encodeDecode}
51+
>
4752
<div className="flex justify-center">
4853
<input
4954
className="appearance-none checked:bg-blue-500 form-checkbox h-5 w-5 text-gray-600 mt-3"
@@ -54,25 +59,25 @@ const EncodeDecodeKey = () => {
5459
/>
5560
</div>
5661
{encodeDecode ? (
57-
<h1 className="text-slate-800 mb-5 mt-3">Invisible Encoding</h1>
62+
<h1 className="text-white mb-5 mt-3">Invisible Encoding</h1>
5863
) : (
59-
<h1 className="text-slate-800 mb-5 mt-3">Invisible Decoding</h1>
64+
<h1 className="text-white mb-5 mt-3">Invisible Decoding</h1>
6065
)}
6166
<div>
6267
<div>
6368
{encodeDecode ? (
64-
<label className="text-slate-900" htmlFor="input-secret">
69+
<label className="text-white" htmlFor="input-secret">
6570
Input Secret Message
6671
</label>
6772
) : (
68-
<label className="text-slate-900" htmlFor="input-secret">
73+
<label className="text-white" htmlFor="input-secret">
6974
Input your encoded Message
7075
</label>
7176
)}
7277
</div>
7378
<div>
7479
<input
75-
className="text-slate-500 mt-3 mb-3"
80+
className="text-white mt-3 mb-3"
7681
type="text"
7782
id="secret-message"
7883
accept="text"
@@ -83,15 +88,15 @@ const EncodeDecodeKey = () => {
8388
<div>
8489
{encodeDecode && (
8590
<div>
86-
<label className="text-slate-900" htmlFor="salt">
91+
<label className="text-white" htmlFor="salt">
8792
Enter any salt/story you want your secret in
8893
</label>
8994
</div>
9095
)}
9196
{encodeDecode && (
9297
<div>
9398
<input
94-
className="text-slate-900 mt-3 mb-3"
99+
className="text-white mt-3 mb-3"
95100
type="text"
96101
id="secret-message"
97102
accept="text"
@@ -149,7 +154,7 @@ const EncodeDecodeKey = () => {
149154
</div>
150155
)}
151156
</div>
152-
</div>
157+
</motion.div>
153158
);
154159
};
155160

Windows_Client_Tauri/Encryption_Client_Windows/src/Components/FormBox.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import React from "react";
22
// import { useState } from "react";
33

44
const FormBox = (props) => {
5+
console.log(props.name);
56
return (
67
<div className="flex w-full">
7-
<form id="UploadForm" onSubmit={props.handleForm}>
8+
<form id="UploadForm" onSubmit={(e) => props.handleForm(e, props.name)}>
89
<input
9-
className="block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-1 file:border-dashed hover:file:border-dotted file:text-sm file:font-semibold file:bg-green-50 file:text-violet-700 hover:file:bg-green-100"
10+
key={props.name}
11+
className="block w-full text-sm file:text-black text-white file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-2 file:border-black file:border-dashed hover:file:border-dotted file:text-sm file:font-semibold file:bg-green-50 file:text-violet-700 hover:file:bg-green-100"
1012
type="file"
1113
name="file"
1214
onChange={props.handleFile}

0 commit comments

Comments
 (0)