diff --git a/src/constants/applications.ts b/src/constants/applications.ts index 566463d6..3f0b1c6a 100644 --- a/src/constants/applications.ts +++ b/src/constants/applications.ts @@ -16,4 +16,4 @@ export enum NAVBAR_MODE { DEFAULT = "default", } -export const LEADERBOARD_POINTS_API = 'https://api.overlay.market/point-system/points/leaderboard' +export const LEADERBOARD_POINTS_API = 'https://api.overlay.market/leaderboard-pnl/points/leaderboard' diff --git a/src/pages/Leaderboard/LeaderboardTable.tsx b/src/pages/Leaderboard/LeaderboardTable.tsx index c93550cf..d9dc921d 100644 --- a/src/pages/Leaderboard/LeaderboardTable.tsx +++ b/src/pages/Leaderboard/LeaderboardTable.tsx @@ -27,6 +27,7 @@ const LeaderboardTable: React.FC = ({ }) => { const { address: account } = useAccount(); const isMobile = useMediaQuery("(max-width: 767px)"); + const isMultipleSessions = false; return ( @@ -39,12 +40,12 @@ const LeaderboardTable: React.FC = ({ > Leaderboard Rankings - {!isMobile && ( + {!isMobile && isMultipleSessions && ( Points-Previous Week )} - Total Points + Total PnL @@ -73,13 +74,13 @@ const LeaderboardTable: React.FC = ({ - {!isMobile && ( + {!isMobile && isMultipleSessions && ( {currentUserData?.previousWeekPoints ?? "0"} )} - {currentUserData?.totalPoints ?? "0"} + {currentUserData?.totalPoints ? (+currentUserData?.totalPoints).toFixed(2) + "%" : "0"} @@ -125,12 +126,12 @@ const LeaderboardTable: React.FC = ({ {shortenAddress(rank._id)} - {!isMobile && ( + {!isMobile && isMultipleSessions && ( {rank.previousWeekPoints} )} - {rank.totalPoints} + {rank.totalPoints.toFixed(2) + "%"} ))} diff --git a/src/pages/Leaderboard/PointsUpdateSection.tsx b/src/pages/Leaderboard/PointsUpdateSection.tsx index a4b259a4..325ef2fa 100644 --- a/src/pages/Leaderboard/PointsUpdateSection.tsx +++ b/src/pages/Leaderboard/PointsUpdateSection.tsx @@ -33,7 +33,7 @@ const PointsUpdateSection: React.FC = ({ - Points Updated At + Updated At {pointsUpdatedAt ? ( diff --git a/src/pages/Leaderboard/UserPointsSection.tsx b/src/pages/Leaderboard/UserPointsSection.tsx index d9069888..d35bea05 100644 --- a/src/pages/Leaderboard/UserPointsSection.tsx +++ b/src/pages/Leaderboard/UserPointsSection.tsx @@ -35,7 +35,7 @@ const UserPointsSection: React.FC = ({ color: isMobile ? theme.color.grey1 : theme.color.grey2, }} > - You have {isLoading ? : `${userPoints ?? "0"} points`} + You have {isLoading ? : `${userPoints ? userPoints.toFixed(2) + "%" : "0"} PnL`} ) : ( @@ -57,18 +57,18 @@ const UserPointsSection: React.FC = ({ color: isMobile ? theme.color.grey1 : theme.color.grey2, }} > - to see points + to see your place on the leaderboard )} - Points are calculated on Thursdays + Leaderboard is updated every minute! - + {false && Learn more - + } ); diff --git a/src/pages/Leaderboard/index.tsx b/src/pages/Leaderboard/index.tsx index 850c4ae5..c8cf79b2 100644 --- a/src/pages/Leaderboard/index.tsx +++ b/src/pages/Leaderboard/index.tsx @@ -11,6 +11,7 @@ import { ExtendedUserData, LeaderboardPointsData, PrevWeekDetails, + SessionDetails, UserData, } from "./types"; import { Address } from "viem"; @@ -21,7 +22,7 @@ import { GradientText } from "./user-points-section-styles"; const INITIAL_NUMBER_OF_ROWS = 10; const ROWS_PER_LOAD = 20; -const comingSoon = true; +const comingSoon = false; const Leaderboard: React.FC = () => { const { address: account } = useAccount(); @@ -78,6 +79,12 @@ const Leaderboard: React.FC = () => { } }, [pointsData]); + const sessionDetails = useMemo(() => { + if (pointsData) { + return pointsData.sessionDetails; + } + }, [pointsData]); + const initialUserData = useMemo(() => { if (pointsData) { return pointsData.user; @@ -252,7 +259,7 @@ const Leaderboard: React.FC = () => { userPoints={currentUserData?.totalPoints} isLoading={fetchingPointsData} /> - + diff --git a/src/pages/Leaderboard/types.ts b/src/pages/Leaderboard/types.ts index 78964aab..d440a7b9 100644 --- a/src/pages/Leaderboard/types.ts +++ b/src/pages/Leaderboard/types.ts @@ -3,6 +3,12 @@ export interface PrevWeekDetails { sessionStart: string sessionEnd: string } + +export interface SessionDetails { + sessionStart: string + sessionEnd: string + sessionLastUpdated: string +} export interface UserData { _id: string totalPoints: number @@ -18,5 +24,6 @@ export interface LeaderboardPointsData { previousWeekDetails: PrevWeekDetails totalUsers: number leaderboardTable: [UserData] + sessionDetails: SessionDetails user?: UserData } \ No newline at end of file