feat : add circular progress to chess com load

This commit is contained in:
GuillaumeSD
2024-02-27 04:00:06 +01:00
parent 4aab6c3e17
commit 43017c89ee

View File

@@ -3,6 +3,7 @@ import { getUserRecentGames } from "@/lib/chessCom";
import { capitalize } from "@/lib/helpers"; import { capitalize } from "@/lib/helpers";
import { ChessComGame } from "@/types/chessCom"; import { ChessComGame } from "@/types/chessCom";
import { import {
CircularProgress,
FormControl, FormControl,
Grid, Grid,
ListItemButton, ListItemButton,
@@ -47,7 +48,7 @@ export default function ChessComInput({ pgn, setPgn }: Props) {
return ( return (
<> <>
<FormControl sx={{ m: 1, width: 600 }}> <FormControl sx={{ m: 1, width: 300 }}>
<TextField <TextField
label="Enter your Chess.com username..." label="Enter your Chess.com username..."
variant="outlined" variant="outlined"
@@ -56,7 +57,7 @@ export default function ChessComInput({ pgn, setPgn }: Props) {
/> />
</FormControl> </FormControl>
{games.length > 0 && ( {chessComUsername && (
<Grid <Grid
container container
item item
@@ -64,6 +65,7 @@ export default function ChessComInput({ pgn, setPgn }: Props) {
gap={2} gap={2}
justifyContent="center" justifyContent="center"
alignContent="center" alignContent="center"
minHeight={100}
> >
{games.map((game) => ( {games.map((game) => (
<ListItemButton <ListItemButton
@@ -88,6 +90,8 @@ export default function ChessComInput({ pgn, setPgn }: Props) {
/> />
</ListItemButton> </ListItemButton>
))} ))}
{games.length === 0 && <CircularProgress />}
</Grid> </Grid>
)} )}
</> </>