Skip to content

Commit

Permalink
Merge pull request #56 from AirWalk-Digital/beta-stuck-loading-spinner
Browse files Browse the repository at this point in the history
feat(loading error): adding snackbar alert if tiles don't load
  • Loading branch information
PAYNEA03 committed Jul 12, 2024
2 parents 305163b + 75ab5df commit a4b4d18
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/_components/Layouts/IndexTiles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

/* eslint-disable no-nested-ternary */
import { Box, Grid, LinearProgress } from '@mui/material';
import { Alert, Box, Grid, LinearProgress, Snackbar } from '@mui/material';
// import Container from '@mui/material/Container';
// import Grid from '@mui/material/Grid';
import path from 'path';
Expand Down Expand Up @@ -80,7 +80,17 @@ export default async function IndexTiles({
// const MenuComponent =
// menuComponent === 'HeaderMinimalMenu' ? HeaderMinimalMenu : null;

if (loading || !tiles) {
if (!tiles) {
return (
<Snackbar open autoHideDuration={5000}>
<Alert severity='error' sx={{ width: '100%' }}>
Error loading content, please refresh
</Alert>
</Snackbar>
);
}

if (loading) {
return (
// <div style={{ marginTop: topBarHeight }}>
// <Box sx={{ marginTop: topBarHeight }}>
Expand Down

0 comments on commit a4b4d18

Please sign in to comment.