feat: row icons

This commit is contained in:
TrèsAbhi committed 2024-07-02 18:42:23 -05:00
1 parent 366a5111b7
commit 3deaa1e9bd
4 files changed
+23 -15

No files matched your search

@@ -25,9 +25,6 @@ export function Info() {
Career stats based on {numberFormat.format(Math.round(samples))}{' '} Career stats based on {numberFormat.format(Math.round(samples))}{' '}
players with at least 5K career battles and 1 battle in the past 30 players with at least 5K career battles and 1 battle in the past 30
days; updated daily. days; updated daily.
<br />
May differ from BlitzStars because BlitzKit includes{' '}
{Math.round(samples / 1e4)}x more players.
</Callout.Text> </Callout.Text>
</Callout.Root> </Callout.Root>
</Flex> </Flex>
@@ -22,6 +22,7 @@ export const TankRow = memo<TankRowProps>(
return ( return (
<Table.Row> <Table.Row>
<TankRowHeaderCell tank={tank} /> <TankRowHeaderCell tank={tank} />
<Table.Cell align="center"> <Table.Cell align="center">
{Math.round((averages.mu.wins / averages.mu.battles) * 100)}% {Math.round((averages.mu.wins / averages.mu.battles) * 100)}%
</Table.Cell> </Table.Cell>
+21 -11
View File
@@ -1,14 +1,17 @@
import { Table } from '@radix-ui/themes'; import { IconButton, Table } from '@radix-ui/themes';
import { TankDefinition } from '../core/blitzkit/tankDefinitions'; import { TankDefinition } from '../core/blitzkit/tankDefinitions';
import { tankIcon } from '../core/blitzkit/tankIcon'; import { tankIcon } from '../core/blitzkit/tankIcon';
import { ExperimentIcon } from './ExperimentIcon'; import { classIcons } from './ClassIcon';
import { Link } from './Link'; import { Link } from './Link';
import { ScienceIcon } from './ScienceIcon';
interface TankRowHeaderCellProps { interface TankRowHeaderCellProps {
tank: TankDefinition; tank: TankDefinition;
} }
export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) { export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
const Icon = classIcons[tank.class];
return ( return (
<Table.RowHeaderCell style={{ display: 'flex' }}> <Table.RowHeaderCell style={{ display: 'flex' }}>
<Link href={`/tools/tankopedia/${tank.id}`} tabIndex={-1}> <Link href={`/tools/tankopedia/${tank.id}`} tabIndex={-1}>
@@ -26,8 +29,14 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
</Link> </Link>
<Link <Link
color="gray" color={
highContrast tank.treeType === 'collector'
? 'blue'
: tank.treeType === 'premium'
? 'amber'
: 'gray'
}
highContrast={tank.treeType === 'researchable'}
underline="hover" underline="hover"
wrap="nowrap" wrap="nowrap"
href={`/tools/tankopedia/${tank.id}`} href={`/tools/tankopedia/${tank.id}`}
@@ -36,16 +45,17 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: 'var(--space-1)', gap: 'var(--space-1)',
width: 128,
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
}} }}
> >
{tank.testing && ( <Icon width="1em" height="1em" />
<ExperimentIcon style={{ width: '1em', height: '1em' }} />
)}
{tank.name} {tank.name}
{tank.testing && (
<IconButton size="1" ml="1">
<ScienceIcon style={{ width: '1em', height: '1em' }} />
</IconButton>
)}
</Link> </Link>
</Table.RowHeaderCell> </Table.RowHeaderCell>
); );
+1 -1
View File
@@ -30,7 +30,7 @@ export interface TankPerformanceSort {
} }
export const useTankPerformanceSort = create<TankPerformanceSort>()(() => ({ export const useTankPerformanceSort = create<TankPerformanceSort>()(() => ({
type: 'battles', type: 'winrate',
direction: -1, direction: -1,
})); }));