Add ability to clear queued augs from dev menu

This commit is contained in:
nickofolas 2022-04-08 16:28:43 -05:00
parent 101c34effa
commit 34ca4d236b

@ -1,19 +1,18 @@
import { Clear, ExpandMore, Reply, ReplyAll } from "@mui/icons-material";
import {
Accordion,
AccordionDetails,
AccordionSummary,
Button,
IconButton,
MenuItem,
Select,
SelectChangeEvent,
Typography
} from "@mui/material";
import React, { useState } from "react"; 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 Select, { SelectChangeEvent } from "@mui/material/Select";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import Typography from "@mui/material/Typography"; import { IPlayer } from "../../PersonObjects/IPlayer";
import MenuItem from "@mui/material/MenuItem";
import IconButton from "@mui/material/IconButton";
import ReplyAllIcon from "@mui/icons-material/ReplyAll";
import ReplyIcon from "@mui/icons-material/Reply";
import ClearIcon from "@mui/icons-material/Clear";
interface IProps { interface IProps {
player: IPlayer; player: IPlayer;
@ -39,50 +38,46 @@ export function Augmentations(props: IProps): React.ReactElement {
props.player.augmentations = []; props.player.augmentations = [];
} }
function clearQueuedAugs(): void {
props.player.queuedAugmentations = [];
}
return ( return (
<Accordion TransitionProps={{ unmountOnExit: true }}> <Accordion TransitionProps={{ unmountOnExit: true }}>
<AccordionSummary expandIcon={<ExpandMoreIcon />}> <AccordionSummary expandIcon={<ExpandMore />}>
<Typography>Augmentations</Typography> <Typography>Augmentations</Typography>
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<table> <Select
<tbody> onChange={setAugmentationDropdown}
<tr> value={augmentation}
<td> startAdornment={
<Typography>Aug:</Typography> <>
</td> <IconButton onClick={queueAllAugs} size="large">
<td> <ReplyAll />
<Select </IconButton>
onChange={setAugmentationDropdown} <IconButton onClick={queueAug} size="large">
value={augmentation} <Reply />
startAdornment={ </IconButton>
<> </>
<IconButton onClick={queueAllAugs} size="large"> }
<ReplyAllIcon /> endAdornment={
</IconButton> <>
<IconButton onClick={queueAug} size="large"> <IconButton onClick={clearAugs} size="large">
<ReplyIcon /> <Clear />
</IconButton> </IconButton>
</> </>
} }
endAdornment={ >
<> {Object.values(AugmentationNames).map((aug) => (
<IconButton onClick={clearAugs} size="large"> <MenuItem key={aug} value={aug}>
<ClearIcon /> {aug}
</IconButton> </MenuItem>
</> ))}
} </Select>
> <Button sx={{ display: "block" }} onClick={clearQueuedAugs}>
{Object.values(AugmentationNames).map((aug) => ( Clear Queued Augmentations
<MenuItem key={aug} value={aug}> </Button>
{aug}
</MenuItem>
))}
</Select>
</td>
</tr>
</tbody>
</table>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
); );