feat: Refactor Mentor Settings Page and improve user profile handling
- Removed MentorSettingsPage component to streamline user profile management. - Updated ProjectForumTab and ProjectsInternTab for better UI/UX. - Enhanced ProjectsPage loading state with a spinner. - Improved TaskTab to handle loading states and error messages more effectively. - Added new utility functions for user initials and file URL resolution. - Updated UserService to normalize user data and handle profile updates more efficiently. - Enhanced CSS styles for better visual consistency across components. - Added new properties to CurrentUser type for better user data management.
This commit is contained in:
@@ -1,39 +1,40 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { getProjectIcon } from '../../../../lib/ProjectIcons';
|
||||
import type { Project } from '../../../../types/project.types';
|
||||
import { resolveFileUrl } from '../../../../hooks/useUser';
|
||||
|
||||
const ProjectCard = (project: Project) => {
|
||||
const navigate = useNavigate();
|
||||
const Icon = getProjectIcon(project.project_icon);
|
||||
|
||||
|
||||
const tasksDone = project.task_done;
|
||||
const Avatar = resolveFileUrl(project.admin.profile_picture);
|
||||
const tasksDone = project.task_done;
|
||||
const tasksTotal = project.total_tasks;
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={() => navigate(`/intern/projects/${project.slug}`)}
|
||||
className=" rounded-xl overflow-hidden shadow-sm border border-gray-100 w-full flex flex-col cursor-pointer hover:shadow-md transition-shadow duration-200"
|
||||
className="w-[220px] min-h-[320px] flex flex-col bg-white rounded-xl overflow-hidden shadow-sm border border-gray-100 cursor-pointer hover:shadow-md transition-shadow duration-200"
|
||||
>
|
||||
{/* Thumbnail */}
|
||||
<div style={{ backgroundColor: project.background_color ?? '#dc2626' }} className="h-[150px] overflow-hidden flex items-center justify-center">
|
||||
<div
|
||||
style={{ backgroundColor: project.background_color ?? '#dc2626' }}
|
||||
className="h-[150px] flex items-center justify-center flex-shrink-0"
|
||||
>
|
||||
<Icon className="w-12 h-12 text-white opacity-80" />
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="min-h-[180px] max-h-[200px] flex-1 flex flex-col justify-between py-3">
|
||||
<div className="flex flex-col flex-1 justify-between py-3">
|
||||
<div className="px-3 flex flex-col gap-2">
|
||||
{/* Project Name */}
|
||||
<p className="text-xs lg:text-sm font-semibold text-gray-800 leading-tight">
|
||||
<p className="text-sm font-semibold text-gray-800 leading-tight">
|
||||
{project.project_name}
|
||||
</p>
|
||||
|
||||
{/* Mentor */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-6 h-6 rounded-full bg-gray-200 overflow-hidden flex-shrink-0">
|
||||
{project.admin.profile_picture ? (
|
||||
{Avatar ? (
|
||||
<img
|
||||
src={project.admin.profile_picture}
|
||||
src={Avatar}
|
||||
alt={project.admin.full_name}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
@@ -44,7 +45,6 @@ const ProjectCard = (project: Project) => {
|
||||
<span className="text-xs text-gray-500 truncate">{project.admin.email}</span>
|
||||
</div>
|
||||
|
||||
{/* Progress bar */}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="w-full h-1.5 bg-gray-200 rounded-full overflow-hidden">
|
||||
<div
|
||||
@@ -58,11 +58,8 @@ const ProjectCard = (project: Project) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Button */}
|
||||
<div className="flex items-end justify-end px-3 pb-1">
|
||||
<button
|
||||
className="bg-red-600 hover:bg-red-700 text-white text-xs font-medium py-1.5 px-3 rounded-xl transition-colors"
|
||||
>
|
||||
<div className="flex items-end justify-end px-3">
|
||||
<button className="bg-red-600 hover:bg-red-700 text-white text-xs font-medium py-1.5 px-3 rounded-xl transition-colors">
|
||||
View Project
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user