Files
blitzkit/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx
T

95 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-05-03 17:07:27 -05:00
import { Checkbox, Flex, Heading, Text } from '@radix-ui/themes';
2024-05-03 12:57:04 -05:00
import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinitions/constants';
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';
import { useDuel } from '../../../../../../stores/duel';
import mutateTankopediaPersistent, {
useTankopediaPersistent,
} from '../../../../../../stores/tankopedia';
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() {
const tank = useDuel((state) => state.protagonist!.tank);
const mode = useTankopediaPersistent((state) => state.mode);
2024-05-03 17:07:27 -05:00
const wideFormat = useWideFormat(880);
2024-05-03 12:57:04 -05:00
return (
<Flex
justify="center"
2024-05-03 17:07:27 -05:00
pl={wideFormat ? '9' : undefined}
p={wideFormat ? '0' : '6'}
pb={wideFormat ? '0' : '6'}
2024-05-03 12:57:04 -05:00
style={{
2024-05-03 17:22:36 -05:00
background: `linear-gradient(-90deg, ${theme.colors.appBackground1}, ${theme.colors.appBackground2})`,
2024-05-03 12:57:04 -05:00
position: 'relative',
}}
>
<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={{
flex: 1,
}}
>
2024-05-03 17:26:14 -05:00
<Flex gap={wideFormat ? '4' : '2'} direction="column">
<Heading size={wideFormat ? '9' : '8'}>{tank.name}</Heading>
<Text color="gray">
Tier {TIER_ROMAN_NUMERALS[tank.tier]}{' '}
{(strings.common.nations as Record<string, string>)[tank.nation]}{' '}
{strings.common.tank_class_short[tank.class]}
</Text>
</Flex>
2024-05-03 12:57:04 -05:00
</Flex>
<div
style={{
height: 512,
2024-05-03 17:07:27 -05:00
flex: wideFormat ? 3 : undefined,
2024-05-03 12:57:04 -05:00
position: 'relative',
}}
>
<div
style={{
width: '100%',
height: '100%',
}}
>
<TankSandbox />
</div>
<Flex
style={{
position: 'absolute',
bottom: 16,
left: '50%',
transform: 'translateX(-50%)',
cursor: 'default',
userSelect: 'none',
}}
align="center"
gap="2"
onClick={() => {
mutateTankopediaPersistent((draft) => {
draft.mode = draft.mode === 'armor' ? 'model' : 'armor';
});
}}
>
<Checkbox checked={mode === 'armor'} />
Armor
</Flex>
</div>
</Flex>
2024-05-03 17:07:27 -05:00
<Options />
2024-05-03 12:57:04 -05:00
</Flex>
);
}