2024-06-19 13:58:37 -05:00
|
|
|
import {
|
|
|
|
|
Button,
|
|
|
|
|
Flex,
|
|
|
|
|
Grid,
|
|
|
|
|
Heading,
|
|
|
|
|
IconButton,
|
|
|
|
|
Separator,
|
|
|
|
|
Text,
|
|
|
|
|
} from '@radix-ui/themes';
|
|
|
|
|
import { range, times } from 'lodash';
|
2024-06-18 14:28:20 -05:00
|
|
|
import { use } from 'react';
|
|
|
|
|
import { classIcons } from '../../../components/ClassIcon';
|
2024-06-20 13:31:42 -05:00
|
|
|
import { ExperimentIcon } from '../../../components/ExperimentIcon';
|
2024-06-18 14:28:20 -05:00
|
|
|
import { Link } from '../../../components/Link';
|
2023-11-30 12:21:20 -06:00
|
|
|
import PageWrapper from '../../../components/PageWrapper';
|
2024-06-20 13:20:03 -05:00
|
|
|
import { ResearchedIcon } from '../../../components/ResearchedIcon';
|
2024-06-20 13:31:42 -05:00
|
|
|
import { ScienceIcon } from '../../../components/ScienceIcon';
|
|
|
|
|
import { ScienceOffIcon } from '../../../components/ScienceOffIcon';
|
2024-06-18 14:28:20 -05:00
|
|
|
import { TANK_CLASSES } from '../../../components/Tanks/components/Item/constants';
|
|
|
|
|
import { asset } from '../../../core/blitzkit/asset';
|
2024-06-19 20:53:59 -05:00
|
|
|
import { gameDefinitions } from '../../../core/blitzkit/gameDefinitions';
|
2024-06-18 14:28:20 -05:00
|
|
|
import {
|
|
|
|
|
Tier,
|
|
|
|
|
tanksDefinitionsArray,
|
|
|
|
|
} from '../../../core/blitzkit/tankDefinitions';
|
|
|
|
|
import { TIER_ROMAN_NUMERALS } from '../../../core/blitzkit/tankDefinitions/constants';
|
|
|
|
|
import { tankIcon } from '../../../core/blitzkit/tankIcon';
|
|
|
|
|
import { treeTypeOrder } from './components/TankSearch/constants';
|
2023-11-30 12:21:20 -06:00
|
|
|
|
2023-11-30 18:00:48 -06:00
|
|
|
export default function Page() {
|
2024-06-18 14:28:20 -05:00
|
|
|
const awaitedTanksDefinitionsArray = use(tanksDefinitionsArray);
|
2024-06-19 20:53:59 -05:00
|
|
|
const awaitedGameDefinitions = use(gameDefinitions);
|
2023-12-03 19:45:43 -06:00
|
|
|
|
2023-11-30 12:21:20 -06:00
|
|
|
return (
|
2024-06-19 13:58:37 -05:00
|
|
|
<PageWrapper color="purple" size={1028 + 256}>
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
gap="8"
|
|
|
|
|
direction={{
|
|
|
|
|
initial: 'column',
|
|
|
|
|
sm: 'row',
|
|
|
|
|
}}
|
|
|
|
|
pt={{
|
|
|
|
|
initial: '0',
|
|
|
|
|
sm: '6',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Flex
|
|
|
|
|
direction={{
|
|
|
|
|
initial: 'row',
|
|
|
|
|
sm: 'column',
|
|
|
|
|
}}
|
2024-06-20 13:31:42 -05:00
|
|
|
gap="2"
|
|
|
|
|
align={{
|
|
|
|
|
initial: 'start',
|
|
|
|
|
sm: 'start',
|
|
|
|
|
}}
|
|
|
|
|
justify={{
|
|
|
|
|
initial: 'center',
|
|
|
|
|
sm: 'start',
|
|
|
|
|
}}
|
2024-06-20 13:20:03 -05:00
|
|
|
pt={{
|
|
|
|
|
initial: '0',
|
|
|
|
|
sm: '8',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 13:58:37 -05:00
|
|
|
<Flex
|
2024-06-20 13:20:03 -05:00
|
|
|
direction={{
|
|
|
|
|
initial: 'row',
|
|
|
|
|
sm: 'column',
|
|
|
|
|
}}
|
2024-06-19 13:58:37 -05:00
|
|
|
overflow="hidden"
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-4)',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 13:58:37 -05:00
|
|
|
{times(5, (index) => {
|
|
|
|
|
const tier = (index + 1) as Tier;
|
2024-04-19 09:26:53 -05:00
|
|
|
|
2024-06-19 13:58:37 -05:00
|
|
|
return (
|
|
|
|
|
<Button
|
2024-06-19 20:23:44 -05:00
|
|
|
key={tier}
|
2024-06-19 13:58:37 -05:00
|
|
|
variant="soft"
|
|
|
|
|
radius="none"
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
style={{
|
|
|
|
|
width: 32,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{TIER_ROMAN_NUMERALS[tier]}
|
|
|
|
|
</Button>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 13:58:37 -05:00
|
|
|
{times(5, (index) => {
|
|
|
|
|
const tier = (index + 6) as Tier;
|
2024-06-18 14:28:20 -05:00
|
|
|
|
2024-06-19 13:58:37 -05:00
|
|
|
return (
|
|
|
|
|
<Button
|
2024-06-19 20:23:44 -05:00
|
|
|
key={tier}
|
2024-06-19 13:58:37 -05:00
|
|
|
variant="soft"
|
|
|
|
|
radius="none"
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
style={{
|
|
|
|
|
width: 32,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{TIER_ROMAN_NUMERALS[tier]}
|
|
|
|
|
</Button>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
2024-06-18 14:28:20 -05:00
|
|
|
|
2024-06-19 13:58:37 -05:00
|
|
|
<Flex
|
2024-06-20 13:20:03 -05:00
|
|
|
direction={{
|
|
|
|
|
initial: 'row',
|
|
|
|
|
sm: 'column',
|
2024-06-19 13:58:37 -05:00
|
|
|
}}
|
2024-06-19 20:53:59 -05:00
|
|
|
overflow="hidden"
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-4)',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 20:53:59 -05:00
|
|
|
{awaitedGameDefinitions.nations
|
|
|
|
|
.slice(0, Math.ceil(awaitedGameDefinitions.nations.length / 2))
|
|
|
|
|
.map((nation) => (
|
|
|
|
|
<IconButton
|
2024-06-20 13:20:03 -05:00
|
|
|
// style={{ flex: 1 }}
|
2024-06-19 20:53:59 -05:00
|
|
|
variant="soft"
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
radius="none"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
style={{ width: '1em', height: '1em' }}
|
|
|
|
|
src={asset(`flags/circle/${nation}.webp`)}
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
))}
|
|
|
|
|
</Flex>
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-06-19 20:53:59 -05:00
|
|
|
{awaitedGameDefinitions.nations
|
|
|
|
|
.slice(Math.ceil(awaitedGameDefinitions.nations.length / 2))
|
|
|
|
|
.map((nation) => (
|
|
|
|
|
<IconButton
|
|
|
|
|
style={{ flex: 1 }}
|
|
|
|
|
variant="soft"
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
radius="none"
|
|
|
|
|
>
|
|
|
|
|
{/* TODO: trim icons */}
|
|
|
|
|
<img
|
|
|
|
|
style={{ width: '1em', height: '1em' }}
|
|
|
|
|
src={asset(`flags/circle/${nation}.webp`)}
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
))}
|
|
|
|
|
</Flex>
|
2024-06-19 13:58:37 -05:00
|
|
|
</Flex>
|
2024-06-18 14:28:20 -05:00
|
|
|
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex
|
|
|
|
|
overflow="hidden"
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-full)',
|
|
|
|
|
}}
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{TANK_CLASSES.map((tankClass) => {
|
|
|
|
|
const Icon = classIcons[tankClass];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<IconButton
|
|
|
|
|
key={tankClass}
|
|
|
|
|
variant="soft"
|
|
|
|
|
radius="none"
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
>
|
|
|
|
|
<Icon style={{ width: '1em', height: '1em' }} />
|
|
|
|
|
</IconButton>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
|
|
|
|
|
|
|
|
|
<Flex
|
|
|
|
|
overflow="hidden"
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-full)',
|
|
|
|
|
}}
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<ResearchedIcon style={{ width: '1em', height: '1em' }} />
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<Text
|
|
|
|
|
color="amber"
|
|
|
|
|
style={{ display: 'flex', justifyContent: 'center' }}
|
|
|
|
|
>
|
|
|
|
|
<ResearchedIcon style={{ width: '1em', height: '1em' }} />
|
|
|
|
|
</Text>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<Text
|
|
|
|
|
color="blue"
|
|
|
|
|
style={{ display: 'flex', justifyContent: 'center' }}
|
|
|
|
|
>
|
|
|
|
|
<ResearchedIcon style={{ width: '1em', height: '1em' }} />
|
|
|
|
|
</Text>
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Flex>
|
|
|
|
|
|
2024-06-20 13:31:42 -05:00
|
|
|
<Flex
|
|
|
|
|
overflow="hidden"
|
|
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-full)',
|
|
|
|
|
}}
|
|
|
|
|
direction={{
|
|
|
|
|
sm: 'row',
|
|
|
|
|
initial: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<ExperimentIcon
|
|
|
|
|
style={{ width: '1em', height: '1em', color: 'currentColor' }}
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<ScienceIcon
|
|
|
|
|
style={{ width: '1em', height: '1em', color: 'currentColor' }}
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<IconButton variant="soft" radius="none" color="gray" highContrast>
|
|
|
|
|
<ScienceOffIcon
|
|
|
|
|
style={{ width: '1em', height: '1em', color: 'currentColor' }}
|
|
|
|
|
/>
|
|
|
|
|
</IconButton>
|
2024-06-20 13:20:03 -05:00
|
|
|
</Flex>
|
2024-06-19 13:58:37 -05:00
|
|
|
</Flex>
|
2024-06-18 14:28:20 -05:00
|
|
|
|
2024-06-20 13:20:03 -05:00
|
|
|
<Flex direction="column" gap="8" flexGrow="1">
|
2024-06-19 13:58:37 -05:00
|
|
|
{range(10, 0).map((tierUntyped) => {
|
|
|
|
|
const tier = tierUntyped as Tier;
|
2024-06-19 20:53:59 -05:00
|
|
|
const tierTanks = awaitedTanksDefinitionsArray
|
|
|
|
|
.filter((tank) => tank.tier === tier)
|
|
|
|
|
.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
treeTypeOrder.indexOf(a.treeType) -
|
|
|
|
|
treeTypeOrder.indexOf(b.treeType),
|
|
|
|
|
)
|
|
|
|
|
.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
TANK_CLASSES.indexOf(a.class) - TANK_CLASSES.indexOf(b.class),
|
|
|
|
|
)
|
|
|
|
|
.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
awaitedGameDefinitions.nations.indexOf(a.nation) -
|
|
|
|
|
awaitedGameDefinitions.nations.indexOf(b.nation),
|
|
|
|
|
);
|
2024-06-18 14:28:20 -05:00
|
|
|
|
2024-06-19 13:58:37 -05:00
|
|
|
return (
|
|
|
|
|
<Flex key={tier} direction="column" gap="4">
|
2024-06-19 20:53:59 -05:00
|
|
|
<Flex align="center" mb="4" gap="4">
|
|
|
|
|
<Heading weight="regular">
|
|
|
|
|
Tier {TIER_ROMAN_NUMERALS[tier]}
|
|
|
|
|
</Heading>
|
|
|
|
|
<Separator style={{ flex: 1 }} />
|
|
|
|
|
</Flex>
|
2024-06-18 20:43:21 -05:00
|
|
|
|
2024-06-19 20:53:59 -05:00
|
|
|
<Grid
|
|
|
|
|
flexGrow="1"
|
|
|
|
|
columns="repeat(auto-fill, minmax(100px, 1fr))"
|
|
|
|
|
gap="2"
|
|
|
|
|
gapY="6"
|
|
|
|
|
>
|
|
|
|
|
{tierTanks.map((tank) => {
|
|
|
|
|
const Icon = classIcons[tank.class];
|
2024-06-19 13:58:37 -05:00
|
|
|
|
|
|
|
|
return (
|
2024-06-19 20:53:59 -05:00
|
|
|
<Link
|
|
|
|
|
key={tank.id}
|
|
|
|
|
size="1"
|
|
|
|
|
color={
|
|
|
|
|
tank.treeType === 'collector'
|
|
|
|
|
? 'blue'
|
|
|
|
|
: tank.treeType === 'premium'
|
|
|
|
|
? 'amber'
|
|
|
|
|
: 'gray'
|
|
|
|
|
}
|
|
|
|
|
highContrast={tank.treeType === 'researchable'}
|
|
|
|
|
underline="hover"
|
|
|
|
|
href={`/tools/tankopedia/${tank.id}`}
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
gap: 'var(--space-2)',
|
|
|
|
|
background: `url(${asset(`flags/scratched/${tank.nation}.webp`)})`,
|
|
|
|
|
backgroundSize: 'contain',
|
|
|
|
|
backgroundRepeat: 'no-repeat',
|
|
|
|
|
backgroundPosition: 'top left',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
alt={tank.name}
|
|
|
|
|
src={tankIcon(tank.id)}
|
|
|
|
|
height={64}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
objectPosition: 'center right',
|
|
|
|
|
objectFit: 'contain',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Flex
|
|
|
|
|
justify="center"
|
|
|
|
|
gap="1"
|
|
|
|
|
align="center"
|
|
|
|
|
overflow="hidden"
|
|
|
|
|
width="100%"
|
|
|
|
|
maxWidth="100%"
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
2024-06-19 13:58:37 -05:00
|
|
|
style={{
|
2024-06-19 20:53:59 -05:00
|
|
|
width: '1em',
|
|
|
|
|
height: '1em',
|
|
|
|
|
minWidth: '1em',
|
|
|
|
|
minHeight: '1em',
|
2024-06-19 13:58:37 -05:00
|
|
|
}}
|
|
|
|
|
/>
|
2024-06-19 20:53:59 -05:00
|
|
|
<Text
|
|
|
|
|
align="center"
|
|
|
|
|
style={{
|
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{tank.name}
|
|
|
|
|
</Text>
|
2024-06-19 13:58:37 -05:00
|
|
|
</Flex>
|
2024-06-19 20:53:59 -05:00
|
|
|
</Link>
|
2024-06-19 13:58:37 -05:00
|
|
|
);
|
|
|
|
|
})}
|
2024-06-19 20:53:59 -05:00
|
|
|
</Grid>
|
2024-06-18 14:28:20 -05:00
|
|
|
</Flex>
|
2024-06-19 13:58:37 -05:00
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
2024-06-18 14:28:20 -05:00
|
|
|
</Flex>
|
2023-11-30 12:21:20 -06:00
|
|
|
</PageWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|