From 88b09b343d9c9363d64208ea73ddb9c77f3a2fee Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 15 May 2024 17:58:00 +0200 Subject: [PATCH] levels tweaks --- app/(dashboard)/dashboard/page.tsx | 3 +- .../leaderboard/components/Leaderboard.tsx | 6 +-- app/[githubLogin]/page.tsx | 18 +++---- components/ui/userPointsAndLevelCard.tsx | 26 ++++++---- components/ui/userProfileSummary.tsx | 51 ++++++++++--------- lib/github/hooks/issue.ts | 2 +- 6 files changed, 58 insertions(+), 48 deletions(-) diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index 1fcff41..82307e7 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -123,12 +123,13 @@ export default async function DashboardPage() { -
+
{pointsAndLevelsPerRepository.map((repositoryData, index) => { return (
-
+
-
+
Level {sortedLevels.length - levelIndex}: {capitalizeEachWord(level.name)}
@@ -106,7 +106,7 @@ export default function Leaderboard({ )) ) : ( -

+

No player levelled up here yet. Who′s gonna be the first?

)} diff --git a/app/[githubLogin]/page.tsx b/app/[githubLogin]/page.tsx index 70627f9..fd6ee2c 100644 --- a/app/[githubLogin]/page.tsx +++ b/app/[githubLogin]/page.tsx @@ -166,15 +166,15 @@ export default async function ProfilePage({ params }) {

Congrats!

{userEnrollments.map((item) => ( -
-
-
🎉
-
-

- {githubUserData?.name} enrolled to contribute to {item.name} -

-

Let the games begin!

-
+
+
🎉
+
+

+ {githubUserData?.name} enrolled to contribute to {item.name} +

+

Let the games begin!

))} diff --git a/components/ui/userPointsAndLevelCard.tsx b/components/ui/userPointsAndLevelCard.tsx index 2554c2d..f0e92cf 100644 --- a/components/ui/userPointsAndLevelCard.tsx +++ b/components/ui/userPointsAndLevelCard.tsx @@ -4,6 +4,7 @@ import { calculateLevelProgress } from "@/lib/utils/levelUtils"; import { TLevel } from "@/types/level"; import { capitalizeEachWord, capitalizeFirstLetter } from "lib/utils/textformat"; import Image from "next/image"; +import Link from "next/link"; import { Avatar, AvatarImage } from "./avatar"; import { ConditionalParagraphAssignable } from "./conditionalParagraph"; @@ -11,6 +12,7 @@ import ProgressBar from "./progressBar"; interface UserPointsAndLevelCardProps { repositoryName: string; + repositoryId: string; repositoryLogo?: string | null; points: number; rank: number | null; @@ -22,6 +24,7 @@ interface UserPointsAndLevelCardProps { const UserPointsAndLevelCard = ({ repositoryName, repositoryLogo, + repositoryId, points, rank, currentLevelOfUser, @@ -35,6 +38,7 @@ const UserPointsAndLevelCard = ({ )} { return ( -
+
@@ -78,6 +82,7 @@ const UserLevelCard = ({ currentLevelOfUser, assignableTags }) => { const UserPointsCard = ({ repositoryName, repositoryLogo, + repositoryId, points, rank, currentLevelOfUser, @@ -86,15 +91,18 @@ const UserPointsCard = ({ const { progressMadeInThisLevel } = calculateLevelProgress(points, currentLevelOfUser, nextLevelForUser); return (
-
-
{capitalizeFirstLetter(repositoryName)}
- {repositoryLogo && ( - repository-logo - )} -
+ +
+
{capitalizeFirstLetter(repositoryName)}
+ {repositoryLogo && ( + repository-logo + )} +
+

{points}

-

{rank === null ? "No points, no rank 🤷" : `# Rank ${rank}`}

- + +

{rank === null ? "No points, no rank 🤷" : `# Rank ${rank}`}

+ {currentLevelOfUser && (
diff --git a/components/ui/userProfileSummary.tsx b/components/ui/userProfileSummary.tsx index 8ae3e4b..e914c1b 100644 --- a/components/ui/userProfileSummary.tsx +++ b/components/ui/userProfileSummary.tsx @@ -28,36 +28,37 @@ const UserProfileSummary: React.FC = ({ return; }; return ( -
-
-
#{index}
-
- + +
+
+
#{index}
+
+ +
+ +
{name}
- -
{name}
- -
-
- {showSettingButtons && ( -
- - - +
+ {showSettingButtons && ( +
+ + + +
+ )} +
+ {points} points
- )} -
- {points} points
-
+ ); }; export default UserProfileSummary; diff --git a/lib/github/hooks/issue.ts b/lib/github/hooks/issue.ts index 13acd69..1cb174a 100644 --- a/lib/github/hooks/issue.ts +++ b/lib/github/hooks/issue.ts @@ -163,7 +163,7 @@ export const onAssignCommented = async (webhooks: Webhooks) => { owner, repo, issue_number: issueNumber, - body: `With your current level, you are not yet able to work on this issue.`, + body: `With your current level, you are not yet able to work on this issue. Please have a look on oss.gg to see which levels can work on which issues 🤓`, }); return; }