Skip to content

Commit aa2d488

Browse files
committed
Made changes to leaderboard
1 parent 2fc2887 commit aa2d488

File tree

7 files changed

+189
-214
lines changed

7 files changed

+189
-214
lines changed

src/app/dashboard/cp-leaderboard.tsx

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,70 @@
1-
const LeaderboardPage = () => {
2-
return (
3-
<>
4-
CP leaderboard
5-
</>
6-
);
1+
"use client";
2+
import { useState } from "react";
3+
4+
import {Profile,ProfileBottom} from "@/components/LeaderBoardProfiles"
5+
import dynamic from 'next/dynamic';
6+
7+
const LeaderboardTable = dynamic(() => import("@/components/LeaderboardTable"), {
8+
ssr: false,
9+
});
10+
11+
export default function LeaderBoard() {
12+
const [alltimemode, setmode] = useState(false);
13+
return (
14+
<div className="w-full overflow-hidden gap-7 flex flex-col items-center bg-bgMainColor">
15+
<h1 className="mt-5 text-center text-white text-[3rem] sm:text-[2.5rem] md:text-[4.2rem] lg:text-[5rem] font-medium">
16+
Leaderboard
17+
</h1>
18+
{/* Alltime/Monthly Switch */}
19+
<div className="flex justify-evenly items-center rounded-xl bg-LeaderBoardCommon w-[50%]">
20+
<button
21+
className={`transition-colors duration-300 flex w-[50%] justify-center items-center rounded-md ${
22+
alltimemode ? "bg-LeaderBoardCommonHigh" : "bg-LeaderBoardCommon"}`}
23+
onClick={() => setmode(!alltimemode)}
24+
>
25+
<p className="text-lg font-semibold text-white mt-2 ml-2 mb-2">
26+
Month
27+
</p>
28+
</button>
29+
<button
30+
className={`transition-colors duration-300 flex w-[50%] justify-center items-center rounded-md ${
31+
alltimemode ? "bg-LeaderBoardCommon" : "bg-LeaderBoardCommonHigh"}`}
32+
onClick={() => setmode(!alltimemode)}
33+
>
34+
<p className="text-lg font-semibold text-white mt-2 mr-2 mb-2">
35+
All Time
36+
</p>
37+
</button>
38+
</div>
39+
{/* Top 3 Board */}
40+
<div className="flex gap-[1%] sm:h-[200px] lg:h-[500px] lg:scale-100 sm:scale-[.38] md:scale-[.57] origin-top">
41+
<Profile mt={8} rank="Silver" />
42+
<Profile rank="Gold" />
43+
<Profile mt={10} rank="Bronze" />
44+
</div>
45+
<div className="flex justify-center items-center z-10 md:mt-16 rounded-xl bg-LeaderBoardCommonHigh]">
46+
<p className="text-lg sm:text-[1.5vh] md:text-[.8rem] lg:text-xl font-semibold text-white z-10 m-2">
47+
You have been placed at X rank with XXXX points.
48+
</p>
49+
</div>
50+
51+
52+
{/*Table*/}
53+
<div className="w-full">
54+
<LeaderboardTable/>
55+
</div>
56+
57+
{/*Wall of Shame*/}
58+
<p className="mt-5 text-center text-white text-[3rem] sm:text-[2.5rem] md:text-[4.2rem] lg:text-[5rem] font-medium">
59+
Wall of Shame
60+
</p>
61+
<div className="w-full">
62+
<div className="flex flex-col md:scale-[.6] lg:scale-[1] md:flex-row justify-evenly items-center gap-4 sm:gap-6 md:gap-8 w-full">
63+
<ProfileBottom />
64+
<ProfileBottom />
65+
<ProfileBottom />
66+
</div>
67+
</div>
68+
</div>
69+
);
770
}
8-
export default LeaderboardPage;

src/app/dashboard/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { SelectedButtonProvider } from '@/context/SelectedButtonContext';
77
const DashboardLayout = ({ children }: PropsWithChildren) => {
88
return (
99
<SelectedButtonProvider>
10-
<div className="flex h-screen w-screen overflow-hidden ">
11-
<div className='w-2/12'>
10+
<div className="flex min-h-screen w-full ">
11+
<div className='w-2/12 h-screen top-0 sticky'>
1212
<Sidebar />
1313
</div>
1414
{/* Content area will take the remaining space */}

src/app/leaderboard/layout.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/app/leaderboard/page.tsx

Lines changed: 0 additions & 182 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import Image from "next/image";
2+
import { Medal, Trophy } from "lucide-react";
3+
4+
function ProfileBottom({ imgpath = "/placeholder.webp", name = "Placeholder" }) {
5+
return (
6+
<div className="flex flex-col items-center w-full sm:w-auto scale-100 sm:scale-75">
7+
<div className="flex flex-col items-center justify-center relative">
8+
<Image
9+
src={imgpath}
10+
alt="profile"
11+
width={200}
12+
height={200}
13+
className="rounded-full z-10 mb-4"
14+
/>
15+
<p className="text-5xl z-10 text-white text-center">{name}</p>
16+
</div>
17+
<p className="text-base sm:text-2xl md:text-xl mt-3 text-center text-white gap-2">
18+
Points
19+
</p>
20+
</div>
21+
);
22+
}
23+
24+
function Profile({ mt = 0, rank = "" }) {
25+
const imgpath = "/placeholder.webp";
26+
const name = "Placeholder";
27+
let sticker = <Medal className="w-5 h-5" />;
28+
if (rank == "Gold") {
29+
sticker = <Trophy className="w-5 h-5" />;
30+
}
31+
return (
32+
<div className={`mt-${mt} scale-100 sm:scale-75`}>
33+
<div className="flex flex-col items-center justify-center relative">
34+
<div className="absolute w-[200px] h-[200px] rounded-md border-[20px] border-yellow-400 mb-4 blur-2xl"></div>
35+
<Image
36+
src={imgpath}
37+
alt="profile"
38+
width={200}
39+
height={200}
40+
className="rounded-md z-10 mb-4"
41+
/>
42+
<p className="text-5xl z-10 text-white text-center">{name}</p>
43+
</div>
44+
<div
45+
className="w-[250px] sm:w-[300px] h-[250px] sm:h-[300px] bg-cover bg-center flex flex-col items-center text-white"
46+
style={{ backgroundImage: "url('/leaderboard.svg')" }}
47+
>
48+
<p className="text-4xl font-semibold mt-8 text-white">{rank}</p>
49+
<hr className="border-[1.5px] border-yellow-400 w-[80%]" />
50+
<p className="text-base sm:text-2xl md:text-xl w-1/3 mt-3 text-center text-white flex items-center justify-center gap-2">
51+
{sticker}Points
52+
</p>
53+
</div>
54+
</div>
55+
);
56+
}
57+
58+
export { ProfileBottom, Profile };

0 commit comments

Comments
 (0)