Files
bitburner-src/src/ui/React/StatsRow.tsx
T
catloversg e6078ab1df UI: Change description and add tooltip for HackMoney-related multipliers (#1823)
* UI: Change description and add tooltip for HackMoney-related multipliers

* Update based on feedback
2024-12-18 02:51:25 -08:00

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>
);
};