2024-05-04 16:53:26 -05:00
|
|
|
import { ChevronLeftIcon, MixIcon } from '@radix-ui/react-icons';
|
2024-05-03 21:17:31 -05:00
|
|
|
import { Button, Flex, Heading, Text } from '@radix-ui/themes';
|
|
|
|
|
import Link from 'next/link';
|
2024-06-29 12:12:10 -05:00
|
|
|
import { classIcons } from '../../../../../../components/ClassIcon';
|
2024-05-03 12:57:04 -05:00
|
|
|
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
2024-05-04 17:02:03 -05:00
|
|
|
import { useFullScreen } from '../../../../../../hooks/useFullScreen';
|
2024-05-03 17:07:27 -05:00
|
|
|
import { useWideFormat } from '../../../../../../hooks/useWideFormat';
|
2024-05-03 12:57:04 -05:00
|
|
|
import strings from '../../../../../../lang/en-US.json';
|
|
|
|
|
import { theme } from '../../../../../../stitches.config';
|
2024-07-09 20:35:36 -05:00
|
|
|
import * as Duel from '../../../../../../stores/duel';
|
2024-05-03 12:57:04 -05:00
|
|
|
import { TankSandbox } from './TankSandbox';
|
2024-05-03 17:07:27 -05:00
|
|
|
import { Options } from './components/Options';
|
2024-05-03 12:57:04 -05:00
|
|
|
|
|
|
|
|
export function HeroSection() {
|
2024-07-09 20:35:36 -05:00
|
|
|
const protagonist = Duel.use((state) => state.protagonist!.tank);
|
|
|
|
|
const antagonist = Duel.use((state) => state.antagonist!.tank);
|
2024-05-03 17:07:27 -05:00
|
|
|
const wideFormat = useWideFormat(880);
|
2024-05-03 21:17:31 -05:00
|
|
|
const compareTanks =
|
2024-06-29 12:12:10 -05:00
|
|
|
protagonist.id === antagonist.id
|
|
|
|
|
? [protagonist.id]
|
|
|
|
|
: [protagonist.id, antagonist.id];
|
2024-05-04 17:02:03 -05:00
|
|
|
const isFullScreen = useFullScreen();
|
2024-06-29 12:12:10 -05:00
|
|
|
const Icon = classIcons[protagonist.class];
|
2024-05-03 12:57:04 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
|
|
|
|
justify="center"
|
2024-05-03 20:54:00 -05:00
|
|
|
pt={wideFormat ? '0' : '6'}
|
2024-05-03 12:57:04 -05:00
|
|
|
style={{
|
2024-06-03 18:02:10 -05:00
|
|
|
background: 'var(--color-surface)',
|
2024-05-03 12:57:04 -05:00
|
|
|
position: 'relative',
|
2024-05-04 16:19:27 -05:00
|
|
|
height: wideFormat ? undefined : 'calc(75vh - 64px)',
|
2024-05-03 12:57:04 -05:00
|
|
|
}}
|
2024-05-03 20:49:05 -05:00
|
|
|
gap="4"
|
2024-05-03 12:57:04 -05:00
|
|
|
>
|
|
|
|
|
<Flex
|
2024-05-03 17:07:27 -05:00
|
|
|
direction={wideFormat ? 'row' : 'column'}
|
2024-05-03 12:57:04 -05:00
|
|
|
style={{
|
|
|
|
|
maxWidth: 1600,
|
|
|
|
|
flex: 1,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Flex
|
2024-05-03 17:26:14 -05:00
|
|
|
align="center"
|
2024-05-03 12:57:04 -05:00
|
|
|
justify="center"
|
|
|
|
|
style={{
|
2024-05-03 20:49:05 -05:00
|
|
|
flex: wideFormat ? 1 : undefined,
|
2024-05-03 12:57:04 -05:00
|
|
|
}}
|
|
|
|
|
>
|
2024-05-03 19:03:25 -05:00
|
|
|
<Flex
|
|
|
|
|
gap={wideFormat ? '4' : '2'}
|
|
|
|
|
direction="column"
|
2024-05-03 20:49:05 -05:00
|
|
|
ml={wideFormat ? '8' : undefined}
|
2024-05-03 19:03:25 -05:00
|
|
|
align={wideFormat ? undefined : 'center'}
|
2024-05-04 16:53:26 -05:00
|
|
|
justify="center"
|
|
|
|
|
style={{
|
|
|
|
|
height: '100%',
|
|
|
|
|
}}
|
2024-05-03 19:03:25 -05:00
|
|
|
>
|
2024-06-18 20:43:21 -05:00
|
|
|
<Heading
|
|
|
|
|
size={wideFormat ? '9' : '8'}
|
|
|
|
|
align={wideFormat ? undefined : 'center'}
|
2024-06-29 12:12:10 -05:00
|
|
|
color={
|
|
|
|
|
protagonist.treeType === 'collector'
|
|
|
|
|
? 'blue'
|
|
|
|
|
: protagonist.treeType === 'premium'
|
|
|
|
|
? 'amber'
|
|
|
|
|
: undefined
|
|
|
|
|
}
|
2024-06-18 20:43:21 -05:00
|
|
|
>
|
2024-06-29 12:12:10 -05:00
|
|
|
<Icon style={{ width: '0.75em', height: '0.75em' }} />{' '}
|
|
|
|
|
{protagonist.nameFull ?? protagonist.name}
|
2024-05-03 21:17:31 -05:00
|
|
|
</Heading>
|
2024-05-04 16:53:26 -05:00
|
|
|
|
2024-05-03 17:26:14 -05:00
|
|
|
<Text color="gray">
|
2024-06-29 12:12:10 -05:00
|
|
|
Tier {TIER_ROMAN_NUMERALS[protagonist.tier]}{' '}
|
2024-05-03 17:42:28 -05:00
|
|
|
{
|
|
|
|
|
(strings.common.nations_adjectives as Record<string, string>)[
|
2024-06-29 12:12:10 -05:00
|
|
|
protagonist.nation
|
2024-05-03 17:42:28 -05:00
|
|
|
]
|
|
|
|
|
}{' '}
|
2024-06-29 12:12:10 -05:00
|
|
|
{strings.common.tank_class_short[protagonist.class]}
|
2024-05-03 17:26:14 -05:00
|
|
|
</Text>
|
2024-05-03 21:17:31 -05:00
|
|
|
|
2024-05-04 16:53:26 -05:00
|
|
|
<Flex gap="4" mt="-1">
|
|
|
|
|
<Link href="/tools/tankopedia">
|
|
|
|
|
<Button variant="ghost" size="1" ml="-1">
|
|
|
|
|
<ChevronLeftIcon />
|
|
|
|
|
Back
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
<Link href={`/tools/compare?tanks=${compareTanks.join('%2C')}`}>
|
|
|
|
|
<Button variant="ghost" size="1">
|
|
|
|
|
<MixIcon />
|
|
|
|
|
Compare
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</Flex>
|
2024-05-03 17:26:14 -05:00
|
|
|
</Flex>
|
2024-05-03 12:57:04 -05:00
|
|
|
</Flex>
|
|
|
|
|
|
|
|
|
|
<div
|
2024-05-04 17:14:08 -05:00
|
|
|
className="tank-sandbox-container"
|
2024-05-03 12:57:04 -05:00
|
|
|
style={{
|
2024-05-03 20:49:05 -05:00
|
|
|
flex: 2,
|
2024-05-04 17:02:03 -05:00
|
|
|
position: isFullScreen ? 'fixed' : 'relative',
|
|
|
|
|
top: isFullScreen ? 0 : undefined,
|
|
|
|
|
left: isFullScreen ? 0 : undefined,
|
|
|
|
|
width: isFullScreen ? '100vw' : undefined,
|
|
|
|
|
height: isFullScreen ? '100vh' : wideFormat ? 512 : undefined,
|
|
|
|
|
zIndex: isFullScreen ? 3 : undefined,
|
|
|
|
|
background: isFullScreen ? theme.colors.appBackground1 : undefined,
|
2024-05-03 12:57:04 -05:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-05-03 17:35:59 -05:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<TankSandbox />
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-05-03 17:52:45 -05:00
|
|
|
<Options />
|
2024-05-03 17:35:59 -05:00
|
|
|
</div>
|
2024-05-03 12:57:04 -05:00
|
|
|
</div>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|