Compare commits
10 commits
ef28e1743e
...
2da40e1f54
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2da40e1f54 | ||
![]() |
8430d88a07 | ||
![]() |
a26499bde9 | ||
![]() |
6789cc97ce | ||
![]() |
44aea9b765 | ||
![]() |
69b0318eb0 | ||
![]() |
dc902855f4 | ||
![]() |
901bcd39c5 | ||
![]() |
cd1dbb494c | ||
![]() |
2ad7146588 |
8 changed files with 96 additions and 57 deletions
18
frontend/src/Components/BackButton.tsx
Normal file
18
frontend/src/Components/BackButton.tsx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
function BackButton(): JSX.Element {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const goBack = (): void => {
|
||||||
|
navigate(-1);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
onClick={goBack}
|
||||||
|
className="inline-block py-1 px-8 font-bold bg-orange-500 text-white border-2 border-black rounded-full cursor-pointer mt-5 mb-5 transition-colors duration-10 hover:bg-orange-600 hover:text-gray-300 font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 4vh;"
|
||||||
|
>
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BackButton;
|
|
@ -1,5 +1,6 @@
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import Button from "../../Components/Button";
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
|
|
||||||
function AdminManageUsers(): JSX.Element {
|
function AdminManageUsers(): JSX.Element {
|
||||||
const content = <></>;
|
const content = <></>;
|
||||||
|
@ -12,12 +13,7 @@ function AdminManageUsers(): JSX.Element {
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<BackButton />
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@ function AdminMenuPage(): JSX.Element {
|
||||||
<>
|
<>
|
||||||
<h1 className="font-bold text-[30px] mb-[20px]">Administrator Menu</h1>
|
<h1 className="font-bold text-[30px] mb-[20px]">Administrator Menu</h1>
|
||||||
<div className="border-4 border-black bg-white flex flex-col items-center justify-center min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
<div className="border-4 border-black bg-white flex flex-col items-center justify-center min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
||||||
<Link to="/admin-users-page">
|
<Link to="/admin-manage-users">
|
||||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||||
Manage Users
|
Manage Users
|
||||||
</h1>
|
</h1>
|
||||||
</Link>
|
</Link>
|
||||||
<Link to="/admin-projects-page">
|
<Link to="/admin-manage-projects">
|
||||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||||
Manage Projects
|
Manage Projects
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import Button from "../Components/Button";
|
import Button from "../Components/Button";
|
||||||
import Logo from "/src/assets/Logo.svg";
|
import Logo from "/src/assets/Logo.svg";
|
||||||
import "./LoginPage.css";
|
import "./LoginPage.css";
|
||||||
import { useEffect } from "react";
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { NewUser } from "../Types/Users";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const PreloadBackgroundAnimation = (): JSX.Element => {
|
const PreloadBackgroundAnimation = (): JSX.Element => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -26,6 +27,39 @@ const PreloadBackgroundAnimation = (): JSX.Element => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function LoginPage(): JSX.Element {
|
function LoginPage(): JSX.Element {
|
||||||
|
//Example users for testing without backend, remove when using backend
|
||||||
|
const admin: NewUser = {
|
||||||
|
name: "admin",
|
||||||
|
password: "123",
|
||||||
|
};
|
||||||
|
const pmanager: NewUser = {
|
||||||
|
name: "pmanager",
|
||||||
|
password: "123",
|
||||||
|
};
|
||||||
|
const user: NewUser = {
|
||||||
|
name: "user",
|
||||||
|
password: "123",
|
||||||
|
};
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
/* On submit (enter or button click) check if username and password match any user
|
||||||
|
and if so, redirect to correct page */
|
||||||
|
function handleSubmit(event: FormEvent<HTMLFormElement>): void {
|
||||||
|
event.preventDefault();
|
||||||
|
//TODO: Compare with db instead when finished
|
||||||
|
if (username === admin.name && password === admin.password) {
|
||||||
|
navigate("/admin-menu");
|
||||||
|
} else if (username === pmanager.name && password === pmanager.password) {
|
||||||
|
navigate("/PM-project-page");
|
||||||
|
} else if (username === user.name && password === user.password) {
|
||||||
|
navigate("/your-projects");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const [username, setUsername] = useState("");
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PreloadBackgroundAnimation />
|
<PreloadBackgroundAnimation />
|
||||||
|
@ -51,24 +85,30 @@ function LoginPage(): JSX.Element {
|
||||||
{" "}
|
{" "}
|
||||||
Please log in to continue{" "}
|
Please log in to continue{" "}
|
||||||
</h2>
|
</h2>
|
||||||
<input
|
<form className="flex flex-col items-center" onSubmit={handleSubmit}>
|
||||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
<input
|
||||||
type="text"
|
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||||
placeholder="Username"
|
type="text"
|
||||||
/>
|
placeholder="Username"
|
||||||
<input
|
onChange={(e) => {
|
||||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
setUsername(e.target.value);
|
||||||
type="password"
|
}}
|
||||||
placeholder="Password"
|
/>
|
||||||
/>
|
<input
|
||||||
<Link to="/your-projects">
|
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||||
|
type="password"
|
||||||
|
placeholder="Password"
|
||||||
|
onChange={(e) => {
|
||||||
|
setPassword(e.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
text="Login"
|
text="Login"
|
||||||
onClick={(): void => {
|
onClick={(): void => {
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import Button from "../../Components/Button";
|
||||||
import NewTimeReport from "../../Components/TimeReport";
|
import NewTimeReport from "../../Components/TimeReport";
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
|
|
||||||
function UserEditTimeReportPage(): JSX.Element {
|
function UserEditTimeReportPage(): JSX.Element {
|
||||||
const content = (
|
const content = (
|
||||||
|
@ -18,12 +19,7 @@ function UserEditTimeReportPage(): JSX.Element {
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<BackButton />
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import Button from "../../Components/Button";
|
||||||
import NewTimeReport from "../../Components/TimeReport";
|
import NewTimeReport from "../../Components/TimeReport";
|
||||||
import { Link } from "react-router-dom";
|
//import { Link } from "react-router-dom";
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
|
|
||||||
function UserNewTimeReportPage(): JSX.Element {
|
function UserNewTimeReportPage(): JSX.Element {
|
||||||
const content = (
|
const content = (
|
||||||
|
@ -19,14 +20,7 @@ function UserNewTimeReportPage(): JSX.Element {
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Link to="/project">
|
<BackButton />
|
||||||
<Button
|
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import BackButton from "../../Components/BackButton";
|
||||||
|
|
||||||
function UserProjectPage(): JSX.Element {
|
function UserProjectPage(): JSX.Element {
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
<h1 className="font-bold text-[30px] mb-[20px]">ProjectNameExample</h1>
|
<h1 className="font-bold text-[30px] mb-[20px]">ProjectNameExample</h1>
|
||||||
<div className="border-4 border-black bg-white flex flex-col items-center justify-center min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
<div className="border-4 border-black bg-white flex flex-col items-center justify-center min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
||||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
<Link to="/project-page">
|
||||||
Your Time Reports
|
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||||
</h1>
|
Your Time Reports
|
||||||
|
</h1>
|
||||||
|
</Link>
|
||||||
<Link to="/new-time-report">
|
<Link to="/new-time-report">
|
||||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||||
New Time Report
|
New Time Report
|
||||||
|
@ -21,14 +23,7 @@ function UserProjectPage(): JSX.Element {
|
||||||
|
|
||||||
const buttons = (
|
const buttons = (
|
||||||
<>
|
<>
|
||||||
<Link to="/your-projects">
|
<BackButton />
|
||||||
<Button
|
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import BackButton from "../../Components/BackButton";
|
||||||
|
|
||||||
function UserViewTimeReportsPage(): JSX.Element {
|
function UserViewTimeReportsPage(): JSX.Element {
|
||||||
const content = <></>;
|
const content = (
|
||||||
|
<>
|
||||||
|
<h1 className="font-bold text-[30px] mb-[20px]">Your Time Reports</h1>
|
||||||
|
{/* Här kan du inkludera logiken för att visa användarens tidrapporter */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
const buttons = (
|
const buttons = (
|
||||||
<>
|
<>
|
||||||
<Button
|
<BackButton />
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue