Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jol17: View manager add #15

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# REACT_APP_{NAME}

REACT_APP_API_URL=http://localhost:8080
REACT_APP_SECRET_KEY=my_secret_key
3 changes: 2 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from "./features/authentication/authenticationSlice";
import getWeb3 from "./getWeb3";
import HomePage from "./pages/HomePage";
import ManagerPage from "./pages/ManagerPage";
const jwt = require("jsonwebtoken");

const App = () => {
Expand Down Expand Up @@ -94,7 +95,7 @@ const App = () => {
<PrivateRoute path="/medical-records" component={HomePage} />
<PrivateRoute path="/vaccination-certificates" component={HomePage} />
<PrivateRoute path="/doctors" component={HomePage} />
<PrivateRoute path="/managers" component={HomePage} />
<PrivateRoute path="/managers" component={ManagerPage} />
<PrivateRoute path="/settings" component={HomePage} />
<Route path="/login" component={AuthenticationPage} />
<Route component={NotFound} />
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Sidebar() {
<NavLink
to="/settings"
className={(isActive) =>
"sidebar__item last-item" + (isActive ? " active-item" : "")
"sidebar__item" + (isActive ? " active-item" : "")
}
>
<IoSettingsSharp className="sidebar__icon" />
Expand Down
38 changes: 18 additions & 20 deletions client/src/components/Sidebar/styles.scss
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
.sidebar__wrapper {
position: absolute;
position: fixed;
left: 0;
top: 15%;
height: 80%;
width: 6%;
background-color: #29a9f5;
top: 10%;
border-radius: 6px;
border-radius: 0 6px 6px 0;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.33);
padding: 33px 0;
z-index: 10;

.sidebar__list-item {
height: 100%;
position: relative;
overflow-x: auto;
padding-left: 10px;

.sidebar__item {
position: relative;
padding: 20px;
cursor: pointer;
margin-left: auto;
width: 80%;
height: 80px;
display: flex;
justify-content: center;
align-items: center;
background-color: #29a9f5;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
border-radius: 10px 0 0 10px;
transition: 0.2s;

&:hover {
transform: scale(1.05);
}

.sidebar__icon {
color: #fff;
width: 48px;
height: 48px;
width: 35px;
height: 35px;
}
}

.active-item {
background-color: #fff;

.sidebar__icon {
color: #29a9f5;
}
}

.last-item {
position: absolute;
bottom: 0;
right: 0;
}
}
}
33 changes: 33 additions & 0 deletions client/src/features/manager/AddForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import "./styles.scss";
import {useForm} from "react-hook-form";
import {ErrorMessage} from "@hookform/error-message";

function AddManagerForm() {
const {
register,
handleSubmit,
formState: {errors},
} = useForm();

const onSubmit = (data) => {
console.log(data);
};

return (
<form className="add-manager-form" onSubmit={handleSubmit(onSubmit)} id="add-manager-form">
<input
{...register("address", {required: "This is required."})}
className="form-control"
placeholder="New manager address..."
/>
<ErrorMessage
errors={errors}
name="address"
render={({message}) => <p>{message}</p>}
/>
<button type="button" className="btn btn-primary">ADD</button>
</form>
);
}
export default AddManagerForm;
20 changes: 20 additions & 0 deletions client/src/features/manager/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.add-manager-form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 40%;
width: 50%;
padding: 20px;
background-color: white;
border-radius: 10px;

input {
width: 70%;
margin-bottom: 30px;
}

.btn {
padding: 6px 50px;
}
}
14 changes: 14 additions & 0 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ body {
iframe {
display: none;
}

.form-control {
background-color: #E7E7E7;
border: none;
}

.btn {
border: none;
color: white;
}

.btn-primary {
background-color: #29A9F5;
}
2 changes: 1 addition & 1 deletion client/src/pages/HomePage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function HomePage() {
return (
<>
<Header />
<Sidebar />
<div className="body__wrapper">
<Sidebar />
</div>
</>
);
Expand Down
22 changes: 22 additions & 0 deletions client/src/pages/ManagerPage/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import "./styles.scss";
import Header from "../../components/Header";
import Sidebar from "../../components/Sidebar";
import loginBackground from "../../assets/images/login-background.jpg";
import AddManagerForm from '../../features/manager/AddForm';

function HomePage() {
return (
<>
<Header />
<Sidebar />
<div className="body__wrapper manager-add__wrapper">
<AddManagerForm />
<img className="background-img" src={loginBackground} alt="" />
<div className="background__upper"></div>
</div>
</>
);
}

export default HomePage;
23 changes: 23 additions & 0 deletions client/src/pages/ManagerPage/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.manager-add__wrapper {
display: flex;
justify-content: center;
align-items: center;

.background__upper {
width: 100%;
height: 100%;
position: absolute;
background-color: black;
opacity: 0.4;
}

.background-img {
position: absolute;
width: 100%;
height: 100%;
}

form {
z-index: 10;
}
}