2020-09-06 18:12:34 -07:00
|
|
|
import React from "react";
|
2021-05-05 00:09:09 -07:00
|
|
|
import { Box, Flex, Grid, Link } from "@chakra-ui/react";
|
2021-01-21 14:34:55 -08:00
|
|
|
import { loadable } from "./util";
|
2021-05-05 00:09:09 -07:00
|
|
|
import * as Sentry from "@sentry/react";
|
|
|
|
|
import { WarningIcon } from "@chakra-ui/icons";
|
|
|
|
|
|
|
|
|
|
import ErrorGrundoImg from "./images/error-grundo.png";
|
|
|
|
|
import ErrorGrundoImg2x from "./images/error-grundo@2x.png";
|
2020-09-06 18:12:34 -07:00
|
|
|
|
2020-09-21 03:08:24 -07:00
|
|
|
const GlobalHeader = loadable(() => import("./GlobalHeader"));
|
2020-09-19 22:10:52 -07:00
|
|
|
const GlobalFooter = loadable(() => import("./GlobalFooter"));
|
2020-09-06 18:42:39 -07:00
|
|
|
|
2020-09-07 19:46:11 -07:00
|
|
|
function PageLayout({ children }) {
|
2020-09-06 18:12:34 -07:00
|
|
|
return (
|
2020-09-19 22:10:52 -07:00
|
|
|
<Box
|
|
|
|
|
paddingX="6"
|
|
|
|
|
paddingY="3"
|
|
|
|
|
maxWidth="1024px"
|
|
|
|
|
margin="0 auto"
|
|
|
|
|
minHeight="100vh"
|
|
|
|
|
display="flex"
|
|
|
|
|
flexDirection="column"
|
|
|
|
|
>
|
2020-09-06 18:42:39 -07:00
|
|
|
<Box
|
|
|
|
|
width="100%"
|
|
|
|
|
marginBottom="6"
|
2020-09-06 18:54:27 -07:00
|
|
|
// Leave space while content is still loading
|
|
|
|
|
minHeight="2rem"
|
2020-09-06 18:42:39 -07:00
|
|
|
>
|
2020-09-21 03:08:24 -07:00
|
|
|
<GlobalHeader />
|
2020-09-06 18:12:34 -07:00
|
|
|
</Box>
|
2021-05-05 00:09:09 -07:00
|
|
|
<Box flex="1 0 0">
|
|
|
|
|
<Sentry.ErrorBoundary fallback={MajorErrorMessage}>
|
|
|
|
|
{children}
|
|
|
|
|
</Sentry.ErrorBoundary>
|
|
|
|
|
</Box>
|
2020-09-19 22:10:52 -07:00
|
|
|
<Box width="100%" marginTop="12">
|
|
|
|
|
<GlobalFooter />
|
|
|
|
|
</Box>
|
2020-09-06 18:12:34 -07:00
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-05 00:09:09 -07:00
|
|
|
function MajorErrorMessage({ error }) {
|
|
|
|
|
return (
|
|
|
|
|
<Flex justify="center" marginTop="8">
|
|
|
|
|
<Grid
|
|
|
|
|
templateAreas='"icon title" "icon description" "icon details"'
|
|
|
|
|
templateColumns="auto 1fr"
|
|
|
|
|
maxWidth="500px"
|
|
|
|
|
columnGap="4"
|
|
|
|
|
>
|
|
|
|
|
<Box gridArea="icon" marginTop="2">
|
|
|
|
|
<Box
|
|
|
|
|
as="img"
|
|
|
|
|
src={ErrorGrundoImg}
|
|
|
|
|
srcSet={`${ErrorGrundoImg} 1x, ${ErrorGrundoImg2x} 2x`}
|
|
|
|
|
borderRadius="full"
|
|
|
|
|
boxShadow="md"
|
|
|
|
|
width="100px"
|
|
|
|
|
height="100px"
|
|
|
|
|
alt=""
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box gridArea="title" fontSize="lg" marginBottom="1">
|
|
|
|
|
Ah dang, I broke it 😖
|
|
|
|
|
</Box>
|
|
|
|
|
<Box gridArea="description" marginBottom="2">
|
|
|
|
|
There was an error displaying this page. I'll get info about it
|
|
|
|
|
automatically, but you can tell me more at{" "}
|
|
|
|
|
<Link href="mailto:matchu@openneo.net" color="green.400">
|
|
|
|
|
matchu@openneo.net
|
|
|
|
|
</Link>
|
|
|
|
|
!
|
|
|
|
|
</Box>
|
|
|
|
|
<Box gridArea="details" fontSize="xs" opacity="0.8">
|
|
|
|
|
<WarningIcon
|
|
|
|
|
marginRight="1.5"
|
|
|
|
|
marginTop="-2px"
|
|
|
|
|
aria-label="Error message"
|
|
|
|
|
/>
|
|
|
|
|
"{error.message}"
|
|
|
|
|
</Box>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-06 18:12:34 -07:00
|
|
|
export default PageLayout;
|