mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 10:13:52 +01:00
fix text for sell shares modal text
This commit is contained in:
parent
4224c7defd
commit
9e39ca32a5
@ -33,21 +33,22 @@ export function SellSharesModal(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
function ProfitIndicator(props: { shares: number | null; corp: ICorporation }): React.ReactElement {
|
function ProfitIndicator(props: { shares: number | null; corp: ICorporation }): React.ReactElement {
|
||||||
if (props.shares === null) return <></>;
|
if (props.shares === null) return <></>;
|
||||||
|
let text = "";
|
||||||
if (isNaN(props.shares) || props.shares <= 0) {
|
if (isNaN(props.shares) || props.shares <= 0) {
|
||||||
return <Typography>ERROR: Invalid value entered for number of shares to sell </Typography>;
|
text = `ERROR: Invalid value entered for number of shares to sell`;
|
||||||
} else if (props.shares > corp.numShares) {
|
} else if (props.shares > corp.numShares) {
|
||||||
return <Typography>You don't have this many shares to sell! </Typography>;
|
text = `You don't have this many shares to sell!`;
|
||||||
} else {
|
} else {
|
||||||
const stockSaleResults = corp.calculateShareSale(props.shares);
|
const stockSaleResults = corp.calculateShareSale(props.shares);
|
||||||
const profit = stockSaleResults[0];
|
const profit = stockSaleResults[0];
|
||||||
return (
|
text = `Sell ${props.shares} shares for a total of ${numeralWrapper.formatMoney(profit)}`;
|
||||||
<Typography>
|
|
||||||
<small>
|
|
||||||
Sell {props.shares} shares for a total of {numeralWrapper.formatMoney(profit)}
|
|
||||||
</small>
|
|
||||||
</Typography>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Typography>
|
||||||
|
<small>{text}</small>
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sell(): void {
|
function sell(): void {
|
||||||
@ -86,7 +87,6 @@ export function SellSharesModal(props: IProps): React.ReactElement {
|
|||||||
<br />
|
<br />
|
||||||
The current price of your company's stock is {numeralWrapper.formatMoney(corp.sharePrice)}
|
The current price of your company's stock is {numeralWrapper.formatMoney(corp.sharePrice)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<ProfitIndicator shares={shares} corp={corp} />
|
|
||||||
<br />
|
<br />
|
||||||
<TextField
|
<TextField
|
||||||
variant="standard"
|
variant="standard"
|
||||||
@ -99,6 +99,7 @@ export function SellSharesModal(props: IProps): React.ReactElement {
|
|||||||
<Button disabled={disabled} onClick={sell} sx={{ mx: 1 }}>
|
<Button disabled={disabled} onClick={sell} sx={{ mx: 1 }}>
|
||||||
Sell shares
|
Sell shares
|
||||||
</Button>
|
</Button>
|
||||||
|
<ProfitIndicator shares={shares} corp={corp} />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user