2023-09-23 22:02:30 +00:00
|
|
|
import { Percentile } from '../../../constants/percentiles';
|
2023-08-10 01:03:53 +00:00
|
|
|
import { TankType } from '../../../core/blitz/tankopedia';
|
2023-07-11 19:54:57 +00:00
|
|
|
import { theme } from '../../../stitches.config';
|
2023-08-10 01:03:53 +00:00
|
|
|
import { TREE_TYPE_ICONS, TreeTypeEnum } from '../../Tanks';
|
2023-07-11 19:54:57 +00:00
|
|
|
import { RowStat } from './RowStat';
|
2023-05-28 02:25:59 +00:00
|
|
|
|
2023-09-23 22:02:30 +00:00
|
|
|
type RowProps = (
|
|
|
|
|
| {
|
|
|
|
|
type: 'tank';
|
|
|
|
|
treeType?: TreeTypeEnum;
|
|
|
|
|
tankType?: TankType;
|
|
|
|
|
}
|
|
|
|
|
| {
|
|
|
|
|
type: 'summary';
|
|
|
|
|
}
|
|
|
|
|
) & {
|
|
|
|
|
title: string;
|
|
|
|
|
minimized?: boolean;
|
2023-05-28 02:25:59 +00:00
|
|
|
|
2023-09-23 22:02:30 +00:00
|
|
|
rows: {
|
|
|
|
|
title: string;
|
|
|
|
|
current?: number | string;
|
|
|
|
|
career?: number | string;
|
|
|
|
|
delta?: number;
|
|
|
|
|
percentile?: Percentile;
|
|
|
|
|
}[];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function Row(props: RowProps) {
|
2023-05-28 02:25:59 +00:00
|
|
|
return (
|
2023-07-09 17:37:44 +00:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
2023-08-10 01:03:53 +00:00
|
|
|
flexDirection: 'column',
|
2023-07-09 17:37:44 +00:00
|
|
|
borderRadius: 4,
|
2023-08-10 01:03:53 +00:00
|
|
|
backgroundColor: theme.colors.appBackground2,
|
|
|
|
|
overflow: 'hidden',
|
2023-07-09 17:37:44 +00:00
|
|
|
}}
|
|
|
|
|
>
|
2023-08-10 01:03:53 +00:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
padding: 8,
|
|
|
|
|
gap: 4,
|
|
|
|
|
backgroundColor: theme.colors.componentInteractive,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-09-23 22:02:30 +00:00
|
|
|
{props.type === 'tank' &&
|
|
|
|
|
props.treeType !== undefined &&
|
|
|
|
|
props.tankType !== undefined && (
|
|
|
|
|
<img
|
|
|
|
|
src={TREE_TYPE_ICONS[props.treeType][props.tankType]}
|
|
|
|
|
style={{ width: 16, height: 16 }}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
2023-08-10 01:03:53 +00:00
|
|
|
<span
|
|
|
|
|
style={{
|
2023-09-23 22:02:30 +00:00
|
|
|
color:
|
|
|
|
|
props.type === 'tank'
|
|
|
|
|
? props.treeType === TreeTypeEnum.Collector
|
|
|
|
|
? theme.colors.textLowContrast_blue
|
|
|
|
|
: props.treeType === TreeTypeEnum.Premium
|
|
|
|
|
? theme.colors.textLowContrast_amber
|
|
|
|
|
: theme.colors.textHighContrast
|
|
|
|
|
: theme.colors.textLowContrast,
|
2023-08-10 01:03:53 +00:00
|
|
|
fontWeight: 900,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-09-23 22:02:30 +00:00
|
|
|
{props.title}
|
2023-08-10 01:03:53 +00:00
|
|
|
</span>
|
|
|
|
|
</div>
|
2023-06-06 00:25:23 +00:00
|
|
|
|
2023-08-10 01:03:53 +00:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
paddingTop: 8,
|
|
|
|
|
paddingBottom: 8,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-09-23 22:02:30 +00:00
|
|
|
{props.rows.map((row, index) => (
|
|
|
|
|
<RowStat
|
|
|
|
|
minimized={props.minimized}
|
|
|
|
|
key={index}
|
|
|
|
|
name={`${row.title} • ${row.career ?? '--'}`}
|
|
|
|
|
value={row.current ?? '--'}
|
|
|
|
|
delta={row.delta}
|
|
|
|
|
percentile={row.percentile}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
2023-08-10 01:03:53 +00:00
|
|
|
</div>
|
2023-05-28 02:25:59 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|