mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
Align columns in warehouse storage breakdown (#970)
This commit is contained in:
parent
e096456c29
commit
1dac133ef4
@ -22,6 +22,7 @@ import { purchaseWarehouse } from "../Actions";
|
|||||||
import { useCorporation, useDivision } from "./Context";
|
import { useCorporation, useDivision } from "./Context";
|
||||||
import { gameCyclesPerCorpStateCycle } from "../data/Constants";
|
import { gameCyclesPerCorpStateCycle } from "../data/Constants";
|
||||||
import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip";
|
import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip";
|
||||||
|
import { StatsTable } from "../../ui/React/StatsTable";
|
||||||
|
|
||||||
interface WarehouseProps {
|
interface WarehouseProps {
|
||||||
corp: Corporation;
|
corp: Corporation;
|
||||||
@ -95,25 +96,21 @@ function WarehouseRoot(props: WarehouseProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const breakdownItems: string[] = [];
|
const breakdownItems: string[][] = [];
|
||||||
for (const matName of corpConstants.materialNames) {
|
for (const matName of corpConstants.materialNames) {
|
||||||
const mat = props.warehouse.materials[matName];
|
const mat = props.warehouse.materials[matName];
|
||||||
if (mat.stored === 0) continue;
|
if (mat.stored === 0) continue;
|
||||||
breakdownItems.push(`${matName}: ${formatMaterialSize(mat.stored * MaterialInfo[matName].size)}`);
|
breakdownItems.push([`${matName}:`, `${formatMaterialSize(mat.stored * MaterialInfo[matName].size)}`]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [prodName, product] of division.products) {
|
for (const [prodName, product] of division.products) {
|
||||||
breakdownItems.push(
|
breakdownItems.push([
|
||||||
`${prodName}: ${formatMaterialSize(product.cityData[props.currentCity].stored * product.size)}`,
|
`${prodName}:`,
|
||||||
);
|
`${formatMaterialSize(product.cityData[props.currentCity].stored * product.size)}`,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let breakdown;
|
const breakdown = breakdownItems.length > 0 ? <StatsTable rows={breakdownItems} /> : <>No items in storage.</>;
|
||||||
if (breakdownItems.length > 0) {
|
|
||||||
breakdown = breakdownItems.map((item, i) => <p key={i}>{item}</p>);
|
|
||||||
} else {
|
|
||||||
breakdown = <>No items in storage.</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper>
|
<Paper>
|
||||||
|
Loading…
Reference in New Issue
Block a user