2026-05-22 19:30:55 -04:00
|
|
|
import React from 'react';
|
|
|
|
|
import { useRouteError, isRouteErrorResponse } from 'react-router-dom';
|
2026-06-28 22:32:19 -04:00
|
|
|
import { Box, Button, config, Text, toRem } from 'folds';
|
2026-05-22 19:30:55 -04:00
|
|
|
|
|
|
|
|
export function RouteError() {
|
|
|
|
|
const error = useRouteError();
|
|
|
|
|
|
|
|
|
|
const message = isRouteErrorResponse(error)
|
|
|
|
|
? `${error.status} ${error.statusText}`
|
|
|
|
|
: error instanceof Error
|
|
|
|
|
? error.message
|
|
|
|
|
: 'An unexpected error occurred.';
|
|
|
|
|
|
|
|
|
|
return (
|
2026-06-28 22:32:19 -04:00
|
|
|
<Box
|
|
|
|
|
direction="Column"
|
|
|
|
|
alignItems="Center"
|
|
|
|
|
justifyContent="Center"
|
|
|
|
|
gap="400"
|
|
|
|
|
style={{ height: '100dvh', padding: config.space.S700 }}
|
2026-05-22 19:30:55 -04:00
|
|
|
>
|
2026-06-28 22:32:19 -04:00
|
|
|
<Text size="H3">Something went wrong</Text>
|
|
|
|
|
<Text size="T300" priority="300" style={{ textAlign: 'center', maxWidth: toRem(400) }}>
|
|
|
|
|
{message}
|
|
|
|
|
</Text>
|
|
|
|
|
<Button variant="Primary" onClick={() => window.location.reload()}>
|
|
|
|
|
<Text as="span" size="B400">
|
|
|
|
|
Reload
|
|
|
|
|
</Text>
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
2026-05-22 19:30:55 -04:00
|
|
|
);
|
|
|
|
|
}
|