Update ErrorNotice and add route level errorBoundary
This commit is contained in:
7 files changed
+242
-145
No files matched your search
@@ -75,6 +75,7 @@ const LikeButton = ({
|
||||
opacity: mutation.isPending ? 1 : 0,
|
||||
transition: "opacity 200ms",
|
||||
}}
|
||||
thickness={2}
|
||||
/>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -67,6 +67,7 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => {
|
||||
opacity: mutation.isPending ? 1 : 0,
|
||||
transition: "opacity 200ms",
|
||||
}}
|
||||
thickness={2}
|
||||
/>
|
||||
<IconButton
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ class ErrorBoundary extends React.Component {
|
||||
// in ErrorBoundary (created by App)
|
||||
// in div (created by App)
|
||||
// in App
|
||||
this.setState;
|
||||
console.error(`Err in ${info} - ${error}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ const Hero = ({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!videoTracks[0].VideoRangeType && (
|
||||
{!!videoTracks[0]?.VideoRangeType && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/** @format */
|
||||
|
||||
import React from "react";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { MdiEmoticonDead } from "../../icons/mdiEmoticonDead";
|
||||
import Button from "@mui/material/Button";
|
||||
import { red } from "@mui/material/colors";
|
||||
|
||||
export const ErrorNotice = () => {
|
||||
export const ErrorNotice = ({ error, resetErrorBoundary }) => {
|
||||
console.error(error);
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -14,11 +16,51 @@ export const ErrorNotice = () => {
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexFlow: "column",
|
||||
opacity: 0.2,
|
||||
// opacity: 0.2,
|
||||
}}
|
||||
>
|
||||
<MdiEmoticonDead sx={{ fontSize: 200 }} />
|
||||
<Typography variant="h3">Something went wrong</Typography>
|
||||
<div
|
||||
className="material-symbols-rounded animate-icon"
|
||||
style={{
|
||||
fontSize: "10em",
|
||||
color: red[800],
|
||||
}}
|
||||
>
|
||||
error
|
||||
</div>
|
||||
<Typography
|
||||
variant="h3"
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
fontWeight={100}
|
||||
>
|
||||
Something went wrong
|
||||
</Typography>
|
||||
<Typography
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
fontWeight={100}
|
||||
variant="h5"
|
||||
style={{
|
||||
padding: "0.5em",
|
||||
background: "rgb(0 0 0 / 1)",
|
||||
borderRadius: "8px",
|
||||
border: "2px dashed rgb(255 255 255 / 0.5)",
|
||||
maxWidth: "40em",
|
||||
marginTop: "1em",
|
||||
// opacity: 0.6,
|
||||
}}
|
||||
>
|
||||
{error.message}
|
||||
</Typography>
|
||||
<Button
|
||||
size="large"
|
||||
variant="contained"
|
||||
onClick={resetErrorBoundary ? resetErrorBoundary : () => {}}
|
||||
style={{
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
Retry
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user