mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: composite stats
This commit is contained in:
1 parent
f1767bf5d7
commit
d910ed9f5e
5 files changed
+314
-60
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import {
|
||||
previewCompositeStat,
|
||||
formatCompositeStat,
|
||||
TankClass,
|
||||
TankDefinition,
|
||||
TankType,
|
||||
type CompositeStats,
|
||||
type CompositeStatsKey,
|
||||
} from '@blitzkit/core';
|
||||
import strings from '@blitzkit/core/lang/en-US.json';
|
||||
@@ -42,9 +43,13 @@ export function BreakdownEmbedWrapper({
|
||||
|
||||
interface BreakdownEmbedCardProps {
|
||||
tank: TankDefinition | null | undefined;
|
||||
composite: CompositeStats;
|
||||
}
|
||||
|
||||
export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
|
||||
export function BreakdownEmbedCard({
|
||||
tank,
|
||||
composite,
|
||||
}: BreakdownEmbedCardProps) {
|
||||
const { useEmbedState, useRichText } =
|
||||
useEmbedStateCurry<typeof breakdownConfig>();
|
||||
|
||||
@@ -114,9 +119,7 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
|
||||
<Flex p={useEmbedState('cardBodyPadding')}>
|
||||
{times(4, (index) => {
|
||||
const column = (index + 1) as 1 | 2 | 3 | 4;
|
||||
const columnState = useEmbedState(
|
||||
`column${column}`,
|
||||
) as CompositeStatsKey;
|
||||
const statKey = useEmbedState(`column${column}`) as CompositeStatsKey;
|
||||
const customLabel = useEmbedState(`column${column}CustomLabel`);
|
||||
|
||||
return (
|
||||
@@ -128,11 +131,11 @@ export function BreakdownEmbedCard({ tank }: BreakdownEmbedCardProps) {
|
||||
flexGrow="1"
|
||||
>
|
||||
<Text {...useRichText('columnValue')}>
|
||||
{previewCompositeStat(columnState)}
|
||||
{formatCompositeStat(composite[statKey], statKey, composite)}
|
||||
</Text>
|
||||
<Text {...useRichText('columnLabel')}>
|
||||
{customLabel.length === 0
|
||||
? strings.common.composite_stats[columnState]
|
||||
? strings.common.composite_stats[statKey]
|
||||
: customLabel}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
Reference in new issue
Block a user