Skip to content

Commit

Permalink
#40 Fix single trainee detail page (#125)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
10 people authored Sep 26, 2024
1 parent 5088aa5 commit e30941c
Show file tree
Hide file tree
Showing 12 changed files with 392 additions and 377 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
dist
buildcoverage
package-lock.json
.DS_Store
.DS_Store
build/
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "echo \"Error: no test specified\" && exit 1",
"start": "webpack server",
"dev": "webpack server",
"test": "jest --watchAll=false",
"build": "webpack build",
Expand Down Expand Up @@ -74,6 +74,7 @@
"@emotion/styled": "^11.10.4",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^3.3.0",
Expand All @@ -89,6 +90,7 @@
"bootstrap": "^5.2.2",
"browser": "^0.2.6",
"date-fns": "^2.29.3",
"dayjs": "^1.11.6",
"dotenv": "^16.0.3",
"express": "^4.21.0",
"flowbite": "^1.5.3",
Expand All @@ -97,11 +99,13 @@
"googleapis": "^126.0.1",
"graphql": "^16.6.0",
"graphql-request": "^5.1.0",
"html2canvas": "^1.4.1",
"icons": "^1.0.0",
"jest": "^29.1.2",
"jest-environment-jsdom": "^29.1.2",
"joi": "^17.10.2",
"jquery": "^3.6.1",
"jspdf": "^2.5.2",
"jwt-decode": "^3.1.2",
"mini-css-extract-plugin": "^2.6.1",
"moment": "^2.29.4",
Expand All @@ -123,7 +127,8 @@
"react-scripts": "^5.0.1",
"react-select": "^5.7.4",
"react-table": "^7.8.0",
"react-toastify": "^9.1.3",
"react-toastify": "^9.0.8",
"redux": "^4.2.0",
"redux-devtools-extension": "^2.13.9",
"redux-state-sync": "^3.1.4",
"redux-thunk": "^2.4.1",
Expand Down
19 changes: 19 additions & 0 deletions src/components/TraineeDetail/DetailItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";

interface DetailItemProps {
title: string;
value: string | number | boolean;
}

const DetailItem: React.FC<DetailItemProps> = ({ title, value }) => {
return (
<div className="w-72 bg-slate-300 pl-2 py-2 mb-3 rounded-md dark:bg-gray-800 dark:text-white">
<h3 className="pb-1">{title}</h3>
<p className="text-gray-500 text-sm dark:text-gray-400">
{String(value)}
</p>
</div>
);
};

export default DetailItem;
23 changes: 23 additions & 0 deletions src/components/TraineeDetail/ProgramBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";

import { IconType } from "react-icons";

interface ProgramItemProps {
title: string;
value: string | number | boolean;
Icon: IconType;
}

const ProgramItem: React.FC<ProgramItemProps> = ({ title, value,Icon }) => {
return (
<div className="ml-5 flex items-center gap-4">
<Icon size={50} />
<div>
<h3 className="pb-2">{title}</h3>
<p className="text-gray-500 text-sm">{value}</p>
</div>
</div>
);
};

export default ProgramItem;
79 changes: 79 additions & 0 deletions src/components/TraineeDetail/decisionSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from "react";
import { DownloadPdf } from "../../utils/DownloadPdf";

interface TraineeDetails {
interview_decision: string;
trainee_id: {
email: string;
lastName: string;
firstName: string;
};
}

interface DecisionButtonProps {
decision: string;
}

const getDecisionDetails = (decision: string) => {
switch (decision) {
case "Passed":
case "Approved":
return {
text: "Passed",
style: "bg-[#56C870] hover:bg-[#67dc82] dark:hover:bg-[#1f544cef] dark:bg-[#56C870]",
};
case "Failed":
case "Rejected":
return {
text: "Failed",
style: "bg-red-800 hover:bg-red-500",
};
default:
return {
text: "No Decision",
style: "bg-gray-400",
};
}
};

const DecisionButton: React.FC<DecisionButtonProps> = ({ decision }) => {
const { text, style } = getDecisionDetails(decision);

return (
<span className={`btn-Aprov h-11 ${style} text-white font-bold py-3 px-5 rounded`}>
{text}
</span>
);
};

const DecisionSection: React.FC<{ traineeDetails: TraineeDetails }> = ({ traineeDetails }) => {
const { interview_decision, trainee_id } = traineeDetails;

return (
<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">
<h2 className="font-bold text-lg text-[#56C870] top-5 ml-5 mt-[-10px] pb-2 uppercase">
Status
</h2>
<div className="h-16 flex pl-6 items-center gap-5">
<DecisionButton decision={interview_decision} />
<button
onClick={() => DownloadPdf()}
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"
>
Download PDF
</button>
<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">
<a
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},`}
target="_blank"
rel="noopener noreferrer"
>
Email
</a>
</button>
</div>
</div>
);
};

export default DecisionSection;
5 changes: 5 additions & 0 deletions src/components/sidebar/sidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export const sidebarItems1 = [
icon: <Icon icon="akar-icons:globe"></Icon>,
title: "Applications",
},
{
path: "Trainee-applicants",
icon: <Icon icon="ic:round-people"></Icon>,
title: "Trainees-Applicants",
},
{
path: "cohort",
icon: <Icon icon="fa6-solid:graduation-cap"></Icon>,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TraineApplicant/Trainee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ const AddTrainee = (props: any) => {
</li>
<li>
<Link
to={`/trainee-applicant-details/${item._id}`}
to={`/admin/trainee-applicant-details/${item._id}`}
className="text-sm hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-500 block px-4 py-2"
>
View
Expand Down
Loading

0 comments on commit e30941c

Please sign in to comment.