Skip to content

Commit

Permalink
Adding default error pages to all routes. Will later customize to eac…
Browse files Browse the repository at this point in the history
…h page. No other configuration needed, NextJS will automatically wrap all adjacent page files with the error.tsx file
  • Loading branch information
siddheshraze committed Jul 25, 2024
1 parent 0dd2a4c commit 65580ab
Show file tree
Hide file tree
Showing 30 changed files with 2,901 additions and 253 deletions.
24 changes: 24 additions & 0 deletions frontend/app/(hub)/dashboard/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/alltaxonomies/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/attributes/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/census/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/personnel/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/quadratpersonnel/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/quadrats/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/species/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/stemdimensions/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/stemtaxonomies/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/fixeddatainput/subquadrats/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
3 changes: 2 additions & 1 deletion frontend/app/(hub)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function HubLayout({ children }: { children: React.ReactNode }) {
setLoading(true, 'Converting raw census data...');
const censusList = await createAndUpdateCensusList(censusRDSLoad);
if (censusListDispatch) {
await censusListDispatch({censusList});
await censusListDispatch({ censusList });
}
setLoading(false);
setCensusListLoaded(true);
Expand Down Expand Up @@ -378,6 +378,7 @@ export default function HubLayout({ children }: { children: React.ReactNode }) {
</Box>
</Box>
<GithubFeedbackModal open={isFeedbackModalOpen} onClose={() => setIsFeedbackModalOpen(false)} />
{/* <GithubFeedbackModal open={true} onClose={() => setIsFeedbackModalOpen(false)} /> */}
</>
);
}
24 changes: 24 additions & 0 deletions frontend/app/(hub)/measurementshub/summary/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/measurementshub/uploadedfiles/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
24 changes: 24 additions & 0 deletions frontend/app/(hub)/measurementshub/validationhistory/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use client';

import React, { useEffect } from 'react';
import { Box, Typography, Button } from '@mui/joy';

const ErrorPage = ({ error, reset }: { error: Error; reset: () => void }) => {
useEffect(() => {
const timer = setTimeout(() => {
reset();
}, 5000);
return () => clearTimeout(timer);
}, [reset]);

return (
<Box sx={{ p: 3, textAlign: 'center' }}>
<Typography level="h1">Something went wrong</Typography>
<Typography level="body-lg">{error.message}</Typography>
<Typography level="body-lg">Retrying in 5 seconds...</Typography>
<Button onClick={reset}>Retry Now</Button>
</Box>
);
};

export default ErrorPage;
Loading

0 comments on commit 65580ab

Please sign in to comment.