Merge pull request #2251 from MartinFournier/fix/corp-storage-tooltip

Fix #2129: Add linebreaks in corp storage tooltips
This commit is contained in:
hydroflame 2022-01-02 11:37:45 -05:00 committed by GitHub
commit d53b87b8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -108,31 +108,22 @@ function WarehouseRoot(props: IProps): React.ReactElement {
} }
} }
let breakdown = <></>; const breakdownItems: string[] = [];
for (const matName in props.warehouse.materials) { for (const matName in props.warehouse.materials) {
const mat = props.warehouse.materials[matName]; const mat = props.warehouse.materials[matName];
if (!MaterialSizes.hasOwnProperty(matName)) continue; if (!MaterialSizes.hasOwnProperty(matName)) continue;
if (mat.qty === 0) continue; if (mat.qty === 0) continue;
breakdown = ( breakdownItems.push(`${matName}: ${numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}`);
<>
{breakdown}
{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}
<br />
</>
);
} }
for (const prodName in division.products) { for (const prodName in division.products) {
const prod = division.products[prodName]; const prod = division.products[prodName];
if (prod === undefined) continue; if (prod === undefined) continue;
breakdown = ( breakdownItems.push(`${prodName}: ${numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}`);
<>
{breakdown}
{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}
</>
);
} }
const breakdown = <>{breakdownItems.join('<br />')}</>
return ( return (
<Paper> <Paper>
<Box display="flex" alignItems="center"> <Box display="flex" alignItems="center">