Skip to content

Commit ce185d9

Browse files
IsmaelmurekeziMugisha146Mugishahbapteceelogre
committed
#40 Fix single trainee detail page (#125)
* feature: improve trainee details page * handling missing application info, also adding download functionality * fixing error related to download and refactoring * Update TrainneeDetails.tsx * handling issues related to deployment * Fix number can't be shared (#130) Co-authored-by: Mugisha <[email protected]> * #102 sidebar links review (#128) * fix: remove placeholder property * fix duplicate links --------- Co-authored-by: ceelogre <[email protected]> * Ft minimize dashboard menu #110 (#140) * fix: remove placeholder property * ft minimize dashboard menu * fix minimize dashboard by icon and categorize into section * fix minimize dashboard by icon and categorize into section * fix minimize dashboard by icon and categorize into section * fix minimize dashboard by icon and categorize into section * fix minimize dashboard by icon and categorize into section * fix minimize dashboard by icon and categorize into section * fix minimize dashboard scrollbar * fix minimize dashboard scrollbar * fix minimize dashboard scrollbar * Fix layout spacing between sidebar and main content in AdminLayout * new * Fix layout spacing between sidebar and main content in AdminLayout * fix layout --------- Co-authored-by: ceelogre <[email protected]> Co-authored-by: Prince-Kid <[email protected]> Co-authored-by: Mucyo Prince <[email protected]> Co-authored-by: Aime-Patrick <[email protected]> * #118 fx: builtinSuperAdminCreateProgram (#126) * fix: remove placeholder property * The built-in superadmin account cannot create a program --------- Co-authored-by: ceelogre <[email protected]> * feature: improve trainee details page * handling missing application info, also adding download functionality * Update TrainneeDetails.tsx * adding way to send email and other adjustments * refining and fixing some issues * Update webpack.config.js * customizing way of sending email * refactoring code to fix issue related to code climate * fixing issue for deployment * fixing issues related to refactoring --------- Co-authored-by: MUGISHA Emmanuel <[email protected]> Co-authored-by: Mugisha <[email protected]> Co-authored-by: ISHIMWE Jean Baptiste <[email protected]> Co-authored-by: ceelogre <[email protected]> Co-authored-by: ManziPatrick <[email protected]> Co-authored-by: Prince-Kid <[email protected]> Co-authored-by: Mucyo Prince <[email protected]> Co-authored-by: Aime-Patrick <[email protected]> Co-authored-by: Niyonshuti Jean De Dieu <[email protected]>
1 parent 5088aa5 commit ce185d9

File tree

13 files changed

+393
-378
lines changed

13 files changed

+393
-378
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ coverage
55
dist
66
buildcoverage
77
package-lock.json
8-
.DS_Store
8+
.DS_Store
9+
build/

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"start": "echo \"Error: no test specified\" && exit 1",
7+
"start": "webpack server",
88
"dev": "webpack server",
99
"test": "jest --watchAll=false",
1010
"build": "webpack build",
@@ -74,6 +74,7 @@
7474
"@emotion/styled": "^11.10.4",
7575
"@fortawesome/fontawesome-svg-core": "^6.4.2",
7676
"@fortawesome/free-regular-svg-icons": "^6.4.2",
77+
"@fortawesome/free-solid-svg-icons": "^6.2.0",
7778
"@fortawesome/react-fontawesome": "^0.2.0",
7879
"@heroicons/react": "^1.0.6",
7980
"@hookform/resolvers": "^3.3.0",
@@ -89,6 +90,7 @@
8990
"bootstrap": "^5.2.2",
9091
"browser": "^0.2.6",
9192
"date-fns": "^2.29.3",
93+
"dayjs": "^1.11.6",
9294
"dotenv": "^16.0.3",
9395
"express": "^4.21.0",
9496
"flowbite": "^1.5.3",
@@ -97,11 +99,13 @@
9799
"googleapis": "^126.0.1",
98100
"graphql": "^16.6.0",
99101
"graphql-request": "^5.1.0",
102+
"html2canvas": "^1.4.1",
100103
"icons": "^1.0.0",
101104
"jest": "^29.1.2",
102105
"jest-environment-jsdom": "^29.1.2",
103106
"joi": "^17.10.2",
104107
"jquery": "^3.6.1",
108+
"jspdf": "^2.5.2",
105109
"jwt-decode": "^3.1.2",
106110
"mini-css-extract-plugin": "^2.6.1",
107111
"moment": "^2.29.4",
@@ -123,7 +127,8 @@
123127
"react-scripts": "^5.0.1",
124128
"react-select": "^5.7.4",
125129
"react-table": "^7.8.0",
126-
"react-toastify": "^9.1.3",
130+
"react-toastify": "^9.0.8",
131+
"redux": "^4.2.0",
127132
"redux-devtools-extension": "^2.13.9",
128133
"redux-state-sync": "^3.1.4",
129134
"redux-thunk": "^2.4.1",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
3+
interface DetailItemProps {
4+
title: string;
5+
value: string | number | boolean;
6+
}
7+
8+
const DetailItem: React.FC<DetailItemProps> = ({ title, value }) => {
9+
return (
10+
<div className="w-72 bg-slate-300 pl-2 py-2 mb-3 rounded-md dark:bg-gray-800 dark:text-white">
11+
<h3 className="pb-1">{title}</h3>
12+
<p className="text-gray-500 text-sm dark:text-gray-400">
13+
{String(value)}
14+
</p>
15+
</div>
16+
);
17+
};
18+
19+
export default DetailItem;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
3+
import { IconType } from "react-icons";
4+
5+
interface ProgramItemProps {
6+
title: string;
7+
value: string | number | boolean;
8+
Icon: IconType;
9+
}
10+
11+
const ProgramItem: React.FC<ProgramItemProps> = ({ title, value,Icon }) => {
12+
return (
13+
<div className="ml-5 flex items-center gap-4">
14+
<Icon size={50} />
15+
<div>
16+
<h3 className="pb-2">{title}</h3>
17+
<p className="text-gray-500 text-sm">{value}</p>
18+
</div>
19+
</div>
20+
);
21+
};
22+
23+
export default ProgramItem;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from "react";
2+
import { DownloadPdf } from "../../utils/DownloadPdf";
3+
4+
interface TraineeDetails {
5+
interview_decision: string;
6+
trainee_id: {
7+
email: string;
8+
lastName: string;
9+
firstName: string;
10+
};
11+
}
12+
13+
interface DecisionButtonProps {
14+
decision: string;
15+
}
16+
17+
const getDecisionDetails = (decision: string) => {
18+
switch (decision) {
19+
case "Passed":
20+
case "Approved":
21+
return {
22+
text: "Passed",
23+
style: "bg-[#56C870] hover:bg-[#67dc82] dark:hover:bg-[#1f544cef] dark:bg-[#56C870]",
24+
};
25+
case "Failed":
26+
case "Rejected":
27+
return {
28+
text: "Failed",
29+
style: "bg-red-800 hover:bg-red-500",
30+
};
31+
default:
32+
return {
33+
text: "No Decision",
34+
style: "bg-gray-400",
35+
};
36+
}
37+
};
38+
39+
const DecisionButton: React.FC<DecisionButtonProps> = ({ decision }) => {
40+
const { text, style } = getDecisionDetails(decision);
41+
42+
return (
43+
<span className={`btn-Aprov h-11 ${style} text-white font-bold py-3 px-5 rounded`}>
44+
{text}
45+
</span>
46+
);
47+
};
48+
49+
const DecisionSection: React.FC<{ traineeDetails: TraineeDetails }> = ({ traineeDetails }) => {
50+
const { interview_decision, trainee_id } = traineeDetails;
51+
52+
return (
53+
<div className="w-full py-7 flex flex-col mx-16 bg-slate-200 rounded-xl shadow-md overflow-hidden md:max-w-2xl lg:flex lg:max-w-3xl dark:bg-[#192432] dark:text-white">
54+
<h2 className="font-bold text-lg text-[#56C870] top-5 ml-5 mt-[-10px] pb-2 uppercase">
55+
Status
56+
</h2>
57+
<div className="h-16 flex pl-6 items-center gap-5">
58+
<DecisionButton decision={interview_decision} />
59+
<button
60+
onClick={() => DownloadPdf()}
61+
className="btn-Aprov h-11 bg-blue-700 hover:bg-blue-600 dark:hover:bg-blue-600 text-white font-bold py-2 px-2 rounded dark:bg-blue-700"
62+
>
63+
Download PDF
64+
</button>
65+
<button className="btn-Aprov h-11 bg-blue-500 hover:bg-blue-600 dark:hover:bg-blue-600 text-white font-bold py-2 px-8 rounded dark:bg-blue-500">
66+
<a
67+
href={`https://mail.google.com/mail/?view=cm&fs=1&to=${trainee_id?.email}&su=Your%20ATLP%20Application%20Email&body=Dear%20${trainee_id?.lastName} ${trainee_id?.firstName},`}
68+
target="_blank"
69+
rel="noopener noreferrer"
70+
>
71+
Email
72+
</a>
73+
</button>
74+
</div>
75+
</div>
76+
);
77+
};
78+
79+
export default DecisionSection;

src/components/form/SignInForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const LoginForm = () => {
188188
</div>
189189
<p className="text-sm mt-3 mb-2 text-[#616161] dark:text-gray-300">
190190
Don't have an account?{" "}
191-
<Link to="/register" className="text-[#56C870]">
191+
<Link to={'/signup'} className="text-[#56C870]">
192192
Sign up
193193
</Link>
194194
</p>

src/components/sidebar/sidebarItems.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export const sidebarItems1 = [
3434
icon: <Icon icon="akar-icons:globe"></Icon>,
3535
title: "Applications",
3636
},
37+
{
38+
path: "Trainee-applicants",
39+
icon: <Icon icon="ic:round-people"></Icon>,
40+
title: "Trainees-Applicants",
41+
},
3742
{
3843
path: "cohort",
3944
icon: <Icon icon="fa6-solid:graduation-cap"></Icon>,

src/pages/TraineApplicant/Trainee.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ const AddTrainee = (props: any) => {
354354
</li>
355355
<li>
356356
<Link
357-
to={`/trainee-applicant-details/${item._id}`}
357+
to={`/admin/trainee-applicant-details/${item._id}`}
358358
className="text-sm hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-500 block px-4 py-2"
359359
>
360360
View

0 commit comments

Comments
 (0)