2024-09-08 10:11:24 -05:00
|
|
|
import {
|
|
|
|
|
Percentile,
|
|
|
|
|
TankClass,
|
2024-10-05 15:57:34 -05:00
|
|
|
TankType,
|
2024-09-08 10:11:24 -05:00
|
|
|
TREE_TYPE_ICONS,
|
|
|
|
|
} from '@blitzkit/core';
|
2023-12-03 10:43:42 -06:00
|
|
|
import { createColors } from 'bepaint';
|
|
|
|
|
import {
|
2025-10-13 23:20:26 -05:00
|
|
|
type AccentColor,
|
|
|
|
|
type GrayColor,
|
2023-12-03 10:43:42 -06:00
|
|
|
PALETTES,
|
2024-09-07 21:45:00 -05:00
|
|
|
} from '../../../core/radix/radixColors';
|
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 {
|
2024-10-05 15:57:34 -05:00
|
|
|
displayType?: '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-10-05 15:57:34 -05:00
|
|
|
type?: TankType;
|
|
|
|
|
class?: 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,
|
2024-10-05 15:57:34 -05:00
|
|
|
class: tankClass,
|
2023-12-03 10:43:42 -06:00
|
|
|
type,
|
2024-10-05 15:57:34 -05:00
|
|
|
naked = false,
|
|
|
|
|
displayType,
|
2023-12-03 10:43:42 -06:00
|
|
|
}: 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
|
|
|
}}
|
|
|
|
|
>
|
2024-10-05 15:57:34 -05:00
|
|
|
{displayType === 'tank' && tankClass !== undefined && (
|
2023-09-24 15:58:42 -05:00
|
|
|
<img
|
2024-10-05 15:57:34 -05:00
|
|
|
alt={TankClass[tankClass]}
|
|
|
|
|
src={TREE_TYPE_ICONS[type ?? TankType.RESEARCHABLE][tankClass]}
|
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:
|
2024-10-05 15:57:34 -05:00
|
|
|
displayType === 'tank'
|
|
|
|
|
? type === TankType.COLLECTOR
|
2023-12-03 10:43:42 -06:00
|
|
|
? theme.textLowContrast_blue
|
2024-11-18 10:56:24 -06:00
|
|
|
: type === TankType.PREMIUM
|
2024-09-07 23:00:56 -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>
|
|
|
|
|
);
|
|
|
|
|
}
|