Skip to content
Snippets Groups Projects
Verified Commit 42b459e7 authored by Adrian Paschkowski's avatar Adrian Paschkowski :thinking:
Browse files

Properly theme error page in dark mode

parent ca9686fb
Branches
No related tags found
No related merge requests found
import type { FallbackProps } from "react-error-boundary";
import { ErrorBoundary } from "react-error-boundary";
import Logger from "../Logger";
import { ReactComponent as Icon } from "../icons/PersonRunning.svg";
import { ReactComponent as Icon } from "../icons/WheelchairMove.svg";
import Button from "./widgets/Button";
import type { ErrorInfo } from "react";
import { STYLES } from "../constants";
const TAG = "RootErrorBoundary";
......@@ -21,11 +22,11 @@ const onError = (error: Error, { componentStack }: ErrorInfo) => {
function Fallback({ error }: FallbackProps) {
return (
<div className="min-h-screen flex flex-col items-center justify-center gap-8 pt-16 pb-8 mx-4">
<Icon className="w-12 h-12 animate-spin" />
<div className={`min-h-screen flex flex-col items-center justify-center gap-8 pt-16 pb-8 mx-4 ${STYLES.TEXT_COLOR}`}>
<Icon className="w-12 h-12 animate-spin fill-current" />
<h2 className="font-bold text-2xl">Unknown Error</h2>
<p className="max-w-xl">
<a href="https://cdn.ai-rub.de/public/oopsie.mp4" className="text-blue-600 underline">
<a href="https://cdn.ai-rub.de/public/oopsie.mp4" className={`${STYLES.LINK_COLOR} underline`}>
OOPSIE WOOPSIE!!
</a>{" "}
Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to
......@@ -39,12 +40,12 @@ function Fallback({ error }: FallbackProps) {
}
function ErrorDetails({ error }: { error: Error }) {
const errorMessage = error.message;
const errorMessage = error.message || "Unknown Error";
return (
<div className="w-full overflow-x-auto">
<details className="text-sm mt-4">
<summary className="cursor-pointer">{errorMessage}</summary>
<pre className="w-fit p-4 bg-slate-100 border rounded-md">{error.stack}</pre>
<pre className={`w-fit p-4 bg-slate-100 dark:bg-slate-900 border ${STYLES.BORDER_COLOR} rounded-md`}>{error.stack}</pre>
</details>
</div>
);
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path d="M336 48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM141.7 175.5c9.9-9.9 23.4-15.5 37.5-15.5c1.9 0 3.8 .1 5.6 .3L153.6 254c-9.3 28 1.7 58.8 26.8 74.5l86.2 53.9-25.4 88.8c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l28.7-100.4c5.9-20.6-2.6-42.6-20.7-53.9L254 299l30.9-82.4 5.1 12.3C305 264.7 339.9 288 378.7 288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H378.7c-12.9 0-24.6-7.8-29.5-19.7l-6.3-15c-14.6-35.1-44.1-61.9-80.5-73.1l-48.7-15c-11.1-3.4-22.7-5.2-34.4-5.2c-31 0-60.8 12.3-82.7 34.3L73.4 153.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l23.1-23.1zM107.2 352H48c-17.7 0-32 14.3-32 32s14.3 32 32 32h69.6c19 0 36.2-11.2 43.9-28.5L173 361.6l-9.5-6c-17.5-10.9-30.5-26.8-37.9-44.9L107.2 352z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path d="M320 48a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zM204.5 121.3c-5.4-2.5-11.7-1.9-16.4 1.7l-40.9 30.7c-14.1 10.6-34.2 7.7-44.8-6.4s-7.7-34.2 6.4-44.8l40.9-30.7c23.7-17.8 55.3-21 82.1-8.4l90.4 42.5c29.1 13.7 36.8 51.6 15.2 75.5L299.1 224h97.4c30.3 0 53 27.7 47.1 57.4L415.4 422.3c-3.5 17.3-20.3 28.6-37.7 25.1s-28.6-20.3-25.1-37.7L377 288H306.7c8.6 19.6 13.3 41.2 13.3 64c0 88.4-71.6 160-160 160S0 440.4 0 352s71.6-160 160-160c11.1 0 22 1.1 32.4 3.3l54.2-54.2-42.1-19.8zM160 448a96 96 0 1 0 0-192 96 96 0 1 0 0 192z"/>
</svg>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment