feat: better meta

This commit is contained in:
tresabhi committed 2025-04-17 00:23:01 -05:00
1 parent bdc013b4c8
commit e3c6497d29
11 files changed
+55 -41

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

@@ -1,4 +1,5 @@
import { Flex, Text, type TextProps } from '@radix-ui/themes'; import { Flex, Text, type TextProps } from '@radix-ui/themes';
import { Var } from '../../../../core/radix/var';
type ListingProps = TextProps & { type ListingProps = TextProps & {
label: string; label: string;
@@ -6,9 +7,15 @@ type ListingProps = TextProps & {
export function Listing({ label, ...props }: ListingProps) { export function Listing({ label, ...props }: ListingProps) {
return ( return (
<Flex minWidth="15rem" justify="between" gap="4"> <Flex
<Text color="gray">{label}</Text> minWidth="17rem"
<Text align="right" {...props} /> justify="between"
gap="4"
px="1"
style={{ borderBottom: `1px solid ${Var('gray-11')}` }}
>
<Text size="4">{label}</Text>
<Text align="right" size="4" weight="medium" {...props} />
</Flex> </Flex>
); );
} }
@@ -1,60 +1,61 @@
import { import {
assertSecret,
asset, asset,
TankPriceType, TankPriceType,
TankType, TankType,
TIER_ROMAN_NUMERALS, TIER_ROMAN_NUMERALS,
} from '@blitzkit/core'; } from '@blitzkit/core';
import { ChevronLeftIcon, MixIcon, UpdateIcon } from '@radix-ui/react-icons'; import { Box, Code, Flex } from '@radix-ui/themes';
import { Button, Code, Dialog, Flex, Link } from '@radix-ui/themes'; import { Var } from '../../../core/radix/var';
import { useState } from 'react';
import { awaitableModelDefinitions } from '../../../core/awaitables/modelDefinitions';
import { awaitableProvisionDefinitions } from '../../../core/awaitables/provisionDefinitions';
import { tankToDuelMember } from '../../../core/blitzkit/tankToDuelMember';
import { useLocale } from '../../../hooks/useLocale'; import { useLocale } from '../../../hooks/useLocale';
import { App } from '../../../stores/app'; import { App } from '../../../stores/app';
import { Duel } from '../../../stores/duel'; import { Duel } from '../../../stores/duel';
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
import { classIcons } from '../../ClassIcon'; import { classIcons } from '../../ClassIcon';
import { LinkI18n } from '../../LinkI18n';
import { ScienceIcon } from '../../ScienceIcon';
import { TankSearch } from '../../TankSearch';
import { Listing } from './components/Listing'; import { Listing } from './components/Listing';
const [provisionDefinitions, modelDefinitions] = await Promise.all([ const NATIONAL_BANNER_POSITION_OVERRIDES: Record<string, string> = {
awaitableProvisionDefinitions, germany: '50% 35%',
awaitableModelDefinitions, france: '50% 35%',
]); other: '50% 35%',
};
export function MetaSection() { export function MetaSection() {
const developerMode = App.useDeferred((state) => state.developerMode, false); const developerMode = App.useDeferred((state) => state.developerMode, false);
const protagonist = Duel.use((state) => state.protagonist.tank); const protagonist = Duel.use((state) => state.protagonist.tank);
const antagonist = Duel.use((state) => state.antagonist.tank);
const ClassIcon = classIcons[protagonist.class]; const ClassIcon = classIcons[protagonist.class];
const compareTanks = const { locale, strings } = useLocale();
protagonist.id === antagonist.id
? [protagonist.id] console.log(protagonist.nation);
: [protagonist.id, antagonist.id];
const mutateDuel = Duel.useMutation();
const mutateTankopediaEphemeral = TankopediaEphemeral.useMutation();
const [showSwapDialog, setShowSwapDialog] = useState(false);
const { locale, strings, unwrap } = useLocale();
return ( return (
<Flex justify="center" align="center"> <Box
<Flex direction="column" align="center" gap="6"> style={{
background: `url(/assets/images/national-wallpapers/${protagonist.nation}.jpg)`,
backgroundPosition:
NATIONAL_BANNER_POSITION_OVERRIDES[protagonist.nation] ?? 'center',
}}
>
<Box
style={{
background: `url(${asset(`flags/scratched/${protagonist.nation}.webp`)})`,
backgroundRepeat: 'no-repeat',
backgroundSize: '53rem',
backgroundPosition: '-25% 50%',
}}
>
<Flex <Flex
gap={{ initial: '0', sm: '6' }} justify="center"
align="center"
py="6rem"
style={{
background: `linear-gradient(${Var('gray-1')}, ${Var('black-a8')}, ${Var('black-a8')}, ${Var('gray-1')})`,
}}
>
<Flex direction="column" align="center" gap="6">
<Flex
gap={{ initial: '0', sm: '8' }}
direction={{ initial: 'column', sm: 'row' }} direction={{ initial: 'column', sm: 'row' }}
> >
<Flex direction="column" width="100%"> <Flex direction="column" width="100%" gap="2">
{protagonist.name_full && (
<Listing label={strings.website.tools.tankopedia.meta.full_name}>
{unwrap(protagonist.name_full)}
</Listing>
)}
<Listing label={strings.website.tools.tankopedia.meta.nation}> <Listing label={strings.website.tools.tankopedia.meta.nation}>
<Flex align="center" gap="1"> <Flex align="center" gap="1">
<img <img
@@ -92,14 +93,16 @@ export function MetaSection() {
</Listing> </Listing>
</Flex> </Flex>
<Flex direction="column" width="100%"> <Flex direction="column" width="100%" gap="2">
{developerMode && ( {developerMode && (
<Listing label={strings.website.tools.tankopedia.meta.dev_id}> <Listing label={strings.website.tools.tankopedia.meta.dev_id}>
<Code>{protagonist.id}</Code> <Code>{protagonist.id}</Code>
</Listing> </Listing>
)} )}
{protagonist.type === TankType.PREMIUM && ( {protagonist.type === TankType.PREMIUM && (
<Listing label={strings.website.tools.tankopedia.meta.purchase}> <Listing
label={strings.website.tools.tankopedia.meta.purchase}
>
<Flex align="center" gap="1"> <Flex align="center" gap="1">
{protagonist.price.value / 400} {protagonist.price.value / 400}
<img <img
@@ -149,7 +152,9 @@ export function MetaSection() {
</Flex> </Flex>
</Listing> </Listing>
{protagonist.research_cost && ( {protagonist.research_cost && (
<Listing label={strings.website.tools.tankopedia.meta.research}> <Listing
label={strings.website.tools.tankopedia.meta.research}
>
<Flex align="center" gap="1"> <Flex align="center" gap="1">
{( {(
protagonist.research_cost.research_cost_type! protagonist.research_cost.research_cost_type!
@@ -167,5 +172,7 @@ export function MetaSection() {
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>
</Box>
</Box>
); );
} }