mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-17 04:50:10 +02:00
prettify, sorry for the big ass commit
This commit is contained in:
@@ -1,46 +1,54 @@
|
||||
import React, { useState } from "react";
|
||||
|
||||
import { Location } from "../Location";
|
||||
import { createPurchaseServerPopup,
|
||||
createUpgradeHomeCoresPopup,
|
||||
purchaseTorRouter } from "../LocationsHelpers";
|
||||
import { Location } from "../Location";
|
||||
import {
|
||||
createPurchaseServerPopup,
|
||||
createUpgradeHomeCoresPopup,
|
||||
purchaseTorRouter,
|
||||
} from "../LocationsHelpers";
|
||||
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
|
||||
|
||||
import { StdButtonPurchased } from "../../ui/React/StdButtonPurchased";
|
||||
import { StdButton } from "../../ui/React/StdButton";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { StdButtonPurchased } from "../../ui/React/StdButtonPurchased";
|
||||
import { StdButton } from "../../ui/React/StdButton";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
||||
type IProps = {
|
||||
p: IPlayer;
|
||||
}
|
||||
p: IPlayer;
|
||||
};
|
||||
|
||||
export function TorButton(props: IProps): React.ReactElement {
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
setRerender(old => !old);
|
||||
}
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
setRerender((old) => !old);
|
||||
}
|
||||
|
||||
const btnStyle = { display: "block" };
|
||||
const btnStyle = { display: "block" };
|
||||
|
||||
function buy(): void {
|
||||
purchaseTorRouter(props.p);
|
||||
rerender();
|
||||
}
|
||||
function buy(): void {
|
||||
purchaseTorRouter(props.p);
|
||||
rerender();
|
||||
}
|
||||
|
||||
if(props.p.hasTorRouter()) {
|
||||
return (<StdButtonPurchased
|
||||
style={btnStyle}
|
||||
text={"TOR Router - Purchased"}
|
||||
/>);
|
||||
}
|
||||
if (props.p.hasTorRouter()) {
|
||||
return (
|
||||
<StdButtonPurchased style={btnStyle} text={"TOR Router - Purchased"} />
|
||||
);
|
||||
}
|
||||
|
||||
return (<StdButton
|
||||
disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)}
|
||||
onClick={buy}
|
||||
style={btnStyle}
|
||||
text={<>Purchase TOR router - <Money money={CONSTANTS.TorRouterCost} player={props.p} /></>}
|
||||
/>);
|
||||
return (
|
||||
<StdButton
|
||||
disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)}
|
||||
onClick={buy}
|
||||
style={btnStyle}
|
||||
text={
|
||||
<>
|
||||
Purchase TOR router -{" "}
|
||||
<Money money={CONSTANTS.TorRouterCost} player={props.p} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user