Skip to content

Commit aa4ede8

Browse files
committed
canvas added
1 parent e44c6cc commit aa4ede8

File tree

7 files changed

+31
-11
lines changed

7 files changed

+31
-11
lines changed

front-end/src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function App() {
1616

1717
<Route path="/admin/dashboard" element={<AdminDashboard />} />
1818

19-
<Route path="/signup" element={<Signup />} />
19+
<Route path="/" element={<Signup />} />
2020

2121
<Route path="/login/patient" element={<Login />} />
2222

front-end/src/Components/Admin/Canvas.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState, useRef } from "react";
22
import { ReactSketchCanvas } from "react-sketch-canvas";
33
import logo1 from "../../assets/logo1.svg";
44
import { ColorPicker, useColor } from "react-color-palette";
5+
import emailicon from "../../assets/icons/email.svg"
56
import "react-color-palette/lib/css/styles.css";
67
import axios from "axios";
78
const styles = {
@@ -19,6 +20,7 @@ const Canvas = () => {
1920
const presData = new FormData();
2021
presData.append("email", email);
2122
presData.append("path", prescription);
23+
2224

2325
const exportImage = () => {
2426
thiscanvas.current
@@ -39,14 +41,18 @@ const Canvas = () => {
3941
})
4042
.then((response) => {
4143
console.log(response);
44+
window.location.href="/admin/dashboard"
4245
})
4346
.catch((err) => console.log(err));
4447
};
4548

4649
return (
4750
<div className="bg-[#E5FFFE]">
48-
<img src={logo1} className="p-4" />
51+
<img src={logo1} className="p-4" onClick={()=>{
52+
window.location.href="/dashboard"
53+
}}/>
4954
<div className="h-[100vh] w-[80vw] m-auto mt-4 overflow ">
55+
5056
<div className="flex">
5157
<div className="h-[100vh] w-[80vw] m-2">
5258
<ReactSketchCanvas

front-end/src/Components/Admin/Header.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ function Header() {
88
const [input, setInput] = useState("");
99
const date = new Date().toLocaleDateString();
1010
var [time,setTime] = useState(new Date());
11-
11+
const email = localStorage.getItem('email')
1212
useEffect(() => {
1313
var timer = setInterval(()=>setTime(new Date()), 1000 )
1414
return function cleanup() {
1515
clearInterval(timer)
1616
}
1717

1818
});
19+
if(!localStorage.getItem("email")){
20+
window.location.href="/login/admin";
21+
}
1922
return (
2023
<div>
2124
<div className="flex justify-between mb-6">
@@ -24,6 +27,9 @@ function Header() {
2427
<div className="flex ml-auto ">
2528
<img className="mr-3 w-8" alt="User" src={User} />
2629
<h2 className="font-bold">Bruh Singh</h2>
30+
<button className="p-2 px-4 ml-2 bg-[#23776E] text-white rounded-lg" onClick={()=>{
31+
localStorage.removeItem('email')
32+
}}>Sign Out</button>
2733
</div>
2834
</div>
2935
<div className="flex">

front-end/src/Components/Dashboard/Header.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ function Header() {
99
const [input, setInput] = useState("");
1010
const date = new Date().toLocaleDateString();
1111
var [time, setTime] = useState(new Date());
12-
12+
const email = localStorage.getItem('email')
1313
useEffect(() => {
1414
var timer = setInterval(() => setTime(new Date()), 1000);
1515
return function cleanup() {
1616
clearInterval(timer);
1717
};
1818
});
19+
if(!localStorage.getItem("email")){
20+
window.location.href="/login/patient";
21+
}
1922
return (
2023
<motion.div
2124
initial={{ y: -20, opacity: 0 }}
@@ -46,7 +49,10 @@ function Header() {
4649
className="flex justify-center items-center"
4750
>
4851
<img className="mr-3 w-8" alt="User" src={User} />
49-
<h2 className="font-bold">Bruh Singh</h2>
52+
<h2 className="font-bold">{email}</h2>
53+
<button className="p-2 px-4 ml-2 bg-[#23776E] text-white rounded-lg" onClick={()=>{
54+
localStorage.removeItem('email')
55+
}}>Sign Out</button>
5056
</motion.div>
5157
</div>
5258
<div className="flex">

front-end/src/Components/Dashboard/Prescription.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Prescription() {
55
const email = localStorage.getItem("email");
66
const emailData = new FormData();
77
emailData.append("email", email);
8-
const [pres, setPres] = useState();
8+
const [Pres, setPres] = useState([]);
99

1010
useEffect(() => {
1111
axios({
@@ -23,10 +23,11 @@ function Prescription() {
2323
return (
2424
<div className="w-[70vw] h-[70vh] p-4 m-4 bg-[#75c6bc7e] overflow-y-scroll rounded-2xl">
2525
<div className="mb-2 font-extrabold text-[#499189] ">Prescription</div>
26-
<div className="mb-6 font-extrabold text-[#499189]">John Doe</div>
26+
<div className="mb-6 font-extrabold text-[#499189] ">John Doe</div>
2727
<div>
28-
{pres.map((p) => {
29-
return <img src={p} alt="Prescription" />;
28+
{Pres.map((p) => {
29+
return <>
30+
<img src={p} alt="Prescription" className="mx-auto"/></>;
3031
})}
3132
</div>
3233
</div>

front-end/src/Components/LogininDoc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ const LoginAdmin = () => {
1515
const [email, setemail] = useState("");
1616
const [password, setpassword] = useState("");
1717
const [show, setshow] = useState(false);
18-
18+
1919
const handleSubmit = (e) => {
2020
e.preventDefault();
2121
const signUpData = new FormData();
22+
localStorage.setItem('demail',email)
2223
console.log(email, password);
2324
signUpData.append("email", email);
2425
signUpData.append("password", password);

front-end/src/Components/Signup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const Signup = () => {
165165
<p className="mr-1">Already have an account? </p>
166166
<strong>
167167
<a href="/login/patient" className="text-[#23776E]">
168-
Login
168+
Sign Up
169169
</a>
170170
</strong>
171171
</div>

0 commit comments

Comments
 (0)