Refactor internify components and services

- Updated LoginInternify to remove unnecessary state initialization.
- Cleaned up NotificationList by removing unused code and fixing button click handler.
- Added project_id prop to InternClaimCert for better data handling.
- Enhanced CertificateNotAvailable to include claim functionality with loading and error states.
- Modified HomeHeader to display a default user name.
- Corrected ProjectTimeline to import ProjectTask from the correct type file.
- Implemented loading and error handling in CertificateListPage.
- Improved MentorProjectDetailPage to handle task updates and navigation correctly.
- Enhanced MentorSettingsPage to manage profile picture errors and state.
- Updated AddInternsDialog to use the correct hook for fetching interns.
- Refactored EditSubmissionTask to handle task updates and errors more effectively.
- Improved MentorProjectCard to include project archiving functionality.
- Removed deprecated useInterns hook and replaced it with useUser for fetching user data.
- Added new useMentors hook for managing mentor-related operations.
- Cleaned up CertificateService by removing unused verifyCertificate function.
- Created MentorServices for managing mentor data operations.
- Updated UserService to include fetching Mahasiswa data and removed unused UserServices file.
This commit is contained in:
Kemas M. Aryadary Rasyad
2026-06-29 15:42:48 +07:00
parent 4084ccf1bf
commit da67ad86d8
29 changed files with 1099 additions and 5581 deletions
+10 -3
View File
@@ -1,4 +1,5 @@
import { Bell, Menu } from "lucide-react"
import { useEffect, useState } from "react";
import humiclogo from "../assets/logo.png";
import { useNavigate } from "react-router-dom";
import { useCurrentUser } from "../hooks/useUser";
@@ -18,13 +19,18 @@ function getInitials(fullName: string | undefined | null): string {
export default function Header({ toggleSidebar }: { toggleSidebar: () => void }) {
const nav = useNavigate();
const { user } = useCurrentUser();
const [imageError, setImageError] = useState(false);
useEffect(() => {
setImageError(false);
}, [user?.profile_picture, user?.full_name]);
// Tentukan base path settings sesuai role
const settingsPath =
user?.role === "intern" ? "/intern/settings" : "/mentor/settings";
const initials = user?.full_name ? getInitials(user.full_name) : "U";
const hasPhoto = !!user?.profile_picture;
const hasPhoto = !!user?.profile_picture && !imageError;
return (
<header className='sticky top-0 flex w-full justify-between items-center py-4 px-12 bg-white border-b border-gray-300 z-10'>
@@ -54,9 +60,10 @@ export default function Header({ toggleSidebar }: { toggleSidebar: () => void })
>
{hasPhoto ? (
<img
src={user!.profile_picture!}
alt={user!.full_name}
src={user?.profile_picture ?? ""}
alt={user?.full_name ?? "Profile"}
className="w-full h-full object-cover"
onError={() => setImageError(true)}
/>
) : (
<div className="w-full h-full bg-[#B30000] flex items-center justify-center">