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:
@@ -3,14 +3,27 @@ import { useState } from "react";
|
||||
import { Calendar, Edit } from "lucide-react";
|
||||
import EditSubmissionModal from "./components/EditSubmissionTask";
|
||||
import { useTaskSubmissions } from "../../../hooks/useTasks";
|
||||
import type { ProjectTask } from "../../../types/task.types";
|
||||
|
||||
const toSlug = (name: string) => name.toLowerCase().replace(/\s+/g, '-');
|
||||
|
||||
export default function MentorProjectsDetailPage() {
|
||||
const navigate = useNavigate();
|
||||
const { slug, taskSlug } = useParams<{ slug: string; taskSlug: string }>();
|
||||
const { task, loading, error } = useTaskSubmissions(taskSlug!, slug);
|
||||
const { task, loading, error, refetch } = useTaskSubmissions(taskSlug!, slug);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
// Di MentorProjectsDetailPage
|
||||
const handleEditSuccess = (updatedTask: ProjectTask) => {
|
||||
if (updatedTask.slug !== taskSlug) {
|
||||
// Slug berubah, navigate ke URL baru
|
||||
navigate(`/mentor/projects/${slug}/${updatedTask.slug}`, { replace: true });
|
||||
} else {
|
||||
// Slug sama, cukup refetch
|
||||
refetch();
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) return (
|
||||
<div className="space-y-4">
|
||||
{[...Array(3)].map((_, i) => (
|
||||
@@ -152,6 +165,8 @@ export default function MentorProjectsDetailPage() {
|
||||
<EditSubmissionModal
|
||||
isOpen={openModal}
|
||||
onClose={() => setOpenModal(false)}
|
||||
task={task}
|
||||
onSuccess={handleEditSuccess}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user