Skip to content

Commit 63570c5

Browse files
author
Sophie Mukamugema
committed
As an admin, I should be able to view invitations breakdown.(Team fighters)
1 parent 64af47e commit 63570c5

File tree

6 files changed

+172
-37
lines changed

6 files changed

+172
-37
lines changed

package-lock.json

+28-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"react-dropdown-select": "^4.10.0",
8787
"react-hook-form": "^7.45.2",
8888
"react-i18next": "^11.18.6",
89-
"react-icons": "^4.10.1",
89+
"react-icons": "^4.12.0",
9090
"react-loader-spinner": "^5.4.5",
9191
"react-pdf": "^7.3.3",
9292
"react-pdf-js": "^5.1.0",

src/components/InvitationCard.tsx

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import { AiOutlineRise } from "react-icons/ai";
3+
4+
// Define the type for the props
5+
interface InvitationCardType {
6+
icon: React.ReactNode;
7+
status: string;
8+
time: string;
9+
staticNumber: string;
10+
percentage: string;
11+
}
12+
13+
// Define the InvitationCard component
14+
const InvitationCard: React.FC<InvitationCardType> = ({ icon, status, time, staticNumber, percentage }) => {
15+
return (
16+
<>
17+
<div className='bg-blue-100 w-48 grid grid-row-4 rounded-2xl'>
18+
<div>
19+
<div>
20+
<h3 className='ml-10 p-2 text-2xl font-serif font-bold text-[20px]'>{status}</h3>
21+
<div className='flex gap-2 w-8 h-10'>
22+
{icon}
23+
</div>
24+
<div>
25+
<p className='ml-10 mb-8'>{time}</p>
26+
</div>
27+
</div>
28+
</div>
29+
<div className='flex justify-center items-center pb-5'>
30+
<div className='text-2xl font-serif font-bold text-[40px]'>{staticNumber}</div>
31+
<div className='text-base text-purple-500 ml-3 mb-5'>
32+
<AiOutlineRise className="text-2xl" />
33+
<span>{percentage}</span>
34+
</div>
35+
</div>
36+
</div>
37+
</>
38+
);
39+
}
40+
41+
export default InvitationCard;
42+

src/components/Sidebar.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
MoonIcon,
1919
MailIcon,
2020
} from '@heroicons/react/solid';
21+
import { FaEnvelopeOpenText } from "react-icons/fa6";
2122
import {
2223
AcademicCapIcon,
2324
BookOpenIcon,
@@ -36,9 +37,8 @@ function Sidebar({ style, toggle }: { style: string; toggle: () => void }) {
3637
const { logout } = useContext(UserContext);
3738
return (
3839
<div
39-
className={`${
40-
showNav ? 'block' : 'hidden'
41-
} lg:block page-sideNav fixed lg:static top-16 bottom-0`}
40+
className={`${showNav ? 'block' : 'hidden'
41+
} lg:block page-sideNav fixed lg:static top-16 bottom-0`}
4242
>
4343
<div
4444
className={`${style} overflow-auto flex-col h-[100%] pt-2 bg-indigo-100 dark:bg-dark-bg shadow-lg lg:shadow-none dark:shadow-border-dark`}
@@ -80,6 +80,12 @@ function Sidebar({ style, toggle }: { style: string; toggle: () => void }) {
8080
<UserGroupIcon className="w-5" />
8181
</SideNavLink>
8282
</CheckRole>
83+
{/* INVITATION*/}
84+
<CheckRole roles={['admin', 'coordinator']}>
85+
<SideNavLink onClick={toggle} to="/invitation" name="Invitation">
86+
<FaEnvelopeOpenText className="w-5" />
87+
</SideNavLink>
88+
</CheckRole>
8389

8490
{/* FOR ADMINS */}
8591
<CheckRole roles={['admin']}>

src/containers/DashRoutes.tsx

+13-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const LoginActivitiesTable = React.lazy(
2626
const AdminTeams = React.lazy(() => import('./admin-dashBoard/Teams'));
2727
const AdminCohorts = React.lazy(() => import('./admin-dashBoard/Cohorts'));
2828
const AdminPrograms = React.lazy(() => import('./admin-dashBoard/Programs'));
29+
const Invitation = React.lazy(() => import('../pages/Invitation'));
2930
const AdminSession = React.lazy(() => import('./admin-dashBoard/Sessions'));
3031
const AdminPhases = React.lazy(() => import('./admin-dashBoard/Phases'));
3132
const AdminManageRoles = React.lazy(
@@ -85,7 +86,7 @@ function DashRoutes() {
8586

8687
const [nav, setNav] = useState(false);
8788
const handleClick = () => setNav(!nav);
88-
89+
8990
return (
9091
<PrivateRoute>
9192
<MenuProvider>
@@ -97,6 +98,13 @@ function DashRoutes() {
9798
<Routes>
9899
<Route path="/dashboard" element={<Dashboard />} />
99100
<Route path="/trainees" element={<AdminTraineeDashboard />} />
101+
<Route path="/invitation" element={
102+
<>
103+
<CheckRole roles={['admin']}>
104+
<Invitation />
105+
</CheckRole>
106+
</>
107+
} />
100108
<Route path="/trainees/:userId" element={<ViewTraineeRatings />} />
101109
<Route
102110
path="/ratings"
@@ -148,10 +156,10 @@ function DashRoutes() {
148156
<Route index element={<AllTickets />} />
149157
<Route path=":ticketId" element={<Ticket />} />
150158
</Route>
151-
152-
<Route path="/loginActivities" element={<LoginActivitiesTable />} />
153-
154-
<Route path="/team/:teamname" element={<TeamDetails/>} />
159+
160+
<Route path="/loginActivities" element={<LoginActivitiesTable />} />
161+
162+
<Route path="/team/:teamname" element={<TeamDetails />} />
155163

156164
<Route path="/team-cards" element={<ManagersCards />} />
157165
<Route path="/cards" element={<CoordinatorCards />} />

0 commit comments

Comments
 (0)