Skip to content

Commit

Permalink
* feature: improve trainee details page
Browse files Browse the repository at this point in the history
* 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 committed Oct 4, 2024
1 parent bd88713 commit dca1783
Show file tree
Hide file tree
Showing 12 changed files with 3,951 additions and 3,179 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^3.3.0",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^5.10.11",
"@mui/x-date-pickers": "^5.0.6",
"@testing-library/jest-dom": "^5.16.5",
Expand Down
11 changes: 3 additions & 8 deletions src/components/form/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,18 @@ const LoginForm = () => {
});

const redirectAfterLogin = async () => {
const lastAttemptedRoute = localStorage.getItem('lastAttemptedRoute');
if (lastAttemptedRoute) {
localStorage.removeItem('lastAttemptedRoute');
navigate(lastAttemptedRoute);
} else {
await Token();
const role = localStorage.getItem("roleName") as string;

if (role === "applicant") {
navigate("/applicant");
} else if (role === "superAdmin" || role === "admin") {
} else if (role === "superAdmin" || "Admin") {
navigate("/admin");
} else {
const searchParams = new URLSearchParams(location.search);
const returnUrl = searchParams.get('returnUrl') || '/';
navigate(returnUrl);
}
}
}

const onSubmit = async (data: loginFormData) => {
Expand Down Expand Up @@ -188,7 +183,7 @@ const LoginForm = () => {
</div>
<p className="text-sm mt-3 mb-2 text-[#616161] dark:text-gray-300">
Don't have an account?{" "}
<Link to="/register" className="text-[#56C870]">
<Link to={'/signup'} className="text-[#56C870]">
Sign up
</Link>
</p>
Expand Down
9 changes: 8 additions & 1 deletion src/components/sidebar/navHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const logo: string = require("../../assets/logo.svg").default;
const profile: string = require("../../assets/avatar.png").default;
const LogoWhite: string = require("../../assets/logoWhite.svg").default;
import jwtDecode from "jwt-decode";
import {destination} from '../../utils/utils'

const placeholderImage = profile;

Expand All @@ -20,6 +21,7 @@ const onImageError = (e) => {
}

function NavBar() {
const userDestination = destination();
const access_token = localStorage.getItem("access_token");
//@ts-ignore
const user = access_token ? jwtDecode(access_token).picture : profile;
Expand All @@ -35,7 +37,10 @@ function NavBar() {
const handleShowProfileDropdown = () =>
setShowprofileDropdown(!showProfileDropdown);



return (

<div className="flex items-center dark:bg-zinc-800 ">
{showProfileDropdown && (
<ProfileDropdown
Expand All @@ -59,8 +64,9 @@ function NavBar() {
<IoClose className="w-7 text-9xl dark:text-dark-text-fill" />
)}
</span>

<span>
<Link to="/" className="flex items-center">
<Link to={userDestination} className="flex items-center">
{theme ? (
<img
className="cursor-pointer mx-2 fill-[blue]"
Expand All @@ -79,6 +85,7 @@ function NavBar() {
</h1>
</Link>
</span>

</div>
<div className="flex items-center mr-4">
<span className="flex items-center">
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const Sidebar = ({ expanded, setExpanded }) => {
</ul>
<button
onClick={handleLogout}
className="flex items-center p-1 font-semibold hover:font-bold text-white focus:outline-none hover:text-[#56c770] mt-4 ml-4 mt-3"
className="flex items-center p-1 font-semibold hover:font-bold text-white focus:outline-none hover:text-[#56c770] mt-4 ml-4"
>
<Icon icon="hugeicons:logout-circle-02" className="mr-3" />
{expanded && <span>Logout</span>}
Expand Down
1 change: 1 addition & 0 deletions src/components/sidebar/sidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const applicantSidebarItems = [
title: "Job Post ",
},
];

export const sidebarItems2 = [
{
path: "/documents",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PageNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const PageNotFound = () => {
<Link to="/applicant">
<button>Go to Applicant Dashboard</button>
</Link>
) : (role === "superAdmin" || role === "admin") ? (
) : role === "superAdmin" || role === "Admin" ? (
<Link to="/admin">
<button>Go back to Homepage</button>
</Link>
Expand Down
28 changes: 16 additions & 12 deletions src/pages/PrivateRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { Navigate, useLocation } from "react-router-dom";
import { Navigate, Outlet, useLocation } from "react-router-dom";
import { Token } from "../utils/utils";
import { useEffect } from "react";
import { useEffect, useState } from "react";

const PrivateRoute = ({ children }) => {

const PrivateRoute = ({ children, allowedRoles }) => {
const access_token = Token();
const roleName = localStorage.getItem('roleName');
const location = useLocation();
const user =
//@ts-ignore
access_token !== null && access_token !== undefined && access_token !== '';

const user = access_token && roleName && allowedRoles.includes(roleName);
if (!access_token) {
return <Navigate to="/login" />;
}

if (!user) {
return <Navigate to="/pageNotFound" />;
}

useEffect(() => {
if(!user){
localStorage.setItem('lastAttemptedRoute', location.pathname);
}
}, [user, location])
return user ? children : <Navigate to="/login" />;
return children;
};


export default PrivateRoute;

4 changes: 2 additions & 2 deletions src/pages/programs/Programs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,15 @@ const Programs = (props: any) => {
>
<li>
<Link
to={`/program/${item._id}/edit`}
to={`/admin/program/${item._id}/edit`}
className="text-sm hover:bg-gray-100 text-gray-700 dark:hover:bg-gray-500 dark:text-white block px-4 py-2"
>
Edit
</Link>
</li>
<li>
<Link
to={`/program/${item._id}`}
to={`/admin/program/${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
4 changes: 2 additions & 2 deletions src/pages/programs/UpdateProgram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const UpdateProgram = (props: any) => {
<>

<div className="flex flex-col overflow-x-hidden bg-white dark:bg-dark-tertiary relative mt-10 w-[100%] py-3 min-h-[100vh]">
<div className="block text-center text-sm font-bold text-gray-600 relative lg:left-[8rem] dark:text-white text-base lg:max-w-3xl sm:w-[100%] p-4 lg:px-4 m-4 mx-auto text-[24px]">
<div className="block text-center font-bold text-gray-600 relative lg:left-[8rem] dark:text-white text-base lg:max-w-3xl sm:w-[100%] p-4 lg:px-4 m-4 mx-auto text-[24px]">
<h1 className="p-2">Update Program</h1>
</div>
<form
Expand Down Expand Up @@ -264,7 +264,7 @@ const UpdateProgram = (props: any) => {
{updateProgramStates.loading ? "Updating..." : "Update"}
</button>
<Link
to="/programs"
to="/admin/programs"
className="dark:bg-[#56C870] flex bg-gray-600 rounded-md py-2 px-4 text-white font-medium cursor-pointer"
>
Cancel
Expand Down
Loading

0 comments on commit dca1783

Please sign in to comment.