mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-11 01:57:49 +02:00
e6078ab1df
* UI: Change description and add tooltip for HackMoney-related multipliers * Update based on feedback
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import React from "react";
|
|
|
|
import { Typography, TableCell, TableRow } from "@mui/material";
|
|
|
|
import { formatExp, formatSkill } from "../formatNumber";
|
|
import { useStyles } from "./CharacterOverview";
|
|
|
|
interface ITableRowData {
|
|
content?: string;
|
|
level?: number;
|
|
exp?: number;
|
|
}
|
|
|
|
interface IProps {
|
|
name: string | React.ReactElement;
|
|
color: string;
|
|
data?: ITableRowData;
|
|
children?: React.ReactElement;
|
|
}
|
|
|
|
export const StatsRow = ({ name, color, children, data }: IProps): React.ReactElement => {
|
|
const { classes } = useStyles();
|
|
|
|
let content = "";
|
|
if (data) {
|
|
if (data.content !== undefined) {
|
|
content = data.content;
|
|
} else if (data.level !== undefined && data.exp !== undefined) {
|
|
content = `${formatSkill(data.level)} (${formatExp(data.exp)} exp)`;
|
|
} else if (data.level !== undefined && data.exp === undefined) {
|
|
content = `${formatSkill(data.level)}`;
|
|
}
|
|
}
|
|
|
|
return (
|
|
<TableRow>
|
|
<TableCell classes={{ root: classes.cellNone }}>
|
|
<Typography style={{ color: color }}>{name}</Typography>
|
|
</TableCell>
|
|
<TableCell align="right" classes={{ root: classes.cellNone }}>
|
|
{content && <Typography style={{ color: color }}>{content}</Typography>}
|
|
{children}
|
|
</TableCell>
|
|
</TableRow>
|
|
);
|
|
};
|