Merge branch 'frontend'
This commit is contained in:
commit
8c8e57cb50
20 changed files with 332 additions and 128 deletions
|
@ -2,9 +2,9 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<link rel="icon" type="image/x-icon" href="src/assets/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
<title>TTIME</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
@ -3,4 +3,4 @@ export default {
|
|||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
22
frontend/src/Components/BasicWindow.tsx
Normal file
22
frontend/src/Components/BasicWindow.tsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Header from "./Header";
|
||||
import Footer from "./Footer";
|
||||
|
||||
function BasicWindow({
|
||||
username,
|
||||
content,
|
||||
buttons,
|
||||
}: {
|
||||
username: string;
|
||||
content: React.ReactNode;
|
||||
buttons: React.ReactNode;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<div className="font-sans flex flex-col h-screen bg-white border-2 border-black overflow-auto pt-[110px]">
|
||||
<Header username={username} />
|
||||
<div className="flex flex-col items-center flex-grow">{content}</div>
|
||||
<Footer>{buttons}</Footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default BasicWindow;
|
18
frontend/src/Components/Button.tsx
Normal file
18
frontend/src/Components/Button.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
function Button({
|
||||
text,
|
||||
onClick,
|
||||
}: {
|
||||
text: string;
|
||||
onClick: () => void;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
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;"
|
||||
>
|
||||
{text}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export default Button;
|
13
frontend/src/Components/Footer.tsx
Normal file
13
frontend/src/Components/Footer.tsx
Normal file
|
@ -0,0 +1,13 @@
|
|||
import React from "react";
|
||||
|
||||
function Footer({ children }: { children: React.ReactNode }): JSX.Element {
|
||||
return (
|
||||
<footer className="bg-white">
|
||||
<div className="flex justify-end items-center h-16 space-x-6 pr-6">
|
||||
{children}
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
54
frontend/src/Components/Header.tsx
Normal file
54
frontend/src/Components/Header.tsx
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
function Header({ username }: { username: string }): JSX.Element {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const handleLogout = (): void => {
|
||||
// Add any logout logic here
|
||||
};
|
||||
|
||||
return (
|
||||
<header
|
||||
className="fixed top-0 left-0 right-0 border-[1.75px] border-black text-black p-3 pl-5 flex items-center justify-between bg-cover"
|
||||
style={{ backgroundImage: `url('src/assets/1.jpg')` }}
|
||||
>
|
||||
<Link to="/your-projects">
|
||||
<img
|
||||
src="/src/assets/TTIMElogo.png"
|
||||
alt="TTIME Logo"
|
||||
className="w-11 h-14 cursor-pointer"
|
||||
/>
|
||||
</Link>
|
||||
|
||||
<div
|
||||
className="relative"
|
||||
onMouseEnter={() => {
|
||||
setIsOpen(true);
|
||||
}}
|
||||
onMouseLeave={() => {
|
||||
setIsOpen(false);
|
||||
}}
|
||||
>
|
||||
<button className="mr-4 underline font-bold text-white">
|
||||
{username}
|
||||
</button>
|
||||
|
||||
{isOpen && (
|
||||
<div className="absolute right-0 bg-white border rounded shadow-lg">
|
||||
<Link to="/">
|
||||
<button
|
||||
onClick={handleLogout}
|
||||
className="block px-2 py-1 text-black hover:bg-gray-200"
|
||||
>
|
||||
Logout
|
||||
</button>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export default Header;
|
26
frontend/src/Pages/LoginPage.css
Normal file
26
frontend/src/Pages/LoginPage.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
body{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@keyframes backgroundTransition {
|
||||
0% {
|
||||
background-image: url('src/assets/1.jpg');
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
25% {
|
||||
background-image: url('src/assets/2.jpg');
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
50% {
|
||||
background-image: url('src/assets/3.jpg');
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
75% {
|
||||
background-image: url('src/assets/4.jpg');
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
100% {
|
||||
background-image: url('src/assets/1.jpg');
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
}
|
78
frontend/src/Pages/LoginPage.tsx
Normal file
78
frontend/src/Pages/LoginPage.tsx
Normal file
|
@ -0,0 +1,78 @@
|
|||
import Button from "../Components/Button";
|
||||
import Logo from "/src/assets/TTIMElogo.png";
|
||||
import "./LoginPage.css";
|
||||
import { useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const PreloadBackgroundAnimation = (): JSX.Element => {
|
||||
useEffect(() => {
|
||||
const images = [
|
||||
"src/assets/1.jpg",
|
||||
"src/assets/2.jpg",
|
||||
"src/assets/3.jpg",
|
||||
"src/assets/4.jpg",
|
||||
];
|
||||
|
||||
// Pre-load images
|
||||
for (const i of images) {
|
||||
console.log(i);
|
||||
}
|
||||
|
||||
// Start animation
|
||||
document.body.style.animation = "backgroundTransition 30s infinite";
|
||||
}, []);
|
||||
|
||||
return <></>;
|
||||
};
|
||||
|
||||
function LoginPage(): JSX.Element {
|
||||
return (
|
||||
<>
|
||||
<PreloadBackgroundAnimation />
|
||||
<div
|
||||
className="flex flex-col h-screen w-screen items-center justify-center"
|
||||
style={{
|
||||
animation: "backgroundTransition 30s infinite",
|
||||
backgroundSize: "cover",
|
||||
backgroundAttachment: "fixed",
|
||||
}}
|
||||
>
|
||||
<div className="border-4 border-black bg-white flex flex-col items-center justify-center h-fit w-fit rounded-3xl content-center pl-20 pr-20">
|
||||
<img
|
||||
src={Logo}
|
||||
className="logo w-[7vw] mb-10 mt-10"
|
||||
alt="TTIME Logo"
|
||||
/>
|
||||
<h1 className="font-sans mb-4 font-bold text-[25px]">
|
||||
{" "}
|
||||
Welcome to TTIME!{" "}
|
||||
</h1>
|
||||
<h2 className="font-sans mb-4 text-[15px]">
|
||||
{" "}
|
||||
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">
|
||||
<Button
|
||||
text="Login"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default LoginPage;
|
38
frontend/src/Pages/ProjectManagerPages/PMProjectPage.tsx
Normal file
38
frontend/src/Pages/ProjectManagerPages/PMProjectPage.tsx
Normal file
|
@ -0,0 +1,38 @@
|
|||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
|
||||
function PMProjectPage(): 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-[5vh] p-[30px]">
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Your Time Reports
|
||||
</h1>
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
New Time Report
|
||||
</h1>
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Statistics
|
||||
</h1>
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
Unsigned Time Reports
|
||||
</h1>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
const buttons = (
|
||||
<>
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
||||
}
|
||||
export default PMProjectPage;
|
37
frontend/src/Pages/UserPages/UserProjectPage.tsx
Normal file
37
frontend/src/Pages/UserPages/UserProjectPage.tsx
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { Link } from "react-router-dom";
|
||||
import BasicWindow from "../../Components/BasicWindow";
|
||||
import Button from "../../Components/Button";
|
||||
|
||||
function UserProjectPage(): JSX.Element {
|
||||
const content = (
|
||||
<>
|
||||
<Link to="/settingsPage">
|
||||
<h1 className="font-bold text-[30px] mb-[20px]">ProjectNameExample</h1>
|
||||
</Link>
|
||||
<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>
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
New Time Report
|
||||
</h1>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
const buttons = (
|
||||
<>
|
||||
<Link to="/your-projects">
|
||||
<Button
|
||||
text="Back"
|
||||
onClick={(): void => {
|
||||
return;
|
||||
}}
|
||||
/>
|
||||
</Link>
|
||||
</>
|
||||
);
|
||||
|
||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
||||
}
|
||||
export default UserProjectPage;
|
31
frontend/src/Pages/YourProjectsPage.tsx
Normal file
31
frontend/src/Pages/YourProjectsPage.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Link } from "react-router-dom";
|
||||
import BasicWindow from "../Components/BasicWindow";
|
||||
|
||||
function YourProjectsPage(): JSX.Element {
|
||||
const content = (
|
||||
<>
|
||||
<h1 className="font-bold text-[30px] mb-[20px]">Your Projects</h1>
|
||||
<div className="border-4 border-black bg-white flex flex-col items-center justify-between min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10px] p-[30px]">
|
||||
<Link to="/project">
|
||||
<h1 className="underline text-[24px] cursor-pointer font-bold">
|
||||
ProjectNameExample
|
||||
</h1>
|
||||
</Link>
|
||||
<h1 className="underline text-[24px] cursor-pointer font-bold">
|
||||
ProjectNameExample
|
||||
</h1>
|
||||
<h1 className="underline text-[24px] cursor-pointer font-bold">
|
||||
ProjectNameExample
|
||||
</h1>
|
||||
<h1 className="underline text-[24px] cursor-pointer font-bold">
|
||||
ProjectNameExample
|
||||
</h1>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
const buttons = <></>;
|
||||
|
||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
||||
}
|
||||
export default YourProjectsPage;
|
BIN
frontend/src/assets/1.jpg
Normal file
BIN
frontend/src/assets/1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 662 KiB |
BIN
frontend/src/assets/2.jpg
Normal file
BIN
frontend/src/assets/2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 659 KiB |
BIN
frontend/src/assets/3.jpg
Normal file
BIN
frontend/src/assets/3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 668 KiB |
BIN
frontend/src/assets/4.jpg
Normal file
BIN
frontend/src/assets/4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 KiB |
BIN
frontend/src/assets/TTIMElogo.png
Normal file
BIN
frontend/src/assets/TTIMElogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 261 KiB |
BIN
frontend/src/assets/favicon.ico
Normal file
BIN
frontend/src/assets/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -6,117 +6,3 @@
|
|||
* We are using tailwind, so do not add any custom CSS here.
|
||||
* Most of this is going to get cleaned up eventually.
|
||||
*/
|
||||
|
||||
:root {
|
||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
background-color: #1a1a1a;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.25s;
|
||||
}
|
||||
button:hover {
|
||||
border-color: #646cff;
|
||||
}
|
||||
button:focus,
|
||||
button:focus-visible {
|
||||
outline: 4px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
a:hover {
|
||||
color: #747bff;
|
||||
}
|
||||
button {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.logo {
|
||||
transition: filter 0.25s;
|
||||
}
|
||||
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import SettingsPage from "./Pages/Settings.tsx";
|
||||
import HomePage from "./Pages/Home.tsx";
|
||||
import "./index.css";
|
||||
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
||||
import LoginPage from "./Pages/LoginPage.tsx";
|
||||
import YourProjectsPage from "./Pages/YourProjectsPage.tsx";
|
||||
import UserProjectPage from "./Pages/UserPages/UserProjectPage.tsx";
|
||||
|
||||
// This is where the routes are mounted
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <HomePage />,
|
||||
element: <LoginPage />,
|
||||
},
|
||||
{
|
||||
path: "/settings",
|
||||
element: <SettingsPage />,
|
||||
path: "/your-projects",
|
||||
element: <YourProjectsPage />,
|
||||
},
|
||||
{
|
||||
path: "/project",
|
||||
element: <UserProjectPage />,
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [
|
||||
"./index.html",
|
||||
"./src/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
|
||||
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue