diff --git a/src/app/tools/player-stats/[id]/page.tsx b/src/app/tools/player-stats/[id]/page.tsx index 6a4478676..a2e4f2d4b 100644 --- a/src/app/tools/player-stats/[id]/page.tsx +++ b/src/app/tools/player-stats/[id]/page.tsx @@ -1,9 +1,14 @@ -import { Flex, Heading, Text } from '@radix-ui/themes'; +import { TimerIcon } from '@radix-ui/react-icons'; +import { Button, Flex, Heading, Popover, Text } from '@radix-ui/themes'; import PageWrapper from '../../../../components/PageWrapper'; import { getAccountInfo } from '../../../../core/blitz/getAccountInfo'; import { getClanAccountInfo } from '../../../../core/blitz/getClanAccountInfo'; import { idToRegion } from '../../../../core/blitz/idToRegion'; -import getBkniPercentile from '../../../../core/statistics/getBkniPercentile'; +import getBkniPercentile, { + BKNI_COLORS, + BKNI_PERCENTILES, + BkniPercentile, +} from '../../../../core/statistics/getBkniPercentile'; import strings from '../../../../lang/en-US.json'; export default async function Page({ params }: { params: { id: string } }) { @@ -12,12 +17,15 @@ export default async function Page({ params }: { params: { id: string } }) { const accountInfo = await getAccountInfo(region, id); const clanAccountInfo = await getClanAccountInfo(region, id, ['clan']); const bkniRaw = Math.random() * 2 - 1; - const bkniFraction = Math.random(); + const bkniFraction = (bkniRaw + 1) / 2; const bkniMetric = Math.round(bkniFraction * 200); const bkniPercentile = getBkniPercentile(bkniMetric); + const lastBkniPercentile = Math.max(0, bkniPercentile - 1) as BkniPercentile; + const bkniColor = BKNI_COLORS[bkniPercentile]; + const lastBkniColor = BKNI_COLORS[lastBkniPercentile]; return ( - + {accountInfo.nickname} {clanAccountInfo?.clan && ( @@ -33,6 +41,17 @@ export default async function Page({ params }: { params: { id: string } }) { transform: 'scaleX(-1)', }} > + + + + + + + + - + {bkniMetric} - - {strings.common.bkni_percentile[bkniPercentile]} - + + + + + + + + + + + BlitzKit Neutrality Index + + + A next generation performance metric + + + + {BKNI_PERCENTILES.map(({ percentile, min }, index) => ( + + ))} + + + diff --git a/src/components/Navbar/index.css.ts b/src/components/Navbar/index.css.ts index 9c16c9434..4820b320e 100644 --- a/src/components/Navbar/index.css.ts +++ b/src/components/Navbar/index.css.ts @@ -1,8 +1,10 @@ import { style, styleVariants } from '@vanilla-extract/css'; +const MAX_EXPANDED_TOOLS = 680; + export const hamburgerButton = style({ '@media': { - 'screen and (min-width: 592px)': { + [`screen and (min-width: ${MAX_EXPANDED_TOOLS}px)`]: { display: 'none', }, }, @@ -47,7 +49,7 @@ export const toolCard = style({ export const toolTexts = style({ '@media': { - 'screen and (max-width: 592px)': { + [`screen and (max-width: ${MAX_EXPANDED_TOOLS}px)`]: { display: 'none', }, }, diff --git a/src/core/statistics/getBkniPercentile.ts b/src/core/statistics/getBkniPercentile.ts index 1989b2606..31584b723 100644 --- a/src/core/statistics/getBkniPercentile.ts +++ b/src/core/statistics/getBkniPercentile.ts @@ -26,7 +26,7 @@ export enum BkniPercentile { SuperUnicum, } -const BKNI_PERCENTILES = [ +export const BKNI_PERCENTILES = [ { min: 0, percentile: BkniPercentile.SuperMalum }, { min: 10, percentile: BkniPercentile.Malum }, { min: 20, percentile: BkniPercentile.VeryBad }, @@ -40,6 +40,20 @@ const BKNI_PERCENTILES = [ { min: 190, percentile: BkniPercentile.SuperUnicum }, ]; +export const BKNI_COLORS = { + [BkniPercentile.SuperMalum]: 'tomato', + [BkniPercentile.Malum]: 'orange', + [BkniPercentile.VeryBad]: 'amber', + [BkniPercentile.Bad]: 'yellow', + [BkniPercentile.BelowAverage]: 'lime', + [BkniPercentile.Average]: 'green', + [BkniPercentile.AboveAverage]: 'teal', + [BkniPercentile.Good]: 'cyan', + [BkniPercentile.VeryGood]: 'pink', + [BkniPercentile.Unicum]: 'plum', + [BkniPercentile.SuperUnicum]: 'purple', +} as const; + export default function getBkniPercentile(wn8: number) { const lastIndex = BKNI_PERCENTILES.findLastIndex(({ min }) => min <= wn8); return BKNI_PERCENTILES[lastIndex === -1 ? 0 : lastIndex].percentile;