From 57527115d4977715e66a354bbeb4cfac9061b1a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Tue, 7 Nov 2023 11:02:11 -0600
Subject: [PATCH] feat: jump to league
---
src/app/tools/ratings/page.tsx | 47 ++++++++++++++++++++++------------
src/commands/ratings.tsx | 9 +------
src/constants/leagues.ts | 7 +++++
3 files changed, 39 insertions(+), 24 deletions(-)
create mode 100644 src/constants/leagues.ts
diff --git a/src/app/tools/ratings/page.tsx b/src/app/tools/ratings/page.tsx
index 3546b2227..de8a16854 100644
--- a/src/app/tools/ratings/page.tsx
+++ b/src/app/tools/ratings/page.tsx
@@ -5,14 +5,7 @@ import {
CaretRightIcon,
MagnifyingGlassIcon,
} from '@radix-ui/react-icons';
-import {
- Button,
- Dialog,
- Flex,
- Popover,
- Select,
- TextField,
-} from '@radix-ui/themes';
+import { Button, Dialog, Flex, Select, TextField } from '@radix-ui/themes';
import { produce } from 'immer';
import { debounce, range } from 'lodash';
import { ChangeEvent, useEffect, useRef, useState } from 'react';
@@ -20,6 +13,7 @@ import useSWR from 'swr';
import { create } from 'zustand';
import * as Leaderboard from '../../../components/Leaderboard';
import PageWrapper from '../../../components/PageWrapper';
+import { LEAGUES } from '../../../constants/leagues';
import { FIRST_ARCHIVED_RATINGS_SEASON } from '../../../constants/ratings';
import { REGIONS, REGION_NAMES, Region } from '../../../constants/regions';
import { WARGAMING_APPLICATION_ID } from '../../../constants/wargamingApplicationID';
@@ -318,12 +312,12 @@ export default function Page() {
-
-
+
+
-
+
-
+
-
+
-
+
+
+
+
-
-
+
+
diff --git a/src/commands/ratings.tsx b/src/commands/ratings.tsx
index fc06f2322..7abe31c82 100644
--- a/src/commands/ratings.tsx
+++ b/src/commands/ratings.tsx
@@ -9,6 +9,7 @@ import { BlitzkriegRatingsLeaderboard } from '../../scripts/buildRatingsLeaderbo
import * as Leaderboard from '../components/Leaderboard';
import TitleBar from '../components/TitleBar';
import Wrapper from '../components/Wrapper';
+import { LEAGUES } from '../constants/leagues';
import { FIRST_ARCHIVED_RATINGS_SEASON } from '../constants/ratings';
import { REGION_NAMES_SHORT, Region } from '../constants/regions';
import { getAccountInfo } from '../core/blitz/getAccountInfo';
@@ -114,14 +115,6 @@ export interface RatingsNeighbors {
neighbors: RatingsPlayer[];
}
-const LEAGUES = [
- { name: 'Diamond', minScore: 5000 },
- { name: 'Platinum', minScore: 4000 },
- { name: 'Gold', minScore: 3000 },
- { name: 'Silver', minScore: 2000 },
- { name: 'Bronze', minScore: 0 },
-];
-
function addSubcommands(
option: SlashCommandSubcommandGroupBuilder,
addOptions = (option: SlashCommandSubcommandBuilder) => option,
diff --git a/src/constants/leagues.ts b/src/constants/leagues.ts
new file mode 100644
index 000000000..082886490
--- /dev/null
+++ b/src/constants/leagues.ts
@@ -0,0 +1,7 @@
+export const LEAGUES = [
+ { name: 'Diamond', minScore: 5000 },
+ { name: 'Platinum', minScore: 4000 },
+ { name: 'Gold', minScore: 3000 },
+ { name: 'Silver', minScore: 2000 },
+ { name: 'Bronze', minScore: 0 },
+];