diff --git a/src/app/tools/player-stats/[id]/page.css.ts b/src/app/tools/player-stats/[id]/page.css.ts new file mode 100644 index 000000000..d31a326c9 --- /dev/null +++ b/src/app/tools/player-stats/[id]/page.css.ts @@ -0,0 +1,11 @@ +import { style } from '@vanilla-extract/css'; + +export const bkniIndicator = style({ + scale: 0.8, + + '@media': { + 'screen and (min-width: 1024px)': { + scale: 1, + }, + }, +}); diff --git a/src/app/tools/player-stats/[id]/page.tsx b/src/app/tools/player-stats/[id]/page.tsx index f504bed37..e9cf1fc02 100644 --- a/src/app/tools/player-stats/[id]/page.tsx +++ b/src/app/tools/player-stats/[id]/page.tsx @@ -22,19 +22,30 @@ import { parseBkni } from '../../../../core/blitzkit/parseBkni'; import { useAwait } from '../../../../hooks/useAwait'; import strings from '../../../../lang/en-US.json'; import { FlippedTrigger } from './components/FlippedTrigger'; +import * as styles from './page.css'; export default function Page({ params }: { params: { id: string } }) { const id = parseInt(params.id); const region = idToRegion(id); const accountInfo = useAwait(getAccountInfo(region, id)); const clanAccountInfo = useAwait(getClanAccountInfo(region, id, ['clan'])); - const bkni = ((Math.round(Date.now() / 1000 / 60) / 100) % 2) - 1; + // const bkni = ((Math.round(Date.now() / 1000 / 60) / 100) % 2) - 1; + const bkni = 2 * Math.random() - 1; const [period, setPeriod] = useState<'custom' | number>(30); const { bkniColor } = parseBkni(bkni); const isTracking = false; const [customFrom, setCustomFrom] = useState( new Date(Date.now() - 29 * 24 * 60 * 60 * 1000), ); + const stats = [ + ['Winrate', '70%'], + ['Damage', '3,203'], + ['Damage ratio', '2.45'], + ['Tier', '9.83'], + ['Survival', '70%'], + ['Accuracy', '91%'], + ['Kills', '1.54'], + ]; const [customTo, setCustomTo] = useState(new Date()); const [fromSelectorOpen, setFromSelectorOpen] = useState(false); const [toSelectorOpen, setToSelectorOpen] = useState(false); @@ -46,8 +57,13 @@ export default function Page({ params }: { params: { id: string } }) { initial: '6', md: '8', }} + pt={{ + initial: '9', + md: '8', + }} size={1024} noFlex1 + position="relative" color={bkniColor} containerProps={{ style: { @@ -55,48 +71,12 @@ export default function Page({ params }: { params: { id: string } }) { }, }} > - - - - {accountInfo.nickname} - - - - {clanAccountInfo?.clan && `[${clanAccountInfo.clan.tag}] • `} - {strings.common.regions.short[region]} - - - - - - - - { @@ -111,6 +91,39 @@ export default function Page({ params }: { params: { id: string } }) { + + + {accountInfo.nickname} + + + {clanAccountInfo?.clan && `[${clanAccountInfo.clan.tag}] • `} + { + (clanAccountInfo?.clan + ? strings.common.regions.short + : strings.common.regions.normal)[region] + } + + + + + + + + {period === 'custom' && ( From{' '} @@ -165,21 +178,35 @@ export default function Page({ params }: { params: { id: string } }) { )} + + + 72% + Winrate + + + + {stats.map((stat) => ( + + {stat[1]} + + {stat[0]} + + + ))} + - {!isTracking && ( - - - - - - - We haven't tracked long enough to provide statistics. Please check - back after a few days. - - - - )} + + + + + + + We haven't tracked long enough to provide statistics. Please check + back after a few days. + + + {isTracking && } diff --git a/src/components/BkniIndicator.tsx b/src/components/BkniIndicator.tsx index 6c324b3a4..26f470e26 100644 --- a/src/components/BkniIndicator.tsx +++ b/src/components/BkniIndicator.tsx @@ -1,5 +1,12 @@ import { TimerIcon } from '@radix-ui/react-icons'; -import { Button, Flex, Heading, Popover, Text } from '@radix-ui/themes'; +import { + Button, + Flex, + FlexProps, + Heading, + Popover, + Text, +} from '@radix-ui/themes'; import { parseBkni } from '../core/blitzkit/parseBkni'; import { BKNI_COLORS, @@ -7,16 +14,16 @@ import { } from '../core/statistics/getBkniPercentile'; import strings from '../lang/en-US.json'; -interface BkniIndicatorProps { +type BkniIndicatorProps = FlexProps & { bkni: number; -} +}; -export function BkniIndicator({ bkni }: BkniIndicatorProps) { +export function BkniIndicator({ bkni, ...props }: BkniIndicatorProps) { const { bkniColor, bkniFraction, bkniMetric, bkniPercentile } = parseBkni(bkni); return ( - +