remove more prop chaining

This commit is contained in:
Snarling 2022-08-20 19:14:54 -04:00
parent 0f15431b5f
commit 7578860ce7
3 changed files with 4 additions and 6 deletions

@ -10,6 +10,7 @@ import { getStockMarket4SDataCost, getStockMarket4STixApiCost } from "../StockMa
import { CONSTANTS } from "../../Constants"; import { CONSTANTS } from "../../Constants";
import { IPlayer } from "../../PersonObjects/IPlayer"; import { IPlayer } from "../../PersonObjects/IPlayer";
import { Money } from "../../ui/React/Money"; import { Money } from "../../ui/React/Money";
import { initStockMarket } from "../StockMarket";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Link from "@mui/material/Link"; import Link from "@mui/material/Link";
@ -22,7 +23,6 @@ import { StaticModal } from "../../ui/React/StaticModal";
import { FactionNames } from "../../Faction/data/FactionNames"; import { FactionNames } from "../../Faction/data/FactionNames";
type IProps = { type IProps = {
initStockMarket: () => void;
p: IPlayer; p: IPlayer;
rerender: () => void; rerender: () => void;
}; };
@ -88,7 +88,7 @@ function PurchaseWseAccountButton(props: IProps): React.ReactElement {
return; return;
} }
props.p.hasWseAccount = true; props.p.hasWseAccount = true;
props.initStockMarket(); initStockMarket();
props.p.loseMoney(CONSTANTS.WSEAccountCost, "stock"); props.p.loseMoney(CONSTANTS.WSEAccountCost, "stock");
props.rerender(); props.rerender();
} }

@ -11,7 +11,6 @@ import { IStockMarket } from "../IStockMarket";
import { IPlayer } from "../../PersonObjects/IPlayer"; import { IPlayer } from "../../PersonObjects/IPlayer";
type IProps = { type IProps = {
initStockMarket: () => void;
p: IPlayer; p: IPlayer;
stockMarket: IStockMarket; stockMarket: IStockMarket;
}; };
@ -28,7 +27,7 @@ export function StockMarketRoot(props: IProps): React.ReactElement {
}, []); }, []);
return ( return (
<> <>
<InfoAndPurchases initStockMarket={props.initStockMarket} p={props.p} rerender={rerender} /> <InfoAndPurchases p={props.p} rerender={rerender} />
{props.p.hasWseAccount && ( {props.p.hasWseAccount && (
<StockTickers p={props.p} stockMarket={props.stockMarket} /> <StockTickers p={props.p} stockMarket={props.stockMarket} />
)} )}

@ -17,7 +17,7 @@ import { prestigeAugmentation } from "../Prestige";
import { dialogBoxCreate } from "./React/DialogBox"; import { dialogBoxCreate } from "./React/DialogBox";
import { GetAllServers } from "../Server/AllServers"; import { GetAllServers } from "../Server/AllServers";
import { Factions } from "../Faction/Factions"; import { Factions } from "../Faction/Factions";
import { initStockMarketFn, StockMarket } from "../StockMarket/StockMarket"; import { StockMarket } from "../StockMarket/StockMarket";
import { Theme } from "@mui/material/styles"; import { Theme } from "@mui/material/styles";
import makeStyles from "@mui/styles/makeStyles"; import makeStyles from "@mui/styles/makeStyles";
@ -437,7 +437,6 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
case Page.StockMarket: { case Page.StockMarket: {
mainPage = ( mainPage = (
<StockMarketRoot <StockMarketRoot
initStockMarket={initStockMarketFn}
p={player} p={player}
stockMarket={StockMarket} stockMarket={StockMarket}
/> />