Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.3 KiB

feat: profile pages, custom roadmap pages and SSR (#5494) * Update * Add stats and health endpoints * Add pre-render * fix: redirect to the error page * Fix generate-renderer issue * Rename * Fix best practice topics not loading * Handle SSR for static pages * Refactor faqs * Refactor best practices * Fix absolute import * Fix stats * Add custom roadmap page * Minor UI change * feat: custom roadmap slug routes (#4987) * feat: replace roadmap slug * fix: remove roadmap slug * feat: username route * fix: user public page * feat: show roadmap progress * feat: update public profile * fix: replace with toast * feat: user public profile page * feat: implement profile form * feat: implement user profile roadmap page * refactor: remove logs * fix: increase progress gap * fix: remove title margin * fix: breakpoint for roadmaps * Update dependencies * Upgrade dependencies * fix: improper avatars * fix: heatmap focus * wip: remove `getStaticPaths` * fix: add disable props * wip * feat: add email icon * fix: update pnpm lock * fix: implement author page * Fix beginner roadmaps not working * Changes to form * Refactor profile and form * Refactor public profile form * Rearrange sidebar items * Update UI for public form * Minor text update * Refactor public profile form * Error page for user * Revamp UI for profile page * Add public profile page * Fix vite warnings * Add private profile banner * feat: on blur check username * Update fetch depth * Add error detail * Use hybrid mode of rendering * Do not pre-render stats pages * Update deployment workflow * Update deployment workflow --------- Co-authored-by: Arik Chakma <arikchangma@gmail.com>
10 months ago
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 (
<>
<PrivateProfileBanner
isOwnProfile={isOwnProfile}
profileVisibility={profileVisibility}
/>
<div className="container mt-5">
<div className="flex items-center justify-between gap-2">
<p className="flex items-center gap-1 text-sm">
<a
href={`/u/${username}`}
className="text-gray-600 hover:text-gray-800"
>
{username}
</a>
<span>/</span>
<a
href={`/u/${username}/${resourceId}`}
className="text-gray-600 hover:text-gray-800"
>
{resourceId}
</a>
</p>
<a
href={trackProgressRoadmapUrl}
className="rounded-md border px-2.5 py-1 text-sm font-medium"
>
Track your Progress
</a>
</div>
<h2 className="mt-10 text-2xl font-bold sm:text-4xl">{title}</h2>
<p className="mt-2 text-sm text-gray-500 sm:text-lg">
Skills {name} has mastered on the {title?.toLowerCase()}.
</p>
</div>
<div className="relative z-50 mt-10 hidden items-center justify-between border-y bg-white px-2 py-1.5 sm:flex">
<p className="container flex text-sm">
<span className="mr-2.5 rounded-sm bg-yellow-200 px-1 py-0.5 text-xs font-medium uppercase text-yellow-900">
<span data-progress-percentage="">{progressPercentage}</span>% Done
</span>
<span className="itesm-center hidden md:flex">
<span>
<span>{done.length}</span> completed
</span>
<span className="mx-1.5 text-gray-400">&middot;</span>
<span>
<span>{learning.length}</span> in progress
</span>
<span className="mx-1.5 text-gray-400">&middot;</span>
<span>
<span>{skipped.length}</span> skipped
</span>
<span className="mx-1.5 text-gray-400">&middot;</span>
<span>
<span>{topicCount}</span> Total
</span>
</span>
<span className="md:hidden">
<span>{totalMarked}</span> of <span>{topicCount}</span> Done
</span>
</p>
</div>
<UserProfileRoadmapRenderer {...props} resourceType="roadmap" />
</>
);
}