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 Button from "../../Components/Button";
|
||||
import BackButton from "../../Components/BackButton";
|
||||
|
||||
function AdminManageUsers(): JSX.Element {
|
||||
const content = <></>;
|
||||
|
@ -12,12 +13,7 @@ function AdminManageUsers(): JSX.Element {
|
|||
return;
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
<BackButton />
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ function AdminMenuPage(): JSX.Element {
|
|||
<>
|
||||
<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]">
|
||||
<Link to="/admin-users-page">
|
||||
<Link to="/admin-manage-users">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Manage Users
|
||||
</h1>
|
||||
</Link>
|
||||
<Link to="/admin-projects-page">
|
||||
<Link to="/admin-manage-projects">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Manage Projects
|
||||
</h1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import Button from "../Components/Button";
|
||||
import Logo from "/src/assets/Logo.svg";
|
||||
import "./LoginPage.css";
|
||||
import { useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { FormEvent, useEffect, useState } from "react";
|
||||
import { NewUser } from "../Types/Users";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
const PreloadBackgroundAnimation = (): JSX.Element => {
|
||||
useEffect(() => {
|
||||
|
@ -26,6 +27,39 @@ const PreloadBackgroundAnimation = (): 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 (
|
||||
<>
|
||||
<PreloadBackgroundAnimation />
|
||||
|
@ -51,24 +85,30 @@ function LoginPage(): JSX.Element {
|
|||
{" "}
|
||||
Please log in to continue{" "}
|
||||
</h2>
|
||||
<input
|
||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||
type="text"
|
||||
placeholder="Username"
|
||||
/>
|
||||
<input
|
||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<Link to="/your-projects">
|
||||
<form className="flex flex-col items-center" onSubmit={handleSubmit}>
|
||||
<input
|
||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||
type="text"
|
||||
placeholder="Username"
|
||||
onChange={(e) => {
|
||||
setUsername(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
className="border-2 border-black mb-3 rounded-lg w-[20vw] p-1"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
onChange={(e) => {
|
||||
setPassword(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
text="Login"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
import NewTimeReport from "../../Components/TimeReport";
|
||||
import BackButton from "../../Components/BackButton";
|
||||
|
||||
function UserEditTimeReportPage(): JSX.Element {
|
||||
const content = (
|
||||
|
@ -18,12 +19,7 @@ function UserEditTimeReportPage(): JSX.Element {
|
|||
return;
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
<BackButton />
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
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 {
|
||||
const content = (
|
||||
|
@ -19,14 +20,7 @@ function UserNewTimeReportPage(): JSX.Element {
|
|||
return;
|
||||
}}
|
||||
/>
|
||||
<Link to="/project">
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
<BackButton />
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import { Link } from "react-router-dom";
|
||||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
import BackButton from "../../Components/BackButton";
|
||||
|
||||
function UserProjectPage(): JSX.Element {
|
||||
const content = (
|
||||
<>
|
||||
<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]">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Your Time Reports
|
||||
</h1>
|
||||
<Link to="/project-page">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Your Time Reports
|
||||
</h1>
|
||||
</Link>
|
||||
<Link to="/new-time-report">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
New Time Report
|
||||
|
@ -21,14 +23,7 @@ function UserProjectPage(): JSX.Element {
|
|||
|
||||
const buttons = (
|
||||
<>
|
||||
<Link to="/your-projects">
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
<BackButton />
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
import BackButton from "../../Components/BackButton";
|
||||
|
||||
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 = (
|
||||
<>
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
<BackButton />
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue