Merge branch 'gruppPP' into BumBranch
This commit is contained in:
commit
805d05f8a5
27 changed files with 75 additions and 42 deletions
|
@ -2,17 +2,15 @@ import Header from "./Header";
|
||||||
import Footer from "./Footer";
|
import Footer from "./Footer";
|
||||||
|
|
||||||
function BasicWindow({
|
function BasicWindow({
|
||||||
username,
|
|
||||||
content,
|
content,
|
||||||
buttons,
|
buttons,
|
||||||
}: {
|
}: {
|
||||||
username: string;
|
|
||||||
content: React.ReactNode;
|
content: React.ReactNode;
|
||||||
buttons: React.ReactNode;
|
buttons: React.ReactNode;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className="font-sans flex flex-col h-screen bg-white border-2 border-black overflow-auto pt-[110px]">
|
<div className="font-sans flex flex-col h-screen bg-white border-2 border-black overflow-auto pt-[110px]">
|
||||||
<Header username={username} />
|
<Header />
|
||||||
<div className="flex flex-col items-center flex-grow">{content}</div>
|
<div className="flex flex-col items-center flex-grow">{content}</div>
|
||||||
<Footer>{buttons}</Footer>
|
<Footer>{buttons}</Footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
43
frontend/src/Components/UserProjectListAdmin.tsx
Normal file
43
frontend/src/Components/UserProjectListAdmin.tsx
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { api } from "../API/API";
|
||||||
|
import { Project } from "../Types/goTypes";
|
||||||
|
|
||||||
|
const UserProjectListAdmin: React.FC = () => {
|
||||||
|
const [projects, setProjects] = useState<Project[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchProjects = async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
const token = localStorage.getItem("accessToken") ?? "";
|
||||||
|
const username = getUsernameFromContext(); // Assuming you have a function to get the username from your context
|
||||||
|
|
||||||
|
const response = await api.getUserProjects(username, token);
|
||||||
|
if (response.success) {
|
||||||
|
setProjects(response.data ?? []);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to fetch projects:", response.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching projects:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void fetchProjects();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h2>User Projects</h2>
|
||||||
|
<ul>
|
||||||
|
{projects.map((project) => (
|
||||||
|
<li key={project.id}>
|
||||||
|
<span>{project.name}</span>
|
||||||
|
{/* Add any additional project details you want to display */}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UserProjectListAdmin;
|
|
@ -11,6 +11,6 @@ function AdminAddProject(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminAddProject;
|
export default AdminAddProject;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
|
||||||
import Register from "../../Components/Register";
|
import Register from "../../Components/Register";
|
||||||
|
|
||||||
function AdminAddUser(): JSX.Element {
|
function AdminAddUser(): JSX.Element {
|
||||||
|
@ -11,16 +11,10 @@ function AdminAddUser(): JSX.Element {
|
||||||
|
|
||||||
const buttons = (
|
const buttons = (
|
||||||
<>
|
<>
|
||||||
<Button
|
<BackButton />
|
||||||
text="Back"
|
|
||||||
onClick={(): void => {
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
type="button"
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminAddUser;
|
export default AdminAddUser;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminChangeUsername(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminChangeUsername;
|
export default AdminChangeUsername;
|
||||||
|
|
|
@ -21,6 +21,6 @@ function AdminManageProjects(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminManageProjects;
|
export default AdminManageProjects;
|
||||||
|
|
|
@ -36,6 +36,6 @@ function AdminManageUsers(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminManageUsers;
|
export default AdminManageUsers;
|
||||||
|
|
|
@ -22,6 +22,6 @@ function AdminMenuPage(): JSX.Element {
|
||||||
|
|
||||||
const buttons = <></>;
|
const buttons = <></>;
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminMenuPage;
|
export default AdminMenuPage;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminProjectAddMember(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectAddMember;
|
export default AdminProjectAddMember;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminProjectChangeUserRole(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectChangeUserRole;
|
export default AdminProjectChangeUserRole;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminProjectManageMembers(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectManageMembers;
|
export default AdminProjectManageMembers;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminProjectPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectPage;
|
export default AdminProjectPage;
|
||||||
|
|
|
@ -16,6 +16,6 @@ function AdminProjectStatistics(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectStatistics;
|
export default AdminProjectStatistics;
|
||||||
|
|
|
@ -23,6 +23,6 @@ function AdminProjectViewMemberInfo(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminProjectViewMemberInfo;
|
export default AdminProjectViewMemberInfo;
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import { useLocation } from "react-router-dom";
|
|
||||||
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";
|
import BackButton from "../../Components/BackButton";
|
||||||
|
import UserProjectListAdmin from "../../Components/UserProjectListAdmin";
|
||||||
|
|
||||||
function AdminViewUserInfo(): JSX.Element {
|
function AdminViewUserInfo(): JSX.Element {
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
<h1 className="font-bold text-[30px] mb-[20px]">{useLocation().state}</h1>
|
<UserProjectListAdmin />
|
||||||
<div className="border-4 border-black bg-white flex flex-col items-center h-[65vh] w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
|
||||||
<p>Put relevant info on user from database here</p>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -26,6 +23,6 @@ function AdminViewUserInfo(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default AdminViewUserInfo;
|
export default AdminViewUserInfo;
|
||||||
|
|
|
@ -18,6 +18,6 @@ function ChangeRole(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default ChangeRole;
|
export default ChangeRole;
|
||||||
|
|
|
@ -10,6 +10,6 @@ function PMOtherUsersTR(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMOtherUsersTR;
|
export default PMOtherUsersTR;
|
||||||
|
|
|
@ -30,6 +30,6 @@ function PMProjectMembers(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMProjectMembers;
|
export default PMProjectMembers;
|
||||||
|
|
|
@ -31,6 +31,6 @@ function PMProjectPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={undefined} />;
|
return <BasicWindow content={content} buttons={undefined} />;
|
||||||
}
|
}
|
||||||
export default PMProjectPage;
|
export default PMProjectPage;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
|
||||||
import TimeReport from "../../Components/NewWeeklyReport";
|
import TimeReport from "../../Components/NewWeeklyReport";
|
||||||
|
|
||||||
function PMTotalTimeActivity(): JSX.Element {
|
function PMTotalTimeActivity(): JSX.Element {
|
||||||
|
@ -18,6 +18,6 @@ function PMTotalTimeActivity(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMTotalTimeActivity;
|
export default PMTotalTimeActivity;
|
||||||
|
|
|
@ -10,6 +10,6 @@ function PMTotalTimeRole(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMTotalTimeRole;
|
export default PMTotalTimeRole;
|
||||||
|
|
|
@ -10,6 +10,6 @@ function PMUnsignedReports(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMUnsignedReports;
|
export default PMUnsignedReports;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import BackButton from "../../Components/BackButton";
|
||||||
import BasicWindow from "../../Components/BasicWindow";
|
import BasicWindow from "../../Components/BasicWindow";
|
||||||
import Button from "../../Components/Button";
|
import Button from "../../Components/Button";
|
||||||
import TimeReport from "../../Components/NewWeeklyReport";
|
import TimeReport from "../../Components/NewWeeklyReport";
|
||||||
|
@ -32,6 +33,6 @@ function PMViewUnsignedReport(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default PMViewUnsignedReport;
|
export default PMViewUnsignedReport;
|
||||||
|
|
|
@ -16,6 +16,6 @@ function UserEditTimeReportPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default UserEditTimeReportPage;
|
export default UserEditTimeReportPage;
|
||||||
|
|
|
@ -25,6 +25,6 @@ function UserNewTimeReportPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default UserNewTimeReportPage;
|
export default UserNewTimeReportPage;
|
||||||
|
|
|
@ -27,6 +27,6 @@ function UserProjectPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default UserProjectPage;
|
export default UserProjectPage;
|
||||||
|
|
|
@ -15,6 +15,6 @@ function UserViewTimeReportsPage(): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <BasicWindow username="Admin" content={content} buttons={buttons} />;
|
return <BasicWindow content={content} buttons={buttons} />;
|
||||||
}
|
}
|
||||||
export default UserViewTimeReportsPage;
|
export default UserViewTimeReportsPage;
|
||||||
|
|
Loading…
Reference in a new issue