Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | import { styled, Typography } from "@mui/material";
import Actions from "components/Actions";
import Button from "components/Button";
import ReportButton from "components/Navigation/ReportButton";
import PageTitle from "components/PageTitle";
import { GLOBAL } from "i18n/namespaces";
import Link from "next/link";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import { baseRoute } from "routes";
import { theme } from "theme";
const StyledReportButton = styled(ReportButton)(({ theme }) => ({
marginTop: theme.spacing(2),
}));
export default function ErrorFallback({ isFatal }: { isFatal?: boolean }) {
const { t } = useTranslation(GLOBAL);
const router = useRouter();
const handleRefresh = () => router.reload();
return (
<>
<PageTitle>{t("error.fallback.title")}</PageTitle>
<Typography variant="body1">
{isFatal ? t("error.fatal_message") : t("error.fallback.subtitle")}
</Typography>
{!isFatal && <StyledReportButton isResponsive={false} />}
<Actions>
{!isFatal && (
<Button
variant="outlined"
component={Link}
href={baseRoute}
sx={{
color: theme.palette.common.black,
borderColor: theme.palette.grey[300],
"&:hover": {
borderColor: theme.palette.grey[300],
backgroundColor: "#3135390A",
},
}}
>
{t("error.fallback.home_page_link_label")}
</Button>
)}
<Button onClick={handleRefresh}>
{t("error.fallback.refresh_page_button_label")}
</Button>
</Actions>
</>
);
}
|