mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-11 12:59:39 +00:00
Add Ranked 1v1 Leaderboard (#3008)
If this PR fixes an issue, link it below. If not, delete these two lines. Resolves #(issue number) @wraith4081 's pr updates the stats modal to show both 1v1 and clan stats - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced regression is found: w.o.n --------- Co-authored-by: Wraith <54374743+wraith4081@users.noreply.github.com> Co-authored-by: iamlewis <lewismmmm@gmail.com>
This commit is contained in:
@@ -133,3 +133,49 @@ export const ClanLeaderboardResponseSchema = z.object({
|
||||
export type ClanLeaderboardResponse = z.infer<
|
||||
typeof ClanLeaderboardResponseSchema
|
||||
>;
|
||||
|
||||
export const PlayerLeaderboardEntrySchema = z.object({
|
||||
rank: z.number(),
|
||||
playerId: z.string(),
|
||||
username: z.string(),
|
||||
clanTag: z.string().optional(),
|
||||
flag: z.string().optional(),
|
||||
elo: z.number(),
|
||||
games: z.number(),
|
||||
wins: z.number(),
|
||||
losses: z.number(),
|
||||
winRate: z.number(),
|
||||
});
|
||||
export type PlayerLeaderboardEntry = z.infer<
|
||||
typeof PlayerLeaderboardEntrySchema
|
||||
>;
|
||||
|
||||
export const PlayerLeaderboardResponseSchema = z.object({
|
||||
players: PlayerLeaderboardEntrySchema.array(),
|
||||
});
|
||||
export type PlayerLeaderboardResponse = z.infer<
|
||||
typeof PlayerLeaderboardResponseSchema
|
||||
>;
|
||||
|
||||
export const RankedLeaderboardEntrySchema = z.object({
|
||||
rank: z.number(),
|
||||
elo: z.number(),
|
||||
peakElo: z.number().nullable(),
|
||||
wins: z.number(),
|
||||
losses: z.number(),
|
||||
total: z.number(),
|
||||
public_id: z.string(),
|
||||
user: DiscordUserSchema.nullable().optional(),
|
||||
username: z.string(),
|
||||
clanTag: z.string().nullable().optional(),
|
||||
});
|
||||
export type RankedLeaderboardEntry = z.infer<
|
||||
typeof RankedLeaderboardEntrySchema
|
||||
>;
|
||||
|
||||
export const RankedLeaderboardResponseSchema = z.object({
|
||||
"1v1": RankedLeaderboardEntrySchema.array(),
|
||||
});
|
||||
export type RankedLeaderboardResponse = z.infer<
|
||||
typeof RankedLeaderboardResponseSchema
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user