import { previewCompositeStat, TankClass, TankDefinition, TankType, type CompositeStatsKey, } 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-es'; import type { ReactNode } from 'react'; import { breakdownConfig } from '../constants/embeds'; import { toRadiusVar } from '../core/radix/utils'; 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 === TankClass.LIGHT && ( )} {tank.class === TankClass.MEDIUM && ( )} {tank.class === TankClass.HEAVY && ( )} {tank.class === TankClass.TANK_DESTROYER && ( )} )}{' '} {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} ); })} ); }