Skip to content

Commit 44d0b0b

Browse files
Merge pull request #242 from yChandrakala23/feature/loading-skeletons
Enhance dashboard UX with loading skeletons and empty states
2 parents 89127f5 + d82cfce commit 44d0b0b

1 file changed

Lines changed: 58 additions & 6 deletions

File tree

src/pages/Tracker/Tracker.tsx

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ import {
2020
TableRow,
2121
TablePagination,
2222
Link,
23-
CircularProgress,
2423
Alert,
2524
Tabs,
2625
Tab,
2726
Select,
2827
MenuItem,
2928
FormControl,
3029
InputLabel,
30+
Skeleton,
31+
Typography,
3132
} from "@mui/material";
3233
import { useTheme } from "@mui/material/styles";
3334
import { useGitHubAuth } from "../../hooks/useGitHubAuth";
@@ -278,11 +279,62 @@ const Home: React.FC = () => {
278279
)}
279280

280281
{loading ? (
281-
<Box display="flex" justifyContent="center" my={4}>
282-
<CircularProgress />
283-
</Box>
284-
) : (
285-
<Box sx={{ maxHeight: "400px", overflowY: "auto" }}>
282+
<Box sx={{ maxHeight: "400px", overflowY: "auto" }}>
283+
<TableContainer component={Paper}>
284+
<Table size="small">
285+
<TableHead>
286+
<TableRow>
287+
<TableCell>Title</TableCell>
288+
<TableCell align="center">Repository</TableCell>
289+
<TableCell align="center">State</TableCell>
290+
<TableCell>Created</TableCell>
291+
</TableRow>
292+
</TableHead>
293+
294+
<TableBody>
295+
{[...Array(5)].map((_, index) => (
296+
<TableRow key={index}>
297+
<TableCell>
298+
<Skeleton variant="text" width="80%" height={30} />
299+
</TableCell>
300+
301+
<TableCell align="center">
302+
<Skeleton variant="text" width="60%" height={30} />
303+
</TableCell>
304+
305+
<TableCell align="center">
306+
<Skeleton variant="rounded" width={70} height={25} />
307+
</TableCell>
308+
309+
<TableCell>
310+
<Skeleton variant="text" width="70%" height={30} />
311+
</TableCell>
312+
</TableRow>
313+
))}
314+
</TableBody>
315+
</Table>
316+
</TableContainer>
317+
</Box>
318+
) : !authError && !dataError && currentFilteredData.length === 0 ? (
319+
<Paper
320+
elevation={1}
321+
sx={{
322+
p: 4,
323+
textAlign: "center",
324+
backgroundColor: theme.palette.background.paper,
325+
}}
326+
>
327+
<Typography variant="h6" gutterBottom>
328+
No Data Found
329+
</Typography>
330+
331+
<Typography variant="body2" color="text.secondary">
332+
Try adjusting filters or searching for another GitHub user.
333+
</Typography>
334+
</Paper>
335+
) : (
336+
337+
<Box sx={{ maxHeight: "400px", overflowY: "auto" }}>
286338

287339
<TableContainer component={Paper}>
288340

0 commit comments

Comments
 (0)