import type { GetUserProfileRoadmapResponse, GetPublicProfileResponse, } from '../../api/user'; import { getPercentage } from '../../helper/number'; import { PrivateProfileBanner } from './PrivateProfileBanner'; import { UserProfileRoadmapRenderer } from './UserProfileRoadmapRenderer'; type UserProfileRoadmapProps = GetUserProfileRoadmapResponse & Pick< GetPublicProfileResponse, 'username' | 'name' | 'isOwnProfile' | 'profileVisibility' > & { resourceId: string; }; export function UserProfileRoadmap(props: UserProfileRoadmapProps) { const { username, name, title, resourceId, isCustomResource, done = [], skipped = [], learning = [], topicCount, isOwnProfile, profileVisibility, } = props; const trackProgressRoadmapUrl = isCustomResource ? `/r/${resourceId}` : `/${resourceId}`; const totalMarked = done.length + skipped.length; const progressPercentage = getPercentage(totalMarked, topicCount); return ( <>

{username} / {resourceId}

Track your Progress

{title}

Skills {name} has mastered on the {title?.toLowerCase()}.

{progressPercentage}% Done {done.length} completed · {learning.length} in progress · {skipped.length} skipped · {topicCount} Total {totalMarked} of {topicCount} Done

); }