2024-09-07 21:45:00 -05:00
|
|
|
import { TankClass, TreeType } from '@blitzkit/core';
|
2024-09-06 23:17:53 -05:00
|
|
|
import { Percentile } from '@blitzkit/core/src/statistics/percentiles';
|
2023-12-03 10:43:42 -06:00
|
|
|
import { createColors } from 'bepaint';
|
|
|
|
|
import {
|
|
|
|
|
AccentColor,
|
|
|
|
|
GrayColor,
|
|
|
|
|
PALETTES,
|
2024-09-07 21:45:00 -05:00
|
|
|
} from '../../../core/radix/radixColors';
|
2024-03-12 23:36:56 -05:00
|
|
|
import { TREE_TYPE_ICONS } from '../../Tanks/components/Item/constants';
|
2023-07-11 19:54:57 +00:00
|
|
|
import { RowStat } from './RowStat';
|
2023-05-28 02:25:59 +00:00
|
|
|
|
2023-10-01 19:02:47 -05:00
|
|
|
export interface RowStatItem {
|
2023-10-01 18:43:40 -05:00
|
|
|
title: string;
|
|
|
|
|
current?: number | string;
|
|
|
|
|
career?: number | string;
|
|
|
|
|
delta?: number;
|
|
|
|
|
percentile?: Percentile;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-23 23:30:14 +00:00
|
|
|
interface RowProps {
|
2023-09-24 17:02:09 -05:00
|
|
|
type?: 'tank' | 'summary';
|
2024-02-05 09:36:03 -06:00
|
|
|
naked?: boolean;
|
2023-09-23 22:02:30 +00:00
|
|
|
title: string;
|
|
|
|
|
minimized?: boolean;
|
2024-01-27 17:36:29 -06:00
|
|
|
treeType?: TreeType;
|
2024-03-07 18:30:02 -06:00
|
|
|
tankType?: TankClass;
|
2023-12-03 10:43:42 -06:00
|
|
|
color?: AccentColor | GrayColor;
|
2023-10-01 19:02:47 -05:00
|
|
|
stats: (RowStatItem | undefined)[];
|
2023-09-23 23:30:14 +00:00
|
|
|
}
|
2023-09-23 22:02:30 +00:00
|
|
|
|
2023-12-03 10:43:42 -06:00
|
|
|
export function Row({
|
|
|
|
|
color = 'slate',
|
|
|
|
|
stats,
|
|
|
|
|
title,
|
|
|
|
|
minimized,
|
|
|
|
|
tankType,
|
|
|
|
|
treeType,
|
2024-02-05 09:36:03 -06:00
|
|
|
naked = false,
|
2023-12-03 10:43:42 -06:00
|
|
|
type,
|
|
|
|
|
}: RowProps) {
|
2024-02-05 09:36:03 -06:00
|
|
|
const palette = PALETTES[`${color}Dark`];
|
|
|
|
|
const theme = createColors(palette);
|
2023-12-03 10:43:42 -06:00
|
|
|
|
2023-05-28 02:25:59 +00:00
|
|
|
return (
|
2023-07-09 17:37:44 +00:00
|
|
|
<div
|
2023-12-03 10:44:49 -06:00
|
|
|
className="session-tracker-row"
|
2023-07-09 17:37:44 +00:00
|
|
|
style={{
|
2024-02-23 16:51:04 -06:00
|
|
|
maxWidth: naked ? 600 : Infinity,
|
2023-07-09 17:37:44 +00:00
|
|
|
display: 'flex',
|
2023-08-10 01:03:53 +00:00
|
|
|
flexDirection: 'column',
|
2023-07-09 17:37:44 +00:00
|
|
|
borderRadius: 4,
|
2024-02-05 09:36:03 -06:00
|
|
|
backgroundColor: naked
|
|
|
|
|
? `${theme.appBackground2}c0`
|
|
|
|
|
: theme.appBackground2,
|
2023-08-10 01:03:53 +00:00
|
|
|
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,
|
2024-02-05 09:36:03 -06:00
|
|
|
backgroundColor: naked
|
|
|
|
|
? `${theme.componentInteractive}c0`
|
|
|
|
|
: theme.componentInteractive,
|
2023-08-10 01:03:53 +00:00
|
|
|
}}
|
|
|
|
|
>
|
2023-12-03 10:43:42 -06:00
|
|
|
{type === 'tank' && tankType !== undefined && (
|
2023-09-24 15:58:42 -05:00
|
|
|
<img
|
2024-05-04 16:28:12 -05:00
|
|
|
alt={tankType}
|
2024-01-27 17:36:29 -06:00
|
|
|
src={TREE_TYPE_ICONS[treeType ?? 'researchable'][tankType]}
|
2023-09-24 15:58:42 -05:00
|
|
|
style={{ width: 16, height: 16 }}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-09-23 22:02:30 +00:00
|
|
|
|
2023-08-10 01:03:53 +00:00
|
|
|
<span
|
|
|
|
|
style={{
|
2023-09-23 22:02:30 +00:00
|
|
|
color:
|
2023-12-03 10:43:42 -06:00
|
|
|
type === 'tank'
|
2024-01-27 17:36:29 -06:00
|
|
|
? treeType === 'collector'
|
2023-12-03 10:43:42 -06:00
|
|
|
? theme.textLowContrast_blue
|
2024-01-27 17:36:29 -06:00
|
|
|
: treeType === 'premium'
|
2024-09-06 23:17:53 -05:00
|
|
|
? theme.textLowContrast_amber
|
|
|
|
|
: theme.textHighContrast
|
2023-12-03 10:43:42 -06:00
|
|
|
: theme.textLowContrast,
|
2023-08-10 01:03:53 +00:00
|
|
|
fontWeight: 900,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-12-03 10:43:42 -06:00
|
|
|
{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-12-03 10:43:42 -06:00
|
|
|
{stats.map(
|
2023-10-01 18:43:40 -05:00
|
|
|
(row, index) =>
|
|
|
|
|
row && (
|
|
|
|
|
<RowStat
|
2023-12-03 10:43:42 -06:00
|
|
|
minimized={minimized}
|
2023-10-01 18:43:40 -05:00
|
|
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|