diff --git a/frontend/src/main-page/header/Header.tsx b/frontend/src/main-page/header/Header.tsx index 2478af5..8bf2250 100644 --- a/frontend/src/main-page/header/Header.tsx +++ b/frontend/src/main-page/header/Header.tsx @@ -14,6 +14,7 @@ import { Menu, Button } from "@chakra-ui/react"; import { FaCog } from "react-icons/fa"; import BellButton from "./Bell.tsx"; import { useLocation } from 'react-router-dom'; +import UserButton from "./UserButton.tsx"; interface NavBarProps { name: string; @@ -72,13 +73,13 @@ const Header: React.FC = observer(() => { ))} -
+
- @@ -95,6 +96,7 @@ const Header: React.FC = observer(() => { +
diff --git a/frontend/src/main-page/header/UserButton.tsx b/frontend/src/main-page/header/UserButton.tsx new file mode 100644 index 0000000..2f04e77 --- /dev/null +++ b/frontend/src/main-page/header/UserButton.tsx @@ -0,0 +1,16 @@ +import { faUser } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +const UserButton = () => { + return ( +
+ + + +
+ ); +}; + +export default UserButton; diff --git a/frontend/src/main-page/users/ApprovedUserCard.tsx b/frontend/src/main-page/users/ApprovedUserCard.tsx new file mode 100644 index 0000000..c99aa32 --- /dev/null +++ b/frontend/src/main-page/users/ApprovedUserCard.tsx @@ -0,0 +1,22 @@ +import UserPositionCard from "./UserPositionCard"; + +interface ApprovedUserCardProps { + name: string; + email: string; + position: string; +} + +const ApprovedUserCard = ({ name, email, position }: ApprovedUserCardProps) => { + return ( +
+

{name}

+

xxxxxxx

+

{email}

+
+ +
+
+ ); +}; + +export default ApprovedUserCard; diff --git a/frontend/src/main-page/users/PendingUserCard.tsx b/frontend/src/main-page/users/PendingUserCard.tsx new file mode 100644 index 0000000..8824633 --- /dev/null +++ b/frontend/src/main-page/users/PendingUserCard.tsx @@ -0,0 +1,41 @@ +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import UserPositionCard from "./UserPositionCard"; +import { faCheck, faX } from "@fortawesome/free-solid-svg-icons"; + +interface PendingUserCardProps { + name: string; + email: string; + position: string; + dateRequested: Date; +} + +const PendingUserCard = ({ + name, + email, + position, + dateRequested, +}: PendingUserCardProps) => { + return ( +
+

{name}

+

xxxxxxx

+

{email}

+
+ +
+

+ {dateRequested.toLocaleDateString("en-GB")} +

+
+ + +
+
+ ); +}; + +export default PendingUserCard; diff --git a/frontend/src/main-page/users/UserPositionCard.tsx b/frontend/src/main-page/users/UserPositionCard.tsx new file mode 100644 index 0000000..6f15951 --- /dev/null +++ b/frontend/src/main-page/users/UserPositionCard.tsx @@ -0,0 +1,29 @@ +import { useMemo } from "react"; + +interface UserPositionCardProps { + position: string; +} + +const UserPositionCard = ({ position }: UserPositionCardProps) => { + const cardStyles = useMemo(() => { + switch (position.toLowerCase()) { + case "admin": + return "bg-[#BCFFD8] border-[#119548] text-[#119548]"; + case "employee": + return "bg-[#FFF8CA] border-[#F8CC16] text-[#8a710c]"; + case "deactive": + return "bg-[#FFB0B0] border-[#DF0404] text-[#DF0404]"; + case "inactive": + default: + return "bg-[#D3D3D3] border-[#666666] text-[#666666]"; + } + }, [position]); + + return ( +
+

{position}

+
+ ); +}; + +export default UserPositionCard; diff --git a/frontend/src/main-page/users/Users.tsx b/frontend/src/main-page/users/Users.tsx index 5900856..4c840ca 100644 --- a/frontend/src/main-page/users/Users.tsx +++ b/frontend/src/main-page/users/Users.tsx @@ -1,8 +1,86 @@ +import { useState } from "react"; +import ApprovedUserCard from "./ApprovedUserCard"; +import PendingUserCard from "./PendingUserCard"; + +// Represents a specific tab to show on the user page +enum UsersTab { + PendingUsers, + CurrentUsers, +} + function Users() { + const [usersTabStatus, setUsersTabStatus] = useState( + UsersTab.CurrentUsers + ); return ( -
- +
+
+

+ {usersTabStatus === UsersTab.CurrentUsers + ? "All Users" + : "Pending Users"} +

+

# new users

+
+
+
+ + +
+
+ {usersTabStatus === UsersTab.CurrentUsers ? ( + <> +
+

User Name

+

User ID

+

Email

+

Position

+
+ + + ) : ( + <> +
+

User Name

+

User ID

+

Email

+

Position

+

Date Requested

+
+
+ + + )} +
+
); }