feat: player count

This commit is contained in:
TrèsAbhi committed 2024-06-30 20:34:22 -05:00
1 parent 1d112bb633
commit db83ac40b4
10 files changed
+49 -45

No files matched your search

@@ -1,5 +1,5 @@
import { Table } from '@radix-ui/themes';
import { memo, use } from 'react';
import { memo, use, useMemo } from 'react';
import { TankRowHeaderCell } from '../../../../components/TankRowHeaderCell';
import { averageDefinitions } from '../../../../core/blitzkit/averageDefinitions';
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
@@ -11,7 +11,11 @@ interface TankRowProps {
export const TankRow = memo<TankRowProps>(
({ tank }) => {
const awaitedAverageDefinitions = use(averageDefinitions);
const averages = awaitedAverageDefinitions[tank.id];
const averages = awaitedAverageDefinitions.averages[tank.id];
const numberFormat = useMemo(
() => Intl.NumberFormat(undefined, { notation: 'compact' }),
[],
);
return (
<Table.Row>
@@ -20,7 +24,7 @@ export const TankRow = memo<TankRowProps>(
{Math.round(averages.mu.wins * 100)}%
</Table.Cell>
<Table.Cell align="center">
{averages.samples.toLocaleString()}
{numberFormat.format(Math.round(averages.samples))}
</Table.Cell>
<Table.Cell align="center">
{Math.round(averages.mu.damage_dealt).toLocaleString()}
@@ -47,9 +51,6 @@ export const TankRow = memo<TankRowProps>(
<Table.Cell align="center">
{averages.mu.capture_points.toFixed(2)}
</Table.Cell>
<Table.Cell align="center">
{averages.mu.dropped_capture_points.toFixed(2)}
</Table.Cell>
</Table.Row>
);
},