From 508ffe5f8493890092aecc66ae3e78b00ded11b8 Mon Sep 17 00:00:00 2001
From: "Kemas M. Aryadary Rasyad"
<112590882+aryadary0706@users.noreply.github.com>
Date: Fri, 3 Jul 2026 15:03:17 +0700
Subject: [PATCH] [UNTEST] CERTIFICATE GENERATION AND BACKEND ENDPOINT
IMPLEMENTATION ON CERTIFICATES (CLAIM, GENERATE, FETCH DATA)
- Updated AddInternsModal to allow selection of interns via dropdown instead of email input.
- Introduced CertResultTable component for displaying certificate results with search and pagination.
- Modified CreateProjectDialog to accept an onSuccess callback for better project creation handling.
- Integrated certificate generation functionality in EligibleInternTable with improved error handling.
- Enhanced HomeMentorProject and MentorProjectCard to dynamically display project icons and statuses.
- Refactored SidebarMentor to improve active route detection.
- Added utility functions for certificate preview and download in Certificates.ts.
- Removed unused DownloadImagetoDevice utility and related hooks.
- Implemented useProjectsByRole hook for fetching projects based on user role.
- Updated types for certificates and projects to reflect recent changes in the data structure.
---
src/App.tsx | 4 +-
...rnCertiDetail.tsx => InternCertDetail.tsx} | 30 +-
.../intern/components/CertificateAvailabe.tsx | 117 ++++---
.../intern/components/CertificateHistory.tsx | 7 -
.../intern/components/HomeProjectList.tsx | 16 +-
.../intern/components/SidebarIntern.tsx | 2 +-
.../internify/mentor/BaseProjectsPage.tsx | 10 +-
.../internify/mentor/CertificateResult.tsx | 301 +++---------------
src/Pages/internify/mentor/InternsPage.tsx | 40 ++-
.../mentor/components/AddInternsDialog.tsx | 37 +--
.../components/AddInternsToProjects.tsx | 76 +++--
.../mentor/components/CertResultTable.tsx | 186 +++++++++++
.../mentor/components/CreateProjectDialog.tsx | 10 +-
.../mentor/components/EligibleInternTable.tsx | 88 +++--
.../mentor/components/HomeMentorProject.tsx | 14 +-
.../mentor/components/MentorProjectCard.tsx | 20 +-
.../mentor/components/SidebarMentor.tsx | 2 +-
src/Pages/utils/Certificates.ts | 180 +++++++++++
src/Pages/utils/DownloadImagetoDevice.ts | 85 -----
src/Pages/utils/ProtectedRoute.tsx | 2 -
src/Pages/utils/SertificateGenerator.ts | 17 +-
src/Pages/utils/testlayout.html | 39 +++
src/hooks/useCertificates.ts | 22 +-
src/hooks/useForm.ts | 1 -
src/hooks/useListProjects.ts | 52 +++
src/hooks/useUser.ts | 4 +-
src/services/UserService.ts | 2 +-
src/types/certificate.types.ts | 23 +-
src/types/project.types.ts | 2 +-
29 files changed, 782 insertions(+), 607 deletions(-)
rename src/Pages/internify/intern/{InternCertiDetail.tsx => InternCertDetail.tsx} (83%)
create mode 100644 src/Pages/internify/mentor/components/CertResultTable.tsx
create mode 100644 src/Pages/utils/Certificates.ts
delete mode 100644 src/Pages/utils/DownloadImagetoDevice.ts
create mode 100644 src/Pages/utils/testlayout.html
delete mode 100644 src/hooks/useForm.ts
create mode 100644 src/hooks/useListProjects.ts
diff --git a/src/App.tsx b/src/App.tsx
index 42885ef..11dce24 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -31,7 +31,6 @@ import EditLowongan from "./Pages/EditLowongan";
import HomeInternPage from "./Pages/Internify/intern/HomeInternPage";
import { InternLayout, MentorLayout } from "./Pages/Internify/layout";
import ProjectsPage from "./Pages/Internify/intern/ProjectsPage";
-import SertificatePage from "./Pages/Internify/intern/InternCertiDetail";
import ProjectDetailPage from "./Pages/Internify/intern/ProjectDetailPage";
import HomeMentorPage from "./Pages/Internify/mentor/HomeMentorPage";
import MentorProjectsPage from "./Pages/Internify/mentor/BaseProjectsPage";
@@ -54,6 +53,7 @@ import AdminMentorPage from "./Pages/MentorPage";
import CreateMentorForm from "./Pages/CreateMentorForm";
import EditMentorForm from "./Pages/EditMentorForm";
import NotFoundPage from "./Pages/NotFoundPage";
+import InternCertificateDetail from "./Pages/Internify/intern/InternCertDetail";
function App() {
return (
@@ -103,7 +103,7 @@ function App() {
{new Date(item.issued_at).toLocaleDateString("id-ID", {
diff --git a/src/Pages/internify/intern/components/HomeProjectList.tsx b/src/Pages/internify/intern/components/HomeProjectList.tsx
index fb273dc..91e8ac3 100644
--- a/src/Pages/internify/intern/components/HomeProjectList.tsx
+++ b/src/Pages/internify/intern/components/HomeProjectList.tsx
@@ -1,12 +1,19 @@
import { useNavigate } from 'react-router-dom';
import { useProjects } from '../../../../hooks/useProjects';
+import * as LucideIcons from 'lucide-react';
+import type { LucideProps } from 'lucide-react';
const toSlug = (name: string) => name.toLowerCase().replace(/\s+/g, '-');
+const getDynamicIcon = (iconName: string) => {
+ const formatted = iconName.charAt(0).toUpperCase() + iconName.slice(1);
+ const Icon = (LucideIcons as unknown as Record {project.project_name} {project.status}