The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 72 lines 1.73 KB
Raw
1 import {
2 isRouteErrorResponse,
3 Links,
4 Meta,
5 Outlet,
6 Scripts,
7 ScrollRestoration,
8 } from "react-router";
9 import type { Route } from "./+types/root";
10 import "./app.css";
11
12 export const links: Route.LinksFunction = () => [
13 { rel: "preconnect", href: "https://fonts.googleapis.com" },
14 {
15 rel: "preconnect",
16 href: "https://fonts.gstatic.com",
17 crossOrigin: "anonymous",
18 },
19 {
20 rel: "stylesheet",
21 href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",
22 },
23 ];
24
25 export function Layout({ children }: { children: React.ReactNode }) {
26 return (
27 <html lang="en">
28 <head>
29 <meta charSet="utf-8" />
30 <meta name="viewport" content="width=device-width, initial-scale=1" />
31 <Meta />
32 <Links />
33 </head>
34 <body>
35 {children}
36 <ScrollRestoration />
37 <Scripts />
38 </body>
39 </html>
40 );
41 }
42
43 export default function App() {
44 return <Outlet />;
45 }
46
47 export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
48 let message = "Oops!";
49 let details = "An unexpected error occurred.";
50 let stack: string | undefined;
51
52 if (isRouteErrorResponse(error)) {
53 message = error.status === 404 ? "404" : "Error";
54 details =
55 error.status === 404 ? "The requested page could not be found." : error.statusText || details;
56 } else if (import.meta.env.DEV && error && error instanceof Error) {
57 details = error.message;
58 stack = error.stack;
59 }
60
61 return (
62 <main className="pt-16 p-4 container mx-auto">
63 <h1>{message}</h1>
64 <p>{details}</p>
65 {stack && (
66 <pre className="w-full p-4 overflow-x-auto">
67 <code>{stack}</code>
68 </pre>
69 )}
70 </main>
71 );
72 }