import { FC, ReactElement } from 'react'; import { Button } from '@imphnen-frontend-service/ui/atoms'; import { useParams, useNavigate, Link } from 'react-router'; import { useUserDetailsById, useTeamsByUserId, } from '@imphnen-frontend-service/service'; import { Icon } from '@iconify/react'; const UserProfilePage: FC = (): ReactElement => { const { userId } = useParams<{ userId: string }>(); const navigate = useNavigate(); const { data: userData, isLoading, error } = useUserDetailsById(userId || ''); const { data: teamsData } = useTeamsByUserId(userId || ''); const user = userData?.data; const userTeams = teamsData?.data || []; if (isLoading) { return (
Loading user profile...
); } if (error || !user) { return (

User not found

{error && (

{String(error)}

)}
); } return (
{/* Header */}
{user.avatar ? ( {user.fullname} ) : (
)}

{user.fullname}

{user.email}

{user.location && (
{user.location}
)}
{/* Main Content */}
{/* About Section */} {user.bio && (

About

{user.bio}

)} {/* Skills Section */} {user.skills && user.skills.length > 0 && (

Skills

{user.skills.map((skill: string) => ( {skill} ))}
)} {/* Teams Section */} {userTeams.length > 0 ? (

Teams ({userTeams.length})

{userTeams.map((team: any) => (
{team.name}
{team.logo && ( {team.name} )}

{team.name}

{team.city}

{team.members?.length || 0} members

{team.description}

))}
) : (

Teams

👥

Not in any team yet

)}
{/* Sidebar */}
{/* Contact Info */}

Contact Information

Email

{user.email}

{user.location && (

Location

{user.location}

)}
); }; export default UserProfilePage;