import { CompositeStatsKey, previewCompositeStat, TankDefinition, } from '@blitzkit/core'; import strings from '@blitzkit/core/lang/en-US.json'; import { amberDark, blueDark } from '@radix-ui/colors'; import { Flex, Text } from '@radix-ui/themes'; import { times } from 'lodash'; import { ReactNode } from 'react'; import { breakdownConfig } from '../app/tools/embed/configurations/breakdown'; import { toRadiusVar } from '../app/tools/embed/utilities'; import { useEmbedStateCurry } from '../stores/embedState/utilities'; import { ClassHeavy } from './ClassIcon/components/ClassHeavy'; import { ClassLight } from './ClassIcon/components/ClassLight'; import { ClassMedium } from './ClassIcon/components/ClassMedium'; import { ClassTankDestroyer } from './ClassIcon/components/ClassTankDestroyer'; interface BreakdownEmbedWrapperProps { children: ReactNode; } export function BreakdownEmbedWrapper({ children, }: BreakdownEmbedWrapperProps) { const { useState } = useEmbedStateCurry(); return ( {children} ); } interface BreakdownEmbedCardProps { tank: TankDefinition | null; } export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) { const { useState, useRichText } = useEmbedStateCurry(); return ( {useState('cardTitleClassIcon') && tank !== null && ( <> {tank.class === 'lightTank' && ( )} {tank.class === 'mediumTank' && ( )} {tank.class === 'heavyTank' && ( )} {tank.class === 'AT-SPG' && ( )} )}{' '} {tank === null ? 'Total' : tank.name} {times(4, (index) => { const column = (index + 1) as 1 | 2 | 3 | 4; const columnState = useState(`column${column}`) as CompositeStatsKey; const customLabel = useState(`column${column}CustomLabel`); return ( {previewCompositeStat(columnState)} {customLabel.length === 0 ? strings.common.composite_stats[columnState] : customLabel} ); })} ); }