Skip to content

Commit

Permalink
levels tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jobenjada committed May 15, 2024
1 parent 8efb384 commit 88b09b3
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 48 deletions.
3 changes: 2 additions & 1 deletion app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ export default async function DashboardPage() {
<DashboardShell>
<DashboardHeader heading="Shall we play a game?"></DashboardHeader>

<div className=" grid gap-4 ">
<div className=" grid gap-8">
{pointsAndLevelsPerRepository.map((repositoryData, index) => {
return (
<div key={repositoryData.id}>
<UserPointsAndLevelCard
key={repositoryData.id}
repositoryId={repositoryData.id}
repositoryName={repositoryData.repositoryName}
points={repositoryData.points}
rank={repositoryData.rank}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ export default function Leaderboard({

return (
<div key={level.id}>
<div className="mt-6 border-b-2 border-foreground py-3">
<div className="mt-6 border-b border-foreground/25 py-3">
<div className="flex items-center gap-6">
<Avatar className="h-12 w-12">
<AvatarImage src={level.iconUrl} alt="level icon" />
</Avatar>
<div className="">
<div className="font-medium text-foreground">
Level {sortedLevels.length - levelIndex}: {capitalizeEachWord(level.name)}
</div>
</div>
Expand All @@ -106,7 +106,7 @@ export default function Leaderboard({
</>
))
) : (
<p key={`${level.id}-no-players`}>
<p key={`${level.id}-no-players`} className="py-4 text-foreground/50">
No player levelled up here yet. Who&prime;s gonna be the first?
</p>
)}
Expand Down
18 changes: 9 additions & 9 deletions app/[githubLogin]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ export default async function ProfilePage({ params }) {
<div>
<h3 className="mb-2 text-xl font-medium">Congrats! </h3>
{userEnrollments.map((item) => (
<div key={item.id}>
<div className="flex items-center space-x-3 rounded-lg border border-muted p-3">
<div className="rounded-md border border-gray-200 bg-gray-50 p-2 text-3xl">🎉</div>
<div>
<p className="font-medium">
{githubUserData?.name} enrolled to contribute to {item.name}
</p>
<p className="mt-0.5 text-xs">Let the games begin!</p>
</div>
<div
key={item.id}
className="mb-2 flex items-center space-x-3 rounded-lg border border-muted p-3">
<div className="rounded-md border border-gray-200 bg-gray-50 p-2 text-3xl">🎉</div>
<div>
<p className="font-medium">
{githubUserData?.name} enrolled to contribute to {item.name}
</p>
<p className="mt-0.5 text-xs">Let the games begin!</p>
</div>
</div>
))}
Expand Down
26 changes: 17 additions & 9 deletions components/ui/userPointsAndLevelCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ 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";
import ProgressBar from "./progressBar";

interface UserPointsAndLevelCardProps {
repositoryName: string;
repositoryId: string;
repositoryLogo?: string | null;
points: number;
rank: number | null;
Expand All @@ -22,6 +24,7 @@ interface UserPointsAndLevelCardProps {
const UserPointsAndLevelCard = ({
repositoryName,
repositoryLogo,
repositoryId,
points,
rank,
currentLevelOfUser,
Expand All @@ -35,6 +38,7 @@ const UserPointsAndLevelCard = ({
)}
<UserPointsCard
repositoryName={repositoryName}
repositoryId={repositoryId}
points={points}
rank={rank}
repositoryLogo={repositoryLogo}
Expand All @@ -49,7 +53,7 @@ export default UserPointsAndLevelCard;

const UserLevelCard = ({ currentLevelOfUser, assignableTags }) => {
return (
<div className=" flex h-full w-full flex-col items-center space-y-4 rounded-lg bg-popover p-4 font-semibold">
<div className=" flex h-full w-full flex-col items-center justify-center space-y-4 rounded-lg bg-popover p-4 font-semibold">
<Avatar className="h-40 w-40">
<AvatarImage src={currentLevelOfUser.iconUrl} alt="level icon" />
</Avatar>
Expand Down Expand Up @@ -78,6 +82,7 @@ const UserLevelCard = ({ currentLevelOfUser, assignableTags }) => {
const UserPointsCard = ({
repositoryName,
repositoryLogo,
repositoryId,
points,
rank,
currentLevelOfUser,
Expand All @@ -86,15 +91,18 @@ const UserPointsCard = ({
const { progressMadeInThisLevel } = calculateLevelProgress(points, currentLevelOfUser, nextLevelForUser);
return (
<div className="flex h-full w-full flex-col items-center justify-center space-y-4 rounded-lg bg-popover p-4 font-semibold">
<div className="flex items-center gap-3">
<div className="text-3xl">{capitalizeFirstLetter(repositoryName)}</div>
{repositoryLogo && (
<Image src={repositoryLogo} height={35} width={35} alt="repository-logo" className="rounded-lg" />
)}
</div>
<Link href={`/enroll/${repositoryId}/details`} className="hover:underline">
<div className="flex items-center gap-3">
<div className="text-lg">{capitalizeFirstLetter(repositoryName)}</div>
{repositoryLogo && (
<Image src={repositoryLogo} height={35} width={35} alt="repository-logo" className="rounded-lg" />
)}
</div>
</Link>
<p className="text-5xl font-bold lg:text-8xl">{points}</p>
<p className="text-lg font-semibold">{rank === null ? "No points, no rank 🤷" : `# Rank ${rank}`}</p>

<Link href={`/enroll/${repositoryId}/leaderboard`} className="hover:underline">
<p className="text-lg font-semibold">{rank === null ? "No points, no rank 🤷" : `# Rank ${rank}`}</p>
</Link>
{currentLevelOfUser && (
<div className=" flex w-11/12 flex-col space-y-3 pt-3">
<ProgressBar barColor="#18181B" progress={progressMadeInThisLevel} height={3} />
Expand Down
51 changes: 26 additions & 25 deletions components/ui/userProfileSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,37 @@ const UserProfileSummary: React.FC<UserProfileSummaryProps> = ({
return;
};
return (
<div className="flex justify-between border-b py-4">
<div className="flex w-fit items-center gap-4 sm:gap-12">
<div>#{index}</div>
<div>
<UserAvatar className="h-8 w-8" user={{ name: name, avatarUrl: avatarUrl }} />
<Link key={userGitHubId} href={`https://oss.gg/${userGitHubId}`} target="_blank">
<div className="group flex justify-between border-b py-4">
<div className="flex w-fit items-center gap-4 sm:gap-12">
<div>#{index}</div>
<div>
<UserAvatar className="h-8 w-8" user={{ name: name, avatarUrl: avatarUrl }} />
</div>

<div className="group-hover:underline">{name}</div>
</div>
<Link key={userGitHubId} href={`https://oss.gg/${userGitHubId}`} target="_blank">
<div className="hover:underline">{name}</div>
</Link>
</div>

<div className="flex w-auto items-center gap-4">
{showSettingButtons && (
<div className="flex gap-2">
<Button size={"sm"} variant={"destructive"} onClick={kickAndBlockHandler}>
Kick and block
</Button>
<Button size={"sm"} variant={"default"} onClick={kickAndBlockHandler}>
Mute
</Button>
<Button size={"sm"} variant={"default"} onClick={kickAndBlockHandler}>
Change Points
</Button>
<div className="flex w-auto items-center gap-4">
{showSettingButtons && (
<div className="flex gap-2">
<Button size={"sm"} variant={"destructive"} onClick={kickAndBlockHandler}>
Kick and block
</Button>
<Button size={"sm"} variant={"default"} onClick={kickAndBlockHandler}>
Mute
</Button>
<Button size={"sm"} variant={"default"} onClick={kickAndBlockHandler}>
Change Points
</Button>
</div>
)}
<div className=" w-[6rem] whitespace-nowrap text-justify font-[400] dark:text-white">
{points} points
</div>
)}
<div className=" w-[6rem] whitespace-nowrap text-justify font-[400] dark:text-white">
{points} points
</div>
</div>
</div>
</Link>
);
};
export default UserProfileSummary;
2 changes: 1 addition & 1 deletion lib/github/hooks/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 88b09b3

Please sign in to comment.