only show avaliable

This commit is contained in:
2022-05-22 18:28:06 +08:00
parent 3f70ba379f
commit 7590dacbc0

View File

@@ -4,6 +4,9 @@ import {
Alert, Alert,
Snackbar, Snackbar,
Button, Button,
FormGroup,
FormControlLabel,
Checkbox,
Stack, Stack,
Dialog, Dialog,
DialogTitle, DialogTitle,
@@ -36,6 +39,8 @@ export default function Time(props) {
const [token, setToken] = useState(""); const [token, setToken] = useState("");
const [stats, setStats] = useState({}); const [stats, setStats] = useState({});
const [onlyShowAvaliable, setOnlyShowAvaliable] = useState(true);
const [modifyTime, setModifyTime] = useState({}); const [modifyTime, setModifyTime] = useState({});
const router = useRouter(); const router = useRouter();
@@ -324,6 +329,17 @@ export default function Time(props) {
> >
Refresh Refresh
</Button> </Button>
<FormGroup>
<FormControlLabel
control={
<Checkbox
checked={onlyShowAvaliable}
onChange={(e) => setOnlyShowAvaliable(e.target.checked)}
/>
}
label="仅显示空余"
/>
</FormGroup>
<Typography> <Typography>
当前每人数量上限: {limit} 当前每人数量上限: {limit}
<br /> <br />
@@ -340,7 +356,11 @@ export default function Time(props) {
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{ranges.map((range) => ( {ranges.map((range) => {
if (onlyShowAvaliable) {
return;
}
return (
<TableRow key={range.id}> <TableRow key={range.id}>
<TableCell>{range.name}</TableCell> <TableCell>{range.name}</TableCell>
<TableCell>{range.range}</TableCell> <TableCell>{range.range}</TableCell>
@@ -376,7 +396,8 @@ export default function Time(props) {
)} )}
</TableCell> </TableCell>
</TableRow> </TableRow>
))} );
})}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>