2024-06-30 19:34:55 -05:00
|
|
|
import { Table } from '@radix-ui/themes';
|
2024-07-01 19:41:13 -05:00
|
|
|
import { memo, use } from 'react';
|
2024-06-30 19:34:55 -05:00
|
|
|
import { TankRowHeaderCell } from '../../../../components/TankRowHeaderCell';
|
|
|
|
|
import { averageDefinitions } from '../../../../core/blitzkit/averageDefinitions';
|
2024-07-01 19:41:13 -05:00
|
|
|
import { discoveredIdsDefinitions } from '../../../../core/blitzkit/discoveredIdDefinitions';
|
2024-06-30 19:34:55 -05:00
|
|
|
import { TankDefinition } from '../../../../core/blitzkit/tankDefinitions';
|
|
|
|
|
|
|
|
|
|
interface TankRowProps {
|
|
|
|
|
tank: TankDefinition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const TankRow = memo<TankRowProps>(
|
|
|
|
|
({ tank }) => {
|
2024-07-01 19:41:13 -05:00
|
|
|
const awaitedDiscoveredIdsDefinitions = use(discoveredIdsDefinitions);
|
2024-06-30 19:34:55 -05:00
|
|
|
const awaitedAverageDefinitions = use(averageDefinitions);
|
2024-06-30 20:34:22 -05:00
|
|
|
const averages = awaitedAverageDefinitions.averages[tank.id];
|
2024-07-01 19:41:13 -05:00
|
|
|
const numberFormat = Intl.NumberFormat(undefined, { notation: 'compact' });
|
|
|
|
|
const ratio =
|
|
|
|
|
awaitedDiscoveredIdsDefinitions.count /
|
|
|
|
|
awaitedAverageDefinitions.scanned_players;
|
2024-06-30 19:34:55 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Table.Row>
|
|
|
|
|
<TankRowHeaderCell tank={tank} />
|
2024-07-02 18:42:23 -05:00
|
|
|
|
2024-06-30 19:34:55 -05:00
|
|
|
<Table.Cell align="center">
|
2024-07-02 18:58:11 -05:00
|
|
|
{((averages.mu.wins / averages.mu.battles) * 100).toFixed(1)}%
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{numberFormat.format(Math.round(ratio * averages.samples))}
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
2024-07-01 20:18:09 -05:00
|
|
|
<Table.Cell align="center">
|
|
|
|
|
{numberFormat.format(
|
|
|
|
|
Math.round(ratio * averages.mu.battles * averages.samples),
|
|
|
|
|
)}
|
|
|
|
|
</Table.Cell>
|
2024-06-30 19:34:55 -05:00
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{Math.round(
|
|
|
|
|
averages.mu.damage_dealt / averages.mu.battles,
|
|
|
|
|
).toLocaleString()}
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{Math.round(
|
|
|
|
|
(averages.mu.survived_battles / averages.mu.battles) * 100,
|
|
|
|
|
)}
|
|
|
|
|
%
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{Math.round(averages.mu.xp / averages.mu.battles).toLocaleString()}
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{(averages.mu.frags / averages.mu.battles).toFixed(2)}
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 19:41:13 -05:00
|
|
|
{(averages.mu.spotted / averages.mu.battles).toFixed(2)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 20:18:09 -05:00
|
|
|
{Math.round((averages.mu.hits / averages.mu.shots) * 100)}%
|
2024-07-01 19:41:13 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
|
|
|
|
{(averages.mu.shots / averages.mu.battles).toFixed(1)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
|
|
|
|
{(averages.mu.hits / averages.mu.battles).toFixed(1)}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
2024-07-01 20:18:09 -05:00
|
|
|
{(averages.mu.damage_dealt / averages.mu.damage_received).toFixed(2)}
|
2024-07-01 19:41:13 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
|
|
|
|
{Math.round(
|
|
|
|
|
averages.mu.damage_received / averages.mu.battles,
|
|
|
|
|
).toLocaleString()}
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell align="center">
|
|
|
|
|
{(averages.mu.capture_points / averages.mu.battles).toFixed(2)}
|
2024-06-30 19:34:55 -05:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
(prev, next) => prev.tank.id === next.tank.id,
|
|
|
|
|
);
|