2021-08-10 17:25:21 +02:00
|
|
|
import React, { useState, useEffect } from "react";
|
|
|
|
import { GeneralActionPage } from "./GeneralActionPage";
|
|
|
|
import { ContractPage } from "./ContractPage";
|
|
|
|
import { OperationPage } from "./OperationPage";
|
|
|
|
import { BlackOpPage } from "./BlackOpPage";
|
|
|
|
import { SkillPage } from "./SkillPage";
|
|
|
|
import { stealthIcon, killIcon } from "../data/Icons";
|
2021-08-16 04:35:43 +02:00
|
|
|
import { IBladeburner } from "../IBladeburner";
|
2021-08-16 07:35:05 +02:00
|
|
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
2021-08-10 17:25:21 +02:00
|
|
|
|
|
|
|
interface IProps {
|
2021-09-05 01:09:30 +02:00
|
|
|
bladeburner: IBladeburner;
|
|
|
|
player: IPlayer;
|
2021-08-10 17:25:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export function AllPages(props: IProps): React.ReactElement {
|
2021-09-05 01:09:30 +02:00
|
|
|
const [page, setPage] = useState("General");
|
|
|
|
const setRerender = useState(false)[1];
|
2021-08-10 17:25:21 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
useEffect(() => {
|
|
|
|
const id = setInterval(() => setRerender((old) => !old), 1000);
|
|
|
|
return () => clearInterval(id);
|
|
|
|
}, []);
|
2021-08-10 17:25:21 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
function Header(props: { name: string }): React.ReactElement {
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
onClick={() => setPage(props.name)}
|
|
|
|
className={
|
|
|
|
page !== props.name
|
2021-09-07 22:49:11 +02:00
|
|
|
? "bladeburner-nav-button noselect"
|
|
|
|
: "bladeburner-nav-button-inactive noselect"
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
>
|
|
|
|
{props.name}
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Header name={"General"} />
|
|
|
|
<Header name={"Contracts"} />
|
|
|
|
<Header name={"Operations"} />
|
|
|
|
<Header name={"BlackOps"} />
|
|
|
|
<Header name={"Skills"} />
|
|
|
|
<div style={{ display: "block", margin: "4px", padding: "4px" }}>
|
|
|
|
{page === "General" && (
|
|
|
|
<GeneralActionPage
|
|
|
|
bladeburner={props.bladeburner}
|
|
|
|
player={props.player}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{page === "Contracts" && (
|
|
|
|
<ContractPage bladeburner={props.bladeburner} player={props.player} />
|
|
|
|
)}
|
|
|
|
{page === "Operations" && (
|
|
|
|
<OperationPage
|
|
|
|
bladeburner={props.bladeburner}
|
|
|
|
player={props.player}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{page === "BlackOps" && (
|
|
|
|
<BlackOpPage bladeburner={props.bladeburner} player={props.player} />
|
|
|
|
)}
|
|
|
|
{page === "Skills" && <SkillPage bladeburner={props.bladeburner} />}
|
|
|
|
</div>
|
|
|
|
<span className="text">
|
|
|
|
{stealthIcon} = This action requires stealth, {killIcon} = This action
|
|
|
|
involves retirement
|
|
|
|
</span>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|