Improving House Rules UX
This commit is contained in:
parent
a3425b3178
commit
25bb7d05a5
@ -26,6 +26,7 @@ import { assetsPath } from "./Common";
|
|||||||
// history replaced by react-router's useNavigate
|
// history replaced by react-router's useNavigate
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
import equal from "fast-deep-equal";
|
import equal from "fast-deep-equal";
|
||||||
|
import { Box } from "@mui/material";
|
||||||
|
|
||||||
type AudioEffect = HTMLAudioElement & { hasPlayed?: boolean };
|
type AudioEffect = HTMLAudioElement & { hasPlayed?: boolean };
|
||||||
const audioEffects: Record<string, AudioEffect | undefined> = {};
|
const audioEffects: Record<string, AudioEffect | undefined> = {};
|
||||||
@ -407,7 +408,7 @@ const Table: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="Game">
|
<div className="Game">
|
||||||
<div className="Dialogs">
|
<Box className="Dialogs">
|
||||||
{error && (
|
{error && (
|
||||||
<div className="Dialog ErrorDialog">
|
<div className="Dialog ErrorDialog">
|
||||||
<Paper className="Error">
|
<Paper className="Error">
|
||||||
@ -454,11 +455,15 @@ const Table: React.FC = () => {
|
|||||||
{state === "normal" && <SelectPlayer />}
|
{state === "normal" && <SelectPlayer />}
|
||||||
{color && state === "game-order" && <GameOrder />}
|
{color && state === "game-order" && <GameOrder />}
|
||||||
|
|
||||||
{!winnerDismissed && <Winner {...{ winnerDismissed, setWinnerDismissed }} />}
|
{!winnerDismissed && (
|
||||||
{houseRulesActive && <HouseRules {...{ houseRulesActive, setHouseRulesActive }} />}
|
<Winner {...{ winnerDismissed, setWinnerDismissed }} />
|
||||||
|
)}
|
||||||
|
{houseRulesActive && (
|
||||||
|
<HouseRules {...{ houseRulesActive, setHouseRulesActive }} />
|
||||||
|
)}
|
||||||
<ViewCard {...{ cardActive, setCardActive }} />
|
<ViewCard {...{ cardActive, setCardActive }} />
|
||||||
<ChooseCard />
|
<ChooseCard />
|
||||||
</div>
|
</Box>
|
||||||
|
|
||||||
<Board animations={animations} />
|
<Board animations={animations} />
|
||||||
<PlayersStatus active={false} />
|
<PlayersStatus active={false} />
|
||||||
@ -489,7 +494,9 @@ const Table: React.FC = () => {
|
|||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max="100"
|
||||||
onInput={(e) => {
|
onInput={(e) => {
|
||||||
const alpha = parseFloat((e.currentTarget as HTMLInputElement).value) / 100;
|
const alpha =
|
||||||
|
parseFloat((e.currentTarget as HTMLInputElement).value) /
|
||||||
|
100;
|
||||||
|
|
||||||
localStorage.setItem("volume", alpha.toString());
|
localStorage.setItem("volume", alpha.toString());
|
||||||
setVolume(alpha);
|
setVolume(alpha);
|
||||||
@ -516,13 +523,25 @@ const Table: React.FC = () => {
|
|||||||
tradeActive: boolean;
|
tradeActive: boolean;
|
||||||
setTradeActive: (v: boolean) => void;
|
setTradeActive: (v: boolean) => void;
|
||||||
}>;
|
}>;
|
||||||
return <TradeComponent tradeActive={tradeActive} setTradeActive={setTradeActive} />;
|
return (
|
||||||
|
<TradeComponent
|
||||||
|
tradeActive={tradeActive}
|
||||||
|
setTradeActive={setTradeActive}
|
||||||
|
/>
|
||||||
|
);
|
||||||
})()}
|
})()}
|
||||||
{name !== "" && <Chat />}
|
{name !== "" && <Chat />}
|
||||||
{/* name !== "" && <VideoFeeds/> */}
|
{/* name !== "" && <VideoFeeds/> */}
|
||||||
{loaded && (
|
{loaded && (
|
||||||
<Actions
|
<Actions
|
||||||
{...{ buildActive, setBuildActive, tradeActive, setTradeActive, houseRulesActive, setHouseRulesActive }}
|
{...{
|
||||||
|
buildActive,
|
||||||
|
setBuildActive,
|
||||||
|
tradeActive,
|
||||||
|
setTradeActive,
|
||||||
|
houseRulesActive,
|
||||||
|
setHouseRulesActive,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,6 +11,10 @@ import equal from "fast-deep-equal";
|
|||||||
import Paper from "@mui/material/Paper";
|
import Paper from "@mui/material/Paper";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Switch from "@mui/material/Switch";
|
import Switch from "@mui/material/Switch";
|
||||||
|
import Dialog from "@mui/material/Dialog";
|
||||||
|
import DialogTitle from "@mui/material/DialogTitle";
|
||||||
|
import DialogContent from "@mui/material/DialogContent";
|
||||||
|
import DialogActions from "@mui/material/DialogActions";
|
||||||
|
|
||||||
// import "./HouseRules.css";
|
// import "./HouseRules.css";
|
||||||
|
|
||||||
@ -396,18 +400,10 @@ const HouseRules: React.FC<HouseRulesProps> = ({ houseRulesActive }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper sx={{ p: 1, maxWidth: 600, margin: "1rem auto", flexDirection: "column", display: "flex" }} className="HouseRules" elevation={3}>
|
||||||
className="HouseRules"
|
|
||||||
sx={{
|
<DialogTitle>House Rules</DialogTitle>
|
||||||
display: "flex",
|
<DialogContent>
|
||||||
flexDirection: "column",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
maxHeight: "100dvh",
|
|
||||||
overflow: "hidden",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box className="Title">House Rules</Box>
|
|
||||||
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
<Box sx={{ display: "flex", flexDirection: "column" }}>
|
||||||
{ruleList.map((item) => {
|
{ruleList.map((item) => {
|
||||||
const defaultChecked = item.defaultChecked;
|
const defaultChecked = item.defaultChecked;
|
||||||
@ -441,7 +437,10 @@ const HouseRules: React.FC<HouseRulesProps> = ({ houseRulesActive }) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Box>
|
</Box>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
<Button onClick={dismissClicked}>Close</Button>
|
<Button onClick={dismissClicked}>Close</Button>
|
||||||
|
</DialogActions>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user