More friendly error page

This commit is contained in:
Kalle 2022-09-25 16:18:09 +03:00
parent 3129822c49
commit fa5cd28c0d
5 changed files with 36 additions and 1 deletions

View File

@ -1,13 +1,37 @@
import { useCatch } from "@remix-run/react";
import { Button } from "~/components/Button";
import { useUser } from "~/modules/auth";
import { LOG_IN_URL, SENDOU_INK_DISCORD_URL } from "~/utils/urls";
import {
ERROR_GIRL_IMAGE_PATH,
LOG_IN_URL,
SENDOU_INK_DISCORD_URL,
} from "~/utils/urls";
import { Image } from "./Image";
import { Main } from "./Main";
export function Catcher() {
const caught = useCatch();
const user = useUser();
if (!caught)
return (
<Main>
<Image
className="m-0-auto"
path={ERROR_GIRL_IMAGE_PATH}
width={292}
height={243.5}
alt=""
/>
<h2 className="text-center">Error happened</h2>
<p className="text-center">
It seems like you encountered a bug. Sorry about that! Please report
details (your browser? what were you doing?) on{" "}
<a href={SENDOU_INK_DISCORD_URL}>our Discord</a> so it can be fixed.
</p>
</Main>
);
switch (caught.status) {
case 401:
return (

View File

@ -153,3 +153,13 @@ export function CatchBoundary() {
</ThemeProvider>
);
}
export function ErrorBoundary() {
return (
<ThemeProvider specifiedTheme={Theme.DARK}>
<Document>
<Catcher />
</Document>
</ThemeProvider>
);
}

View File

@ -32,6 +32,7 @@ export const STOP_IMPERSONATING_URL = "/auth/impersonate/stop";
export const SEED_URL = "/seed";
export const COMMON_PREVIEW_IMAGE = "/img/layout/common-preview.png";
export const ERROR_GIRL_IMAGE_PATH = `/img/layout/error-girl`;
export const userPage = (discordId: string) => `/u/${discordId}`;
export const userBuildsPage = (discordId: string) =>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB