From 634af337569b41f3b6820e6cb1ee854e87129c0e Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 9 Apr 2024 22:40:51 +0100 Subject: [PATCH] Revamp UI for profile page --- .../UserPublicActivityHeatmap.tsx | 48 ++++++++++- .../UserPublicProfileHeader.tsx | 8 +- .../UserPublicProfilePage.tsx | 36 ++++---- .../UserPublicProgresses.tsx | 83 ++++++++++--------- 4 files changed, 110 insertions(+), 65 deletions(-) diff --git a/src/components/UserPublicProfile/UserPublicActivityHeatmap.tsx b/src/components/UserPublicProfile/UserPublicActivityHeatmap.tsx index f07305050..8a36c4661 100644 --- a/src/components/UserPublicProfile/UserPublicActivityHeatmap.tsx +++ b/src/components/UserPublicProfile/UserPublicActivityHeatmap.tsx @@ -9,6 +9,15 @@ import dayjs from 'dayjs'; type UserActivityHeatmapProps = { activity: UserActivityCount; }; + +const legends = [ + { count: '1-2', color: 'bg-gray-200' }, + { count: '3-4', color: 'bg-gray-300' }, + { count: '5-9', color: 'bg-gray-500' }, + { count: '10-19', color: 'bg-gray-600' }, + { count: '20+', color: 'bg-gray-800' }, +]; + export function UserActivityHeatmap(props: UserActivityHeatmapProps) { const { activity } = props; const data = Object.entries(activity.activityCount).map(([date, count]) => ({ @@ -20,7 +29,16 @@ export function UserActivityHeatmap(props: UserActivityHeatmapProps) { const endDate = dayjs().toDate(); return ( - <> +
+
+
+

Activity

+

+ Progress updates over the past year +

+
+ Member since: June 2021 +
@@ -60,6 +78,30 @@ export function UserActivityHeatmap(props: UserActivityHeatmapProps) { id="user-activity-tip" className="!rounded-lg !bg-gray-900 !p-1 !px-2 !text-sm" /> - + +
+ + Number of topics marked as learning, or completed by day + +
+ Less + {legends.map((legend) => ( +
+
+
+ ))} + More + +
+
+
); } diff --git a/src/components/UserPublicProfile/UserPublicProfileHeader.tsx b/src/components/UserPublicProfile/UserPublicProfileHeader.tsx index d5911b30d..769e310af 100644 --- a/src/components/UserPublicProfile/UserPublicProfileHeader.tsx +++ b/src/components/UserPublicProfile/UserPublicProfileHeader.tsx @@ -12,7 +12,7 @@ export function UserPublicProfileHeader(props: UserPublicProfileHeaderProps) { const { headline, isAvailableForHire, isEmailVisible } = publicConfig!; return ( -
+
{isAvailableForHire && ( - + Available for hire )} -

{name}

-

{headline}

+

{name}

+

{headline}

{links?.github && } {links?.linkedin && ( diff --git a/src/components/UserPublicProfile/UserPublicProfilePage.tsx b/src/components/UserPublicProfile/UserPublicProfilePage.tsx index a64e33ff9..be00d140d 100644 --- a/src/components/UserPublicProfile/UserPublicProfilePage.tsx +++ b/src/components/UserPublicProfile/UserPublicProfilePage.tsx @@ -16,25 +16,23 @@ export function UserPublicProfilePage(props: UserPublicProfilePageProps) { } = props; return ( - <> - -
+
+
+ + -
- -
-
- -
-
- + + + +
+
); } diff --git a/src/components/UserPublicProfile/UserPublicProgresses.tsx b/src/components/UserPublicProfile/UserPublicProgresses.tsx index faea3df15..5378aba3d 100644 --- a/src/components/UserPublicProfile/UserPublicProgresses.tsx +++ b/src/components/UserPublicProfile/UserPublicProgresses.tsx @@ -24,19 +24,50 @@ export function UserPublicProgresses(props: UserPublicProgressesProps) { (roadmap) => roadmap.isCustomResource, ); + // + return (
- {roadmapVisibility !== 'none' && ( - <> -

My Skills

- {roadmaps?.length === 0 ? ( -
- No skills added yet. -
- ) : ( -
    + {customRoadmapVisibility !== 'none' && customRoadmaps?.length > 0 && ( +
    +

    + Roadmaps made by me +

    +
    + {customRoadmaps.map((roadmap, counter) => ( + + {roadmap.title} + + ))} +
    +
    + )} + +
    + {roadmapVisibility !== 'none' && ( + <> +

    My Skills

    +
      {roadmaps.map((roadmap, counter) => ( -
    • +
    • ))}
    - )} - - )} - - {customRoadmapVisibility !== 'none' && customRoadmaps?.length > 0 && ( - <> -

    My Roadmaps

    -
      - {customRoadmaps.map((roadmap, counter) => ( -
    • - -
    • - ))} -
    - - )} + + )} +
); }