feat : add circular progress to chess com load
This commit is contained in:
@@ -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>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user