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:
+4
-24
@@ -3,28 +3,8 @@ import { useState, useEffect, useCallback } from "react";
|
||||
import { loginUser, getProfile, updateProfile } from "../services/UserService";
|
||||
import type { Mahasiswa } from '../types/project.types';
|
||||
import { getMahasiswa } from '../services/MahasiswaService';
|
||||
import type { CurrentUser, UpdateProfilePayload } from "../types/user.types";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface CurrentUser {
|
||||
id: number;
|
||||
full_name: string;
|
||||
nama_depan: string;
|
||||
nama_belakang: string;
|
||||
email: string;
|
||||
role: "mentor" | "intern" | "admin";
|
||||
professional_bio?: string;
|
||||
profile_picture?: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateProfilePayload {
|
||||
full_name?: string;
|
||||
email?: string;
|
||||
professional_bio?: string;
|
||||
profile_picture?: File | null;
|
||||
}
|
||||
|
||||
// ─── useCurrentUser ───────────────────────────────────────────────────────────
|
||||
// GET /auth-api/me — ambil data user yang sedang login
|
||||
export const useCurrentUser = () => {
|
||||
const [user, setUser] = useState<CurrentUser | null>(null);
|
||||
@@ -47,7 +27,6 @@ export const useCurrentUser = () => {
|
||||
return { user, loading, error, refetch };
|
||||
};
|
||||
|
||||
// ─── useLogin ────────────────────────────────────────────────────────────────
|
||||
// POST /auth-api/login
|
||||
export const useLogin = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -75,7 +54,6 @@ export const useLogin = () => {
|
||||
return { login, loading, error, setError };
|
||||
};
|
||||
|
||||
// ─── useUpdateProfile ────────────────────────────────────────────────────────
|
||||
// PATCH /auth-api/update-profile
|
||||
export const useUpdateProfile = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -118,4 +96,6 @@ export const useMahasiswa = () => {
|
||||
useEffect(() => { refetch(); }, [refetch]);
|
||||
|
||||
return { mahasiswa, loading, error, refetch };
|
||||
};
|
||||
};
|
||||
|
||||
export const useAssignableInterns = () => {}
|
||||
Reference in New Issue
Block a user