MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / ErrorPage

Function ErrorPage

src/Components/Errors/ErrorPage.jsx:14–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12}
13
14export default function ErrorPage() {
15 const error = useRouteError();
16 const navigate = useNavigate();
17 const dark = useTheme().palette.mode === 'dark';
18
19 const isNetwork = error?.message === 'Failed to fetch';
20 const status = typeof error?.status === 'number' ? error.status : null;
21 const message = isNetwork
22 ? NetworkBrokeMessage
23 : (error?.statusText || error?.message || "发生了未知错误,请稍后再试。");
24 const title = isNetwork ? '网络连接异常' : status === 404 ? '页面走丢了' : '出错了';
25 const Icon = isNetwork ? CloudOffOutlined : SentimentDissatisfiedOutlined;
26
27 return (
28 <Box sx={{
29 width: '100%',
30 minHeight: '70vh',
31 flexGrow: 1,
32 display: 'flex',
33 alignItems: 'center',
34 justifyContent: 'center',
35 px: 2,
36 py: 6,
37 }}>
38 <Paper
39 elevation={0}
40 sx={{
41 width: '100%',
42 maxWidth: 480,
43 bgcolor: (theme) => theme.palette.surface,
44 borderRadius: 3,
45 p: {xs: 3, sm: 4.5},
46 textAlign: 'center',
47 display: 'flex',
48 flexDirection: 'column',
49 alignItems: 'center',
50 gap: 2,
51 }}
52 >
53 {status && status !== 404 ? (
54 <Typography sx={{
55 fontWeight: 800,
56 fontSize: {xs: '3.5rem', sm: '4.5rem'},
57 lineHeight: 1,
58 display: 'inline-block',
59 background: brandGradient(dark),
60 backgroundClip: 'text',
61 WebkitBackgroundClip: 'text',
62 color: 'transparent',
63 WebkitTextFillColor: 'transparent',
64 }}>
65 {status}
66 </Typography>
67 ) : (
68 <Box sx={{
69 width: 72,
70 height: 72,
71 borderRadius: '50%',

Callers

nothing calls this directly

Calls 1

brandGradientFunction · 0.70

Tested by

no test coverage detected