convert most of the city to mui

This commit is contained in:
Olivier Gagnon
2021-09-25 15:34:12 -04:00
parent c0e1706128
commit 86da356478
12 changed files with 262 additions and 413 deletions
+5 -15
View File
@@ -1,12 +1,11 @@
import React from "react";
import Button from "@mui/material/Button";
import { purchaseTorRouter } from "../LocationsHelpers";
import { CONSTANTS } from "../../Constants";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { StdButtonPurchased } from "../../ui/React/StdButtonPurchased";
import { StdButton } from "../../ui/React/StdButton";
import { Money } from "../../ui/React/Money";
type IProps = {
@@ -15,27 +14,18 @@ type IProps = {
};
export function TorButton(props: IProps): React.ReactElement {
const btnStyle = { display: "block" };
function buy(): void {
purchaseTorRouter(props.p);
props.rerender();
}
if (props.p.hasTorRouter()) {
return <StdButtonPurchased style={btnStyle} text={"TOR Router - Purchased"} />;
return <Button>TOR Router - Purchased</Button>;
}
return (
<StdButton
disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)}
onClick={buy}
style={btnStyle}
text={
<>
Purchase TOR router - <Money money={CONSTANTS.TorRouterCost} player={props.p} />
</>
}
/>
<Button disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)} onClick={buy}>
Purchase TOR router - <Money money={CONSTANTS.TorRouterCost} player={props.p} />
</Button>
);
}