Something went wrong. Try again.
I will pick a better name later.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import type { LinksFunction } from "react-router";import { Link, Links, Meta, Outlet, Scripts, ScrollRestoration, isRouteErrorResponse, useRouteError } from "react-router";import appStylesHref from "./app.css?url";import { Button } from "~/components/ui/button";import { themeInitScript } from "~/lib/theme";
export const links: LinksFunction = () => [ { rel: "icon", href: "/favicon.svg", type: "image/svg+xml" }, { rel: "stylesheet", href: appStylesHref },];
export function Layout({ children }: { children: React.ReactNode }) { return ( <html lang="en" suppressHydrationWarning> <head> <meta charSet="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <script dangerouslySetInnerHTML={{ __html: themeInitScript }} /> <Meta /> <Links /> </head> <body> {children} <ScrollRestoration /> <Scripts /> </body> </html> );}
export default function App() { return ( <div className="min-h-screen bg-background text-foreground"> <Outlet /> </div> );}
export function ErrorBoundary() { const error = useRouteError(); const title = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : "Something went wrong"; const message = error instanceof Error ? error.message : "The app hit an unexpected problem.";
return ( <main className="page-transition mx-auto max-w-3xl px-4 py-12 text-center"> <h1 className="text-2xl font-semibold">{title}</h1> <p className="mt-2 text-muted-foreground">{message}</p> <Button asChild className="mt-4"> <Link to="/" viewTransition> Return home </Link> </Button> </main> );}