-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
910ec84
commit 6b29ab5
Showing
25 changed files
with
243 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import styled from '@emotion/styled'; | ||
import Typography from '@mui/material/Typography'; | ||
import Button from '@mui/material/Button'; | ||
import { useLocation, useNavigate } from 'react-router-dom'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
type ErrorBoundaryContentProps = { | ||
onHistoryChange: () => void; | ||
}; | ||
|
||
export default function ErrorBoundaryContent({ | ||
onHistoryChange, | ||
}: ErrorBoundaryContentProps) { | ||
const navigate = useNavigate(); | ||
const location = useLocation(); | ||
const [initialLocation] = useState(location.pathname); | ||
|
||
useEffect(() => { | ||
if (location.pathname !== initialLocation) { | ||
onHistoryChange(); | ||
} | ||
}, [location.pathname, initialLocation, onHistoryChange]); | ||
|
||
return ( | ||
<Container> | ||
<Content> | ||
<Typography variant="h1">Ooopsie...</Typography> | ||
<Typography variant="h2"> | ||
Something went badly wrong, we logged the error to try and fix it | ||
ASAP. | ||
</Typography> | ||
<Buttons> | ||
<Button onClick={() => navigate('/')} color="primary"> | ||
Home Page | ||
</Button> | ||
<Button onClick={() => window.location.reload()} color="secondary"> | ||
Refresh | ||
</Button> | ||
</Buttons> | ||
</Content> | ||
</Container> | ||
); | ||
} | ||
|
||
const Container = styled.div` | ||
width: 100%; | ||
position: relative; | ||
text-align: center; | ||
margin: 0 auto; | ||
`; | ||
|
||
const Content = styled.div` | ||
margin-top: 200px; | ||
`; | ||
|
||
const Buttons = styled.div` | ||
margin-top: 40px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.