Skip to content

Commit

Permalink
feat: toast.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-monninger committed Feb 3, 2024
1 parent 0fc253c commit b7eb0f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
File renamed without changes.
16 changes: 12 additions & 4 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './page.module.css';
import { ApiHealthCheckAsyncOperations } from '@/data';
import { components } from '@/presentation';
import { useQuery, QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Skeleton } from '@mui/material';
import { Alert, Skeleton, Snackbar } from '@mui/material';
import { HealthChecks, Region } from '@/util';
import { useRouter, useSearchParams } from 'next/navigation';
import GitHub from '@mui/icons-material/GitHub';
Expand Down Expand Up @@ -48,6 +48,8 @@ function Home() {
router.push(`/?page=${newPage}`, undefined);
};



return (
<div className={styles.container}>
<components.HeaderStd
Expand All @@ -64,15 +66,15 @@ function Home() {
}}
/>
<main className={styles.main}>
{isLoading ? (
{isLoading||error ? (
<>
<Skeleton variant="rectangular" width="100%" height={118} />
<Skeleton variant="text" />
<Skeleton variant="text" />
<Skeleton variant="text" />
</>
) : error ? (
<span>Error: {error.message}</span>
<span>An Err</span>
) : (
<section style={{
display: 'flex',
Expand Down Expand Up @@ -100,7 +102,7 @@ function Home() {
<components.PageSelector
onPageChange={handlePageChange}
totalPages={healthChecks?.totalPages || 0}
currentPage={page + 1}/>
currentPage={healthChecks?.totalPages ? page + 1 : 0}/>
</Container>
</main>
<footer className={styles.footer}>
Expand All @@ -116,6 +118,12 @@ function Home() {
</Box>
</Container>
</footer>
{error && <Snackbar
open={!!error}
autoHideDuration={6000}
>
<Alert severity="error">{error?.message}</Alert>
</Snackbar>}
</div>
);
}
Expand Down

0 comments on commit b7eb0f9

Please sign in to comment.