feat: update certificate handling and project management features

- Refactored CertificateHistory component to display dynamic certificate images.
- Modified CertificateNotAvailable component text for clarity on certificate publication.
- Enhanced CertificateForm to include file preview and clear functionality for uploaded images.
- Removed obsolete CertificatePage component to streamline mentor interface.
- Updated CertificateResult to handle project details and loading states more effectively.
- Improved HomeMentorPage structure by adjusting imports for better organization.
- Enhanced EligibleInternTable with navigation to results and improved error handling for certificate generation.
- Updated HomeMentorProject styles for consistency with design system.
- Added utility function to resolve image URLs for certificates.
- Introduced new hooks for generating certificates and managing notifications.
- Expanded project service functions to include project completion and assignable interns retrieval.
- Updated types for certificates and projects to reflect new data structures.
- Added user types for better type safety in user management.
This commit is contained in:
Kemas M. Aryadary Rasyad
2026-07-02 10:27:28 +07:00
parent 7fffc08912
commit 5dec77862c
23 changed files with 326 additions and 350 deletions
@@ -10,7 +10,8 @@ import {
ChevronLeft,
ChevronRight,
} from "lucide-react";
import { useProjectCertificates } from "../../../hooks/useCertificates";
import { useProjectCertificates } from "../../../hooks/useCertificates"; //Problemnya cuma role "admin" yang bisa
import { useProjectDetail } from "../../../hooks/useProjects";
import type { Certificate } from "../../../types/certificate.types";
import { useParams } from "react-router-dom";
@@ -97,10 +98,17 @@ function CertificateResultSkeleton() {
// ─── Main Page ────────────────────────────────────────────────────────────────
export default function CertificateResult() {
const { id } = useParams<{ id: string }>();
const { slug } = useParams<{ slug: string }>();
const [search, setSearch] = useState("");
const [page, setPage] = useState(1);
const {certificates, loading, error} = useProjectCertificates(Number(id));
const { project, loading: projectLoading, error: projectError } = useProjectDetail(slug ?? "");
const { certificates, loading: certLoading, error: certError } = useProjectCertificates(
project?.id ?? 0
);
const loading = projectLoading || certLoading;
const error = projectError || certError;
if (loading) return <CertificateResultSkeleton />;
if (error) return <div className="text-sm text-red-500 p-4">Gagal memuat data sertifikat.</div>;
@@ -262,7 +270,7 @@ export default function CertificateResult() {
</div>
{/* Preview Card (placeholder — gambar belum diimplementasi) */}
<div className="xl:w-64 w-full flex-shrink-0 rounded-2xl overflow-hidden bg-gradient-to-br from-gray-700 via-[#7a1010] to-[#B30000] shadow-md min-h-[200px] flex flex-col justify-end p-5">
{/* <div className="xl:w-64 w-full flex-shrink-0 rounded-2xl overflow-hidden bg-gradient-to-br from-gray-700 via-[#7a1010] to-[#B30000] shadow-md min-h-[200px] flex flex-col justify-end p-5">
<div className="mt-auto">
<p className="text-white font-extrabold text-base leading-snug">
Institutional Excellence
@@ -271,7 +279,7 @@ export default function CertificateResult() {
Certified via Mentor Portal v2.4
</p>
</div>
</div>
</div> */}
</div>
</div>