2024-10-05 23:20:04 -05:00
|
|
|
import { compositeStatsKeys, fetchTankDefinitions } from '@blitzkit/core';
|
2024-09-07 21:45:00 -05:00
|
|
|
import strings from '@blitzkit/core/lang/en-US.json';
|
2024-10-05 23:20:04 -05:00
|
|
|
import { breakdownConfig } from '../../constants/embeds';
|
|
|
|
|
import { useEmbedStateCurry } from '../../stores/embedState/utilities';
|
|
|
|
|
import { BreakdownEmbedCard, BreakdownEmbedWrapper } from '../TanksEmbed';
|
2024-08-08 14:18:22 -05:00
|
|
|
|
2024-09-08 21:52:12 -05:00
|
|
|
export const compositeStatsKeysOptions = compositeStatsKeys.map((value) => ({
|
2024-08-10 13:29:10 -05:00
|
|
|
label: strings.common.composite_stats[value],
|
|
|
|
|
value,
|
|
|
|
|
}));
|
|
|
|
|
|
2024-10-05 23:20:04 -05:00
|
|
|
const tanks = await fetchTankDefinitions().then((tanks) =>
|
|
|
|
|
Object.values(tanks.tanks),
|
|
|
|
|
);
|
|
|
|
|
|
2024-08-08 14:18:22 -05:00
|
|
|
export function BreakdownPreview() {
|
|
|
|
|
const { useState } = useEmbedStateCurry<typeof breakdownConfig>();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<BreakdownEmbedWrapper>
|
|
|
|
|
{useState('showTotal') && <BreakdownEmbedCard tank={null} />}
|
|
|
|
|
|
|
|
|
|
{tanks.slice(0, useState('listMaxTanks')).map((tank) => (
|
|
|
|
|
<BreakdownEmbedCard key={tank.id} tank={tank} />
|
|
|
|
|
))}
|
|
|
|
|
</BreakdownEmbedWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|