mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 23:38:35 +02:00
Work on hacknet to mui
This commit is contained in:
@@ -7,7 +7,7 @@ import { GeneralInfo } from "./GeneralInfo";
|
||||
import { HacknetNodeElem } from "./HacknetNodeElem";
|
||||
import { HacknetServerElem } from "./HacknetServerElem";
|
||||
import { HacknetNode } from "../HacknetNode";
|
||||
import { HashUpgradePopup } from "./HashUpgradePopup";
|
||||
import { HashUpgradeModal } from "./HashUpgradeModal";
|
||||
import { MultiplierButtons } from "./MultiplierButtons";
|
||||
import { PlayerInfo } from "./PlayerInfo";
|
||||
import { PurchaseButton } from "./PurchaseButton";
|
||||
@@ -24,8 +24,6 @@ import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { AllServers } from "../../Server/AllServers";
|
||||
import { Server } from "../../Server/Server";
|
||||
|
||||
import { createPopup } from "../../ui/React/createPopup";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Button from "@mui/material/Button";
|
||||
@@ -35,6 +33,7 @@ interface IProps {
|
||||
}
|
||||
|
||||
export function HacknetRoot(props: IProps): React.ReactElement {
|
||||
const [open, setOpen] = useState(false);
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
setRerender((old) => !old);
|
||||
@@ -46,13 +45,6 @@ export function HacknetRoot(props: IProps): React.ReactElement {
|
||||
return () => clearInterval(id);
|
||||
}, []);
|
||||
|
||||
function createHashUpgradesPopup(): void {
|
||||
const id = "hacknet-server-hash-upgrades-popup";
|
||||
createPopup(id, HashUpgradePopup, {
|
||||
player: props.player,
|
||||
});
|
||||
}
|
||||
|
||||
let totalProduction = 0;
|
||||
for (let i = 0; i < props.player.hacknetNodes.length; ++i) {
|
||||
const node = props.player.hacknetNodes[i];
|
||||
@@ -142,9 +134,10 @@ export function HacknetRoot(props: IProps): React.ReactElement {
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{hasHacknetServers(props.player) && <Button onClick={createHashUpgradesPopup}>Spend Hashes on Upgrades</Button>}
|
||||
{hasHacknetServers(props.player) && <Button onClick={() => setOpen(true)}>Spend Hashes on Upgrades</Button>}
|
||||
|
||||
<Grid container>{nodes}</Grid>
|
||||
<HashUpgradeModal open={open} onClose={() => setOpen(false)} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user