diff --git a/src/ui/WorkInProgressRoot.tsx b/src/ui/WorkInProgressRoot.tsx
index 3e009726e..7f64832b1 100644
--- a/src/ui/WorkInProgressRoot.tsx
+++ b/src/ui/WorkInProgressRoot.tsx
@@ -1,24 +1,27 @@
-import { Box, Container, Paper, Table, TableBody, Tooltip } from "@mui/material";
+import React from "react";
+
+import { Box, Container, Paper, Table, TableBody, TableRow, TableCell, Tooltip } from "@mui/material";
import Button from "@mui/material/Button";
import Typography from "@mui/material/Typography";
-import { uniqueId } from "lodash";
-import React from "react";
-import { Companies } from "../Company/Companies";
-import { CONSTANTS } from "../Constants";
-import { FactionWorkType, LocationName } from "@enums";
-import { Locations } from "../Locations/Locations";
-import { Settings } from "../Settings/Settings";
-import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
+
import { Player } from "@player";
-import { Router } from "./GameRoot";
-import { Page } from "./Router";
-import { formatExp, formatPercent } from "./formatNumber";
+import { FactionWorkType, LocationName } from "@enums";
+
import { Money } from "./React/Money";
import { MoneyRate } from "./React/MoneyRate";
import { ProgressBar } from "./React/Progress";
import { Reputation } from "./React/Reputation";
import { ReputationRate } from "./React/ReputationRate";
import { StatsRow } from "./React/StatsRow";
+import { useRerender } from "./React/hooks";
+
+import { Companies } from "../Company/Companies";
+import { CONSTANTS } from "../Constants";
+import { Locations } from "../Locations/Locations";
+import { Settings } from "../Settings/Settings";
+import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
+import { filterTruthy } from "../utils/helpers/ArrayHelpers";
+
import { isCrimeWork } from "../Work/CrimeWork";
import { isClassWork } from "../Work/ClassWork";
import { WorkStats } from "../Work/WorkStats";
@@ -26,7 +29,9 @@ import { isCreateProgramWork } from "../Work/CreateProgramWork";
import { isGraftingWork } from "../Work/GraftingWork";
import { isFactionWork } from "../Work/FactionWork";
import { isCompanyWork } from "../Work/CompanyWork";
-import { useRerender } from "./React/hooks";
+import { Router } from "./GameRoot";
+import { Page } from "./Router";
+import { formatExp, formatPercent } from "./formatNumber";
const CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle;
@@ -38,7 +43,7 @@ interface IWorkInfo {
title: string | React.ReactElement;
description?: string | React.ReactElement;
- gains?: (string | React.ReactElement)[];
+ gains?: React.ReactElement[];
progress?: {
elapsed?: number;
remaining?: number;
@@ -50,146 +55,134 @@ interface IWorkInfo {
}
function ExpRows(rate: WorkStats): React.ReactElement[] {
- return [
- rate.hackExp > 0 ? (
+ return filterTruthy([
+ rate.hackExp > 0 && (
- ) : (
- <>>
),
- rate.strExp > 0 ? (
+ rate.strExp > 0 && (
- ) : (
- <>>
),
- rate.defExp > 0 ? (
+ rate.defExp > 0 && (
- ) : (
- <>>
),
- rate.dexExp > 0 ? (
+ rate.dexExp > 0 && (
- ) : (
- <>>
),
- rate.agiExp > 0 ? (
+ rate.agiExp > 0 && (
- ) : (
- <>>
),
- rate.chaExp > 0 ? (
+ rate.chaExp > 0 && (
- ) : (
- <>>
),
- ];
+ ]);
}
/* Because crime exp is given all at once at the end, we don't care about the cycles per second. */
function CrimeExpRows(rate: WorkStats): React.ReactElement[] {
- return [
- rate.hackExp > 0 ? (
+ return filterTruthy([
+ rate.hackExp > 0 && (
- ) : (
- <>>
),
- rate.strExp > 0 ? (
+ rate.strExp > 0 && (
- ) : (
- <>>
),
- rate.defExp > 0 ? (
+ rate.defExp > 0 && (
- ) : (
- <>>
),
- rate.dexExp > 0 ? (
+ rate.dexExp > 0 && (
- ) : (
- <>>
),
- rate.agiExp > 0 ? (
+ rate.agiExp > 0 && (
- ) : (
- <>>
),
- rate.chaExp > 0 ? (
+ rate.chaExp > 0 && (
- ) : (
- <>>
),
- ];
+ ]);
}
export function WorkInProgressRoot(): React.ReactElement {
@@ -227,9 +220,15 @@ export function WorkInProgressRoot(): React.ReactElement {
title: `You are attempting ${crime.workName}`,
gains: [
- Success chance: {formatPercent(successChance)},
- Gains (on success),
-
+
+
+ Success chance: ${formatPercent(successChance)}
+
+
+ Gains (on success)
+
+ ,
+
@@ -274,7 +273,7 @@ export function WorkInProgressRoot(): React.ReactElement {
),
gains: [
-
+
()
@@ -451,12 +450,12 @@ export function WorkInProgressRoot(): React.ReactElement {
>
),
gains: [
-
+
,
-
+
@@ -492,11 +491,7 @@ export function WorkInProgressRoot(): React.ReactElement {
{workInfo.description}
{workInfo.gains && (
-
- {workInfo.gains.map((row) => (
- {row}
- ))}
-
+ {workInfo.gains}
)}