Impelemented missing House Rules
This commit is contained in:
parent
25bb7d05a5
commit
279fc68718
@ -15,12 +15,16 @@ import Dialog from "@mui/material/Dialog";
|
|||||||
import DialogTitle from "@mui/material/DialogTitle";
|
import DialogTitle from "@mui/material/DialogTitle";
|
||||||
import DialogContent from "@mui/material/DialogContent";
|
import DialogContent from "@mui/material/DialogContent";
|
||||||
import DialogActions from "@mui/material/DialogActions";
|
import DialogActions from "@mui/material/DialogActions";
|
||||||
|
import Table from "@mui/material/Table";
|
||||||
|
import TableBody from "@mui/material/TableBody";
|
||||||
|
import TableCell from "@mui/material/TableCell";
|
||||||
|
import TableContainer from "@mui/material/TableContainer";
|
||||||
|
import TableRow from "@mui/material/TableRow";
|
||||||
|
|
||||||
// import "./HouseRules.css";
|
// import "./HouseRules.css";
|
||||||
|
|
||||||
import { GlobalContext } from "./GlobalContext";
|
import { GlobalContext } from "./GlobalContext";
|
||||||
import { Placard } from "./Placard";
|
import { Placard } from "./Placard";
|
||||||
import { Box } from "@mui/material";
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
@ -404,39 +408,50 @@ const HouseRules: React.FC<HouseRulesProps> = ({ houseRulesActive }) => {
|
|||||||
|
|
||||||
<DialogTitle>House Rules</DialogTitle>
|
<DialogTitle>House Rules</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
<TableContainer>
|
||||||
{ruleList.map((item) => {
|
<Table>
|
||||||
const defaultChecked = item.defaultChecked;
|
<TableBody>
|
||||||
if (!(item.key in rules)) {
|
{ruleList.map((item) => {
|
||||||
rules[item.key] = {
|
const defaultChecked = item.defaultChecked;
|
||||||
enabled: defaultChecked,
|
if (!(item.key in rules)) {
|
||||||
};
|
rules[item.key] = {
|
||||||
}
|
enabled: defaultChecked,
|
||||||
const checked = rules[item.key].enabled;
|
};
|
||||||
if (checked !== state[item.key]) {
|
}
|
||||||
setState({ ...state, [item.key]: checked });
|
const checked = rules[item.key].enabled;
|
||||||
}
|
if (checked !== state[item.key]) {
|
||||||
|
setState({ ...state, [item.key]: checked });
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={item.key} className="HouseSelector">
|
<React.Fragment key={item.key}>
|
||||||
<div>
|
<TableRow>
|
||||||
<b>{item.label}</b>: {item.description}
|
<TableCell>
|
||||||
</div>
|
<b>{item.label}</b>
|
||||||
<div>
|
</TableCell>
|
||||||
<Switch
|
<TableCell>{item.description}</TableCell>
|
||||||
size={"small"}
|
<TableCell>
|
||||||
className="RuleSwitch"
|
<Switch
|
||||||
checked={checked}
|
size={"small"}
|
||||||
id={item.key}
|
className="RuleSwitch"
|
||||||
onChange={(e) => setRule(e, item.key)}
|
checked={checked}
|
||||||
disabled={gameState !== "lobby" || !name}
|
id={item.key}
|
||||||
/>
|
onChange={(e) => setRule(e, item.key)}
|
||||||
</div>
|
disabled={gameState !== "lobby" || !name}
|
||||||
{checked && item.element}
|
/>
|
||||||
</div>
|
</TableCell>
|
||||||
);
|
</TableRow>
|
||||||
})}
|
{checked && (
|
||||||
</Box>
|
<TableRow>
|
||||||
|
<TableCell colSpan={3}>{item.element}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={dismissClicked}>Close</Button>
|
<Button onClick={dismissClicked}>Close</Button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user