mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-05 15:17:48 +02:00
BLADEBURNER: Typesafety / refactoring (#1154)
This commit is contained in:
@@ -1,33 +1,26 @@
|
||||
import type { ActionIdentifier } from "../../Bladeburner/Types";
|
||||
|
||||
// Root React Component for the Corporation UI
|
||||
import React, { useMemo, useState, useEffect, ReactNode } from "react";
|
||||
|
||||
import { Box, Button, IconButton, Table, TableBody, TableCell, TableRow, Tooltip, Typography } from "@mui/material";
|
||||
import SaveIcon from "@mui/icons-material/Save";
|
||||
import ClearAllIcon from "@mui/icons-material/ClearAll";
|
||||
import { Theme, useTheme } from "@mui/material/styles";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
|
||||
import { Player } from "@player";
|
||||
import { formatHp, formatMoney, formatSkill } from "../formatNumber";
|
||||
import { Reputation } from "./Reputation";
|
||||
import { KillScriptsModal } from "./KillScriptsModal";
|
||||
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
|
||||
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import SaveIcon from "@mui/icons-material/Save";
|
||||
import ClearAllIcon from "@mui/icons-material/ClearAll";
|
||||
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { Router } from "../GameRoot";
|
||||
import { Page } from "../Router";
|
||||
import { Player } from "@player";
|
||||
import { StatsProgressOverviewCell } from "./StatsProgressBar";
|
||||
import { currentNodeMults } from "../../BitNode/BitNodeMultipliers";
|
||||
|
||||
import { Box, Tooltip } from "@mui/material";
|
||||
|
||||
import { isClassWork } from "../../Work/ClassWork";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { isCreateProgramWork } from "../../Work/CreateProgramWork";
|
||||
@@ -36,7 +29,6 @@ import { isFactionWork } from "../../Work/FactionWork";
|
||||
import { ReputationRate } from "./ReputationRate";
|
||||
import { isCompanyWork } from "../../Work/CompanyWork";
|
||||
import { isCrimeWork } from "../../Work/CrimeWork";
|
||||
import { ActionIdentifier } from "../../Bladeburner/ActionIdentifier";
|
||||
import { Skills } from "../../PersonObjects/Skills";
|
||||
import { calculateSkillProgress } from "../../PersonObjects/formulas/skill";
|
||||
import { EventEmitter } from "../../utils/EventEmitter";
|
||||
@@ -240,10 +232,9 @@ export function CharacterOverview({ parentOpen, save, killScripts }: OverviewPro
|
||||
);
|
||||
}
|
||||
|
||||
function ActionText(props: { action: ActionIdentifier }): React.ReactElement {
|
||||
function ActionText({ action }: { action: ActionIdentifier }): React.ReactElement {
|
||||
const bladeburner = Player.bladeburner;
|
||||
if (!bladeburner) return <></>;
|
||||
const action = bladeburner.getTypeAndNameFromActionId(props.action);
|
||||
return (
|
||||
<Typography>
|
||||
{action.type}: {action.name}
|
||||
@@ -262,9 +253,7 @@ function BladeburnerText(): React.ReactElement {
|
||||
const action = Player.bladeburner?.action;
|
||||
return useMemo(
|
||||
() =>
|
||||
//Action type 1 is Idle, see ActionTypes.ts
|
||||
//TODO 2.3: Revamp typing in bladeburner
|
||||
!action || action.type === 1 ? (
|
||||
!action ? (
|
||||
<></>
|
||||
) : (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user