|
| 1 | +import { useState } from "react"; |
| 2 | +import ApprovedUserCard from "./ApprovedUserCard"; |
| 3 | +import PendingUserCard from "./PendingUserCard"; |
| 4 | + |
| 5 | +// Represents a specific tab to show on the user page |
| 6 | +enum UsersTab { |
| 7 | + PendingUsers, |
| 8 | + CurrentUsers, |
| 9 | +} |
| 10 | + |
1 | 11 | function Users() { |
| 12 | + const [usersTabStatus, setUsersTabStatus] = useState<UsersTab>( |
| 13 | + UsersTab.CurrentUsers |
| 14 | + ); |
2 | 15 |
|
3 | 16 | return ( |
4 | | - <div> |
5 | | - |
| 17 | + <div className="p-8"> |
| 18 | + <div className="text-left mb-5"> |
| 19 | + <h1 className="font-medium text-4xl"> |
| 20 | + {usersTabStatus === UsersTab.CurrentUsers |
| 21 | + ? "All Users" |
| 22 | + : "Pending Users"} |
| 23 | + </h1> |
| 24 | + <p className="text-[#FF8476]"># new users</p> |
| 25 | + </div> |
| 26 | + <div className="min-h-screen bg-[#F5F4F4] border rounded-md relative"> |
| 27 | + <div className="absolute right-7 top-0 -translate-y-full flex"> |
| 28 | + <button |
| 29 | + className={`w-52 h-16 border rounded-b-none focus:outline-none ${ |
| 30 | + usersTabStatus === UsersTab.PendingUsers |
| 31 | + ? "bg-[#F5F4F4] border-x-[#000000] border-t-[#000000]" |
| 32 | + : "bg-[#F4F4F4] border-x-[#BFBBBB] border-t-[#BFBBBB] border-b-[#000000]" |
| 33 | + }`} |
| 34 | + onClick={() => setUsersTabStatus(UsersTab.PendingUsers)} |
| 35 | + > |
| 36 | + Pending Users |
| 37 | + </button> |
| 38 | + <button |
| 39 | + className={`w-52 h-16 border rounded-b-none ml-2 focus:outline-none ${ |
| 40 | + usersTabStatus === UsersTab.CurrentUsers |
| 41 | + ? "bg-[#F5F4F4] border-x-[#000000] border-t-[#000000]" |
| 42 | + : "bg-[#F4F4F4] border-x-[#BFBBBB] border-t-[#BFBBBB] border-b-[#000000]" |
| 43 | + }`} |
| 44 | + onClick={() => setUsersTabStatus(UsersTab.CurrentUsers)} |
| 45 | + > |
| 46 | + Current Users |
| 47 | + </button> |
| 48 | + </div> |
| 49 | + <div> |
| 50 | + {usersTabStatus === UsersTab.CurrentUsers ? ( |
| 51 | + <> |
| 52 | + <div className="flex px-9 pb-3 m-7 border-b border-b-[#BFBBBB] font-semibold justify-around"> |
| 53 | + <p className="w-[140px] text-left">User Name</p> |
| 54 | + <p className="w-[140px] text-left">User ID</p> |
| 55 | + <p className="w-[140px] text-left">Email</p> |
| 56 | + <p className="w-[140px] text-left">Position</p> |
| 57 | + </div> |
| 58 | + <ApprovedUserCard |
| 59 | + name="Aaron Ashby" |
| 60 | + email="a.ashby@mit.edu" |
| 61 | + position="Employee" |
| 62 | + /> |
| 63 | + </> |
| 64 | + ) : ( |
| 65 | + <> |
| 66 | + <div className="flex px-9 pb-3 m-7 border-b border-b-[#BFBBBB] font-semibold justify-around"> |
| 67 | + <p className="w-[140px] text-left">User Name</p> |
| 68 | + <p className="w-[140px] text-left">User ID</p> |
| 69 | + <p className="w-[140px] text-left">Email</p> |
| 70 | + <p className="w-[140px] text-left">Position</p> |
| 71 | + <p className="w-[140px] text-left">Date Requested</p> |
| 72 | + <div className="w-[140px]"></div> |
| 73 | + </div> |
| 74 | + <PendingUserCard |
| 75 | + name="Aaron Ashby" |
| 76 | + email="a.ashby@uconn.edu" |
| 77 | + position="Inactive" |
| 78 | + dateRequested={new Date("02/14/2006")} |
| 79 | + /> |
| 80 | + </> |
| 81 | + )} |
| 82 | + </div> |
| 83 | + </div> |
6 | 84 | </div> |
7 | 85 | ); |
8 | 86 | } |
|
0 commit comments