move modals to a modals folder

This commit is contained in:
phyzical 2022-04-01 21:55:23 +08:00
parent 2efa3ac351
commit 60f56a55ab
28 changed files with 254 additions and 207 deletions

@ -8,8 +8,8 @@ import { EmployeePositions } from "../EmployeePositions";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { UpgradeOfficeSizeModal } from "./UpgradeOfficeSizeModal"; import { UpgradeOfficeSizeModal } from "./modals/UpgradeOfficeSizeModal";
import { ThrowPartyModal } from "./ThrowPartyModal"; import { ThrowPartyModal } from "./modals/ThrowPartyModal";
import { Money } from "../../ui/React/Money"; import { Money } from "../../ui/React/Money";
import { useCorporation, useDivision } from "./Context"; import { useCorporation, useDivision } from "./Context";

@ -7,8 +7,8 @@ import { Industries } from "../IndustryData";
import { IndustryUpgrades } from "../IndustryUpgrades"; import { IndustryUpgrades } from "../IndustryUpgrades";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText";
import { MakeProductModal } from "./MakeProductModal"; import { MakeProductModal } from "./modals/MakeProductModal";
import { ResearchModal } from "./ResearchModal"; import { ResearchModal } from "./modals/ResearchModal";
import { Money } from "../../ui/React/Money"; import { Money } from "../../ui/React/Money";
import { MoneyRate } from "../../ui/React/MoneyRate"; import { MoneyRate } from "../../ui/React/MoneyRate";
import { StatsTable } from "../../ui/React/StatsTable"; import { StatsTable } from "../../ui/React/StatsTable";

@ -6,7 +6,7 @@ import { CorporationConstants } from "../data/Constants";
import { Material } from "../Material"; import { Material } from "../Material";
import { Product } from "../Product"; import { Product } from "../Product";
import { Warehouse } from "../Warehouse"; import { Warehouse } from "../Warehouse";
import { SmartSupplyModal } from "./SmartSupplyModal"; import { SmartSupplyModal } from "./modals/SmartSupplyModal";
import { ProductElem } from "./ProductElem"; import { ProductElem } from "./ProductElem";
import { MaterialElem } from "./MaterialElem"; import { MaterialElem } from "./MaterialElem";
import { MaterialSizes } from "../MaterialSizes"; import { MaterialSizes } from "../MaterialSizes";
@ -42,9 +42,9 @@ interface IProps {
const useStyles = makeStyles(() => const useStyles = makeStyles(() =>
createStyles({ createStyles({
retainHeight: { retainHeight: {
minHeight: '3em', minHeight: "3em",
}, },
}) }),
); );
function WarehouseRoot(props: IProps): React.ReactElement { function WarehouseRoot(props: IProps): React.ReactElement {
@ -127,27 +127,53 @@ function WarehouseRoot(props: IProps): React.ReactElement {
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;
breakdownItems.push(<>{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}</>); breakdownItems.push(
<>
{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}
</>,
);
} }
for (const prodName of Object.keys(division.products)) { for (const prodName of Object.keys(division.products)) {
const prod = division.products[prodName]; const prod = division.products[prodName];
if (prod === undefined) continue; if (prod === undefined) continue;
breakdownItems.push(<>{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}</>); breakdownItems.push(
<>
{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}
</>,
);
} }
let breakdown; let breakdown;
if (breakdownItems && breakdownItems.length > 0) { if (breakdownItems && breakdownItems.length > 0) {
breakdown = breakdownItems.reduce( breakdown = breakdownItems.reduce(
(previous: JSX.Element, current: JSX.Element): JSX.Element => previous && <>{previous}<br />{current}</> || <>{current}</>); (previous: JSX.Element, current: JSX.Element): JSX.Element =>
(previous && (
<>
{previous}
<br />
{current}
</>
)) || <>{current}</>,
);
} else { } else {
breakdown = <>No items in storage.</> breakdown = <>No items in storage.</>;
} }
return ( return (
<Paper> <Paper>
<Box display="flex" alignItems="center"> <Box display="flex" alignItems="center">
<Tooltip title={props.warehouse.sizeUsed !== 0 ? <Typography><>{breakdown}</></Typography> : ""}> <Tooltip
title={
props.warehouse.sizeUsed !== 0 ? (
<Typography>
<>{breakdown}</>
</Typography>
) : (
""
)
}
>
<Typography color={props.warehouse.sizeUsed >= props.warehouse.size ? "error" : "primary"}> <Typography color={props.warehouse.sizeUsed >= props.warehouse.size ? "error" : "primary"}>
Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "} Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "}
{numeralWrapper.formatBigNumber(props.warehouse.size)} {numeralWrapper.formatBigNumber(props.warehouse.size)}

@ -5,10 +5,10 @@ import React, { useState } from "react";
import { OfficeSpace } from "../OfficeSpace"; import { OfficeSpace } from "../OfficeSpace";
import { Material } from "../Material"; import { Material } from "../Material";
import { Warehouse } from "../Warehouse"; import { Warehouse } from "../Warehouse";
import { ExportModal } from "./ExportModal"; import { ExportModal } from "./modals/ExportModal";
import { MaterialMarketTaModal } from "./MaterialMarketTaModal"; import { MaterialMarketTaModal } from "./modals/MaterialMarketTaModal";
import { SellMaterialModal } from "./SellMaterialModal"; import { SellMaterialModal } from "./modals/SellMaterialModal";
import { PurchaseMaterialModal } from "./PurchaseMaterialModal"; import { PurchaseMaterialModal } from "./modals/PurchaseMaterialModal";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
@ -37,6 +37,8 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
const [exportOpen, setExportOpen] = useState(false); const [exportOpen, setExportOpen] = useState(false);
const [sellMaterialOpen, setSellMaterialOpen] = useState(false); const [sellMaterialOpen, setSellMaterialOpen] = useState(false);
const [materialMarketTaOpen, setMaterialMarketTaOpen] = useState(false); const [materialMarketTaOpen, setMaterialMarketTaOpen] = useState(false);
const [limitProductionOpen, setLimitProductionOpen] = useState(false);
const warehouse = props.warehouse; const warehouse = props.warehouse;
const city = props.city; const city = props.city;
const mat = props.mat; const mat = props.mat;
@ -112,7 +114,7 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
return ( return (
<Paper> <Paper>
<Box sx={{ display: 'grid', gridTemplateColumns: '2fr 1fr', m: '5px' }}> <Box sx={{ display: "grid", gridTemplateColumns: "2fr 1fr", m: "5px" }}>
<Box> <Box>
<Tooltip <Tooltip
title={ title={
@ -149,7 +151,7 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
</Tooltip> </Tooltip>
</Box> </Box>
<Box sx={{ "& button": { width: '100%' } }}> <Box sx={{ "& button": { width: "100%" } }}>
<Tooltip <Tooltip
title={tutorial ? <Typography>Purchase your required materials to get production started!</Typography> : ""} title={tutorial ? <Typography>Purchase your required materials to get production started!</Typography> : ""}
> >

@ -2,13 +2,13 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { LevelableUpgrade } from "./LevelableUpgrade"; import { LevelableUpgrade } from "./LevelableUpgrade";
import { UnlockUpgrade } from "./UnlockUpgrade"; import { UnlockUpgrade } from "./UnlockUpgrade";
import { BribeFactionModal } from "./BribeFactionModal"; import { BribeFactionModal } from "./modals/BribeFactionModal";
import { SellSharesModal } from "./SellSharesModal"; import { SellSharesModal } from "./modals/SellSharesModal";
import { BuybackSharesModal } from "./BuybackSharesModal"; import { BuybackSharesModal } from "./modals/BuybackSharesModal";
import { IssueDividendsModal } from "./IssueDividendsModal"; import { IssueDividendsModal } from "./modals/IssueDividendsModal";
import { IssueNewSharesModal } from "./IssueNewSharesModal"; import { IssueNewSharesModal } from "./modals/IssueNewSharesModal";
import { FindInvestorsModal } from "./FindInvestorsModal"; import { FindInvestorsModal } from "./modals/FindInvestorsModal";
import { GoPublicModal } from "./GoPublicModal"; import { GoPublicModal } from "./modals/GoPublicModal";
import { Factions } from "../../Faction/Factions"; import { Factions } from "../../Faction/Factions";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../data/Constants";
@ -89,7 +89,7 @@ export function Overview({ rerender }: IProps): React.ReactElement {
<StatsTable rows={multRows} /> <StatsTable rows={multRows} />
<br /> <br />
<BonusTime /> <BonusTime />
<Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', width: 'fit-content' }}> <Box sx={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", width: "fit-content" }}>
<Tooltip <Tooltip
title={ title={
<Typography> <Typography>

@ -2,10 +2,10 @@ import React, { useState } from "react";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../data/Constants";
import { Product } from "../Product"; import { Product } from "../Product";
import { DiscontinueProductModal } from "./DiscontinueProductModal"; import { DiscontinueProductModal } from "./modals/DiscontinueProductModal";
import { LimitProductProductionModal } from "./LimitProductProductionModal"; import { LimitProductProductionModal } from "./modals/LimitProductProductionModal";
import { SellProductModal } from "./SellProductModal"; import { SellProductModal } from "./modals/SellProductModal";
import { ProductMarketTaModal } from "./ProductMarketTaModal"; import { ProductMarketTaModal } from "./modals/ProductMarketTaModal";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";

@ -1,11 +1,11 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Factions } from "../../Faction/Factions"; import { Factions } from "../../../Faction/Factions";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { use } from "../../ui/Context"; import { use } from "../../../ui/Context";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";

@ -1,14 +1,14 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { use } from "../../ui/Context"; import { use } from "../../../ui/Context";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import { BuyBackShares } from '../Actions'; import { BuyBackShares } from "../../Actions";
import { dialogBoxCreate } from '../../ui/React/DialogBox'; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;
@ -40,9 +40,8 @@ export function BuybackSharesModal(props: IProps): React.ReactElement {
function buy(): void { function buy(): void {
if (disabled) return; if (disabled) return;
try { try {
BuyBackShares(corp, player, shares) BuyBackShares(corp, player, shares);
} } catch (err) {
catch (err) {
dialogBoxCreate(err + ""); dialogBoxCreate(err + "");
} }
props.onClose(); props.onClose();

@ -1,8 +1,8 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Money } from "../../ui/React/Money"; import { Money } from "../../../ui/React/Money";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { use } from "../../ui/Context"; import { use } from "../../../ui/Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
@ -56,9 +56,11 @@ export function CreateCorporationModal(props: IProps): React.ReactElement {
return ( return (
<Modal open={props.open} onClose={props.onClose}> <Modal open={props.open} onClose={props.onClose}>
<Typography> <Typography>
Would you like to start a corporation? This will require $150b for registration and initial funding. {player.bitNodeN === 3 && (`This $150b Would you like to start a corporation? This will require $150b for registration and initial funding.{" "}
{player.bitNodeN === 3 &&
`This $150b
can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million
shares`)} shares`}
<br /> <br />
<br /> <br />
If you would like to start one, please enter a name for your corporation below: If you would like to start one, please enter a name for your corporation below:

@ -1,8 +1,8 @@
import React from "react"; import React from "react";
import { Product } from "../Product"; import { Product } from "../../Product";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useDivision } from "./Context"; import { useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";

@ -1,12 +1,12 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Material } from "../Material"; import { Material } from "../../Material";
import { Export } from "../Export"; import { Export } from "../../Export";
import { IIndustry } from "../IIndustry"; import { IIndustry } from "../../IIndustry";
import { ExportMaterial } from "../Actions"; import { ExportMaterial } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import { isRelevantMaterial } from "./Helpers"; import { isRelevantMaterial } from "../Helpers";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
@ -23,7 +23,9 @@ interface IProps {
// Create a popup that lets the player manage exports // Create a popup that lets the player manage exports
export function ExportModal(props: IProps): React.ReactElement { export function ExportModal(props: IProps): React.ReactElement {
const corp = useCorporation(); const corp = useCorporation();
const possibleDivisions = corp.divisions.filter((division: IIndustry) => isRelevantMaterial(props.mat.name, division)); const possibleDivisions = corp.divisions.filter((division: IIndustry) =>
isRelevantMaterial(props.mat.name, division),
);
if (possibleDivisions.length === 0) throw new Error("Export popup created with no divisions."); if (possibleDivisions.length === 0) throw new Error("Export popup created with no divisions.");
const defaultDivision = possibleDivisions[0]; const defaultDivision = possibleDivisions[0];
if (Object.keys(defaultDivision.warehouses).length === 0) if (Object.keys(defaultDivision.warehouses).length === 0)

@ -1,8 +1,8 @@
import React from "react"; import React from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
@ -17,7 +17,11 @@ interface IProps {
export function FindInvestorsModal(props: IProps): React.ReactElement { export function FindInvestorsModal(props: IProps): React.ReactElement {
const corporation = useCorporation(); const corporation = useCorporation();
const val = corporation.determineValuation(); const val = corporation.determineValuation();
if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) return <></>; if (
corporation.fundingRound >= CorporationConstants.FundingRoundShares.length ||
corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length
)
return <></>;
const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound];
const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound];
const funding = val * percShares * roundMultiplier; const funding = val * percShares * roundMultiplier;

@ -1,13 +1,13 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;

@ -1,13 +1,13 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { IssueDividends } from "../Actions"; import { IssueDividends } from "../../Actions";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;

@ -1,14 +1,14 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { getRandomInt } from "../../utils/helpers/getRandomInt"; import { getRandomInt } from "../../../utils/helpers/getRandomInt";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IEffectTextProps { interface IEffectTextProps {
shares: number | null; shares: number | null;

@ -1,11 +1,11 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Product } from "../Product"; import { Product } from "../../Product";
import { LimitProductProduction } from "../Actions"; import { LimitProductProduction } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;

@ -1,15 +1,15 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { Industries } from "../IndustryData"; import { Industries } from "../../IndustryData";
import { MakeProduct } from "../Actions"; import { MakeProduct } from "../../Actions";
import { useCorporation, useDivision } from "./Context"; import { useCorporation, useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
import Select, { SelectChangeEvent } from "@mui/material/Select"; import Select, { SelectChangeEvent } from "@mui/material/Select";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;

@ -1,8 +1,8 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { Material } from "../Material"; import { Material } from "../../Material";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useDivision } from "./Context"; import { useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";

@ -1,8 +1,8 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { Product } from "../Product"; import { Product } from "../../Product";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useDivision } from "./Context"; import { useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";

@ -1,16 +1,16 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { MaterialSizes } from "../MaterialSizes"; import { MaterialSizes } from "../../MaterialSizes";
import { Warehouse } from "../Warehouse"; import { Warehouse } from "../../Warehouse";
import { Material } from "../Material"; import { Material } from "../../Material";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { BulkPurchase, BuyMaterial } from "../Actions"; import { BulkPurchase, BuyMaterial } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useCorporation, useDivision } from "./Context"; import { useCorporation, useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IBulkPurchaseTextProps { interface IBulkPurchaseTextProps {
warehouse: Warehouse; warehouse: Warehouse;

@ -1,13 +1,13 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { IndustryResearchTrees } from "../IndustryData"; import { IndustryResearchTrees } from "../../IndustryData";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { IIndustry } from "../IIndustry"; import { IIndustry } from "../../IIndustry";
import { Research } from "../Actions"; import { Research } from "../../Actions";
import { Node } from "../ResearchTree"; import { Node } from "../../ResearchTree";
import { ResearchMap } from "../ResearchMap"; import { ResearchMap } from "../../ResearchMap";
import { Settings } from "../../Settings/Settings"; import { Settings } from "../../../Settings/Settings";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
@ -16,7 +16,7 @@ import Box from "@mui/material/Box";
import Collapse from "@mui/material/Collapse"; import Collapse from "@mui/material/Collapse";
import ExpandMore from "@mui/icons-material/ExpandMore"; import ExpandMore from "@mui/icons-material/ExpandMore";
import ExpandLess from "@mui/icons-material/ExpandLess"; import ExpandLess from "@mui/icons-material/ExpandLess";
import CheckIcon from '@mui/icons-material/Check'; import CheckIcon from "@mui/icons-material/Check";
interface INodeProps { interface INodeProps {
n: Node | null; n: Node | null;
@ -66,19 +66,23 @@ function Upgrade({ n, division }: INodeProps): React.ReactElement {
> >
{ele} {ele}
</Tooltip> </Tooltip>
) );
} };
const but = ( const but = (
<Box> <Box>
{wrapInTooltip( {wrapInTooltip(
<span> <span>
<Button color={color} disabled={disabled && !n.researched} onClick={research} <Button
style={{ width: '100%', textAlign: 'left', justifyContent: 'unset' }} color={color}
disabled={disabled && !n.researched}
onClick={research}
style={{ width: "100%", textAlign: "left", justifyContent: "unset" }}
> >
{n.researched && (<CheckIcon sx={{ mr: 1 }} />)}{n.text} {n.researched && <CheckIcon sx={{ mr: 1 }} />}
{n.text}
</Button> </Button>
</span> </span>,
)} )}
</Box> </Box>
); );
@ -87,20 +91,29 @@ function Upgrade({ n, division }: INodeProps): React.ReactElement {
return ( return (
<Box> <Box>
<Box display="flex" sx={{ border: '1px solid ' + Settings.theme.well }}> <Box display="flex" sx={{ border: "1px solid " + Settings.theme.well }}>
{wrapInTooltip( {wrapInTooltip(
<span style={{ width: '100%' }}> <span style={{ width: "100%" }}>
<Button color={color} disabled={disabled && !n.researched} onClick={research} sx={{ <Button
width: '100%', color={color}
textAlign: 'left', disabled={disabled && !n.researched}
justifyContent: 'unset', onClick={research}
borderColor: Settings.theme.button sx={{
}}> width: "100%",
{n.researched && (<CheckIcon sx={{ mr: 1 }} />)}{n.text} textAlign: "left",
justifyContent: "unset",
borderColor: Settings.theme.button,
}}
>
{n.researched && <CheckIcon sx={{ mr: 1 }} />}
{n.text}
</Button> </Button>
</span> </span>,
)} )}
<Button onClick={() => setOpen((old) => !old)} sx={{ borderColor: Settings.theme.button, minWidth: 'fit-content' }}> <Button
onClick={() => setOpen((old) => !old)}
sx={{ borderColor: Settings.theme.button, minWidth: "fit-content" }}
>
{open ? <ExpandLess color="primary" /> : <ExpandMore color="primary" />} {open ? <ExpandLess color="primary" /> : <ExpandMore color="primary" />}
</Button> </Button>
</Box> </Box>

@ -1,12 +1,12 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Material } from "../Material"; import { Material } from "../../Material";
import { SellMaterial } from "../Actions"; import { SellMaterial } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
function initialPrice(mat: Material): string { function initialPrice(mat: Material): string {
let val = mat.sCost ? mat.sCost + "" : ""; let val = mat.sCost ? mat.sCost + "" : "";

@ -1,15 +1,15 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Product } from "../Product"; import { Product } from "../../Product";
import { SellProduct } from "../Actions"; import { SellProduct } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
import Switch from "@mui/material/Switch"; import Switch from "@mui/material/Switch";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
function initialPrice(product: Product): string { function initialPrice(product: Product): string {
let val = product.sCost ? product.sCost + "" : ""; let val = product.sCost ? product.sCost + "" : "";

@ -1,16 +1,16 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { use } from "../../ui/Context"; import { use } from "../../../ui/Context";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import { ICorporation } from "../ICorporation"; import { ICorporation } from "../../ICorporation";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { Money } from "../../ui/React/Money"; import { Money } from "../../../ui/React/Money";
import { SellShares } from "../Actions"; import { SellShares } from "../../Actions";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
@ -51,7 +51,7 @@ export function SellSharesModal(props: IProps): React.ReactElement {
function sell(): void { function sell(): void {
if (disabled) return; if (disabled) return;
try { try {
const profit = SellShares(corp, player, shares) const profit = SellShares(corp, player, shares);
props.onClose(); props.onClose();
dialogBoxCreate( dialogBoxCreate(
<> <>
@ -65,7 +65,6 @@ export function SellSharesModal(props: IProps): React.ReactElement {
} catch (err) { } catch (err) {
dialogBoxCreate(err + ""); dialogBoxCreate(err + "");
} }
} }
function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void { function onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {

@ -1,11 +1,11 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Warehouse } from "../Warehouse"; import { Warehouse } from "../../Warehouse";
import { SetSmartSupply, SetSmartSupplyUseLeftovers } from "../Actions"; import { SetSmartSupply, SetSmartSupplyUseLeftovers } from "../../Actions";
import { Material } from "../Material"; import { Material } from "../../Material";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useDivision } from "./Context"; import { useDivision } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
import Switch from "@mui/material/Switch"; import Switch from "@mui/material/Switch";

@ -1,16 +1,16 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { OfficeSpace } from "../OfficeSpace"; import { OfficeSpace } from "../../OfficeSpace";
import { ThrowParty } from "../Actions"; import { ThrowParty } from "../../Actions";
import { Money } from "../../ui/React/Money"; import { Money } from "../../../ui/React/Money";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../../utils/helpers/keyCodes";
interface IProps { interface IProps {
open: boolean; open: boolean;

@ -1,11 +1,11 @@
import React from "react"; import React from "react";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../../ui/numeralFormat";
import { CorporationConstants } from "../data/Constants"; import { CorporationConstants } from "../../data/Constants";
import { OfficeSpace } from "../OfficeSpace"; import { OfficeSpace } from "../../OfficeSpace";
import { ICorporation } from "../ICorporation"; import { ICorporation } from "../../ICorporation";
import { UpgradeOfficeSize } from "../Actions"; import { UpgradeOfficeSize } from "../../Actions";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../../ui/React/Modal";
import { useCorporation } from "./Context"; import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";

@ -15,7 +15,7 @@ import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { Location } from "../Location"; import { Location } from "../Location";
import { CreateCorporationModal } from "../../Corporation/ui/CreateCorporationModal"; import { CreateCorporationModal } from "../../Corporation/ui/modals/CreateCorporationModal";
import { LocationName } from "../data/LocationNames"; import { LocationName } from "../data/LocationNames";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { Factions } from "../../Faction/Factions"; import { Factions } from "../../Faction/Factions";