mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import React, { useState } from "react";
|
|
|
|
import Accordion from "@mui/material/Accordion";
|
|
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
import Button from "@mui/material/Button";
|
|
import Select, { SelectChangeEvent } from "@mui/material/Select";
|
|
import MenuItem from "@mui/material/MenuItem";
|
|
import { generateContract, generateRandomContract, generateRandomContractOnHome } from "../../CodingContractGenerator";
|
|
import { CodingContractTypes } from "../../CodingContracts";
|
|
|
|
export function CodingContractsDev(): React.ReactElement {
|
|
const [codingcontract, setCodingcontract] = useState("Find Largest Prime Factor");
|
|
function setCodingcontractDropdown(event: SelectChangeEvent): void {
|
|
setCodingcontract(event.target.value);
|
|
}
|
|
|
|
function specificContract(): void {
|
|
generateContract({
|
|
problemType: codingcontract,
|
|
server: "home",
|
|
});
|
|
}
|
|
|
|
return (
|
|
<Accordion TransitionProps={{ unmountOnExit: true }}>
|
|
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
|
<Typography>Coding Contracts</Typography>
|
|
</AccordionSummary>
|
|
<AccordionDetails>
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<Button onClick={generateRandomContract}>Generate Random Contract</Button>
|
|
<Button onClick={generateRandomContractOnHome}>Generate Random Contract on Home Comp</Button>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<Select onChange={setCodingcontractDropdown} value={codingcontract}>
|
|
{Object.values(CodingContractTypes).map((cc) => (
|
|
<MenuItem key={cc.name} value={cc.name}>
|
|
{cc.name}
|
|
</MenuItem>
|
|
))}
|
|
</Select>
|
|
<Button onClick={specificContract}>Generate Specified Contract Type on Home Comp</Button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</AccordionDetails>
|
|
</Accordion>
|
|
);
|
|
}
|