g1t/apps/sudo/app/root.tsx

80 lines3,239 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales1import { isRouteErrorResponse, Links, Meta, Outlet, useRouteLoaderData } from "react-router";
Billing accounts, terms and enterprises; g1t is no longer free2
3import type { Route } from "./+types/root";
4import "./app.css";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look5import displayFont from "@g1t/theme/fonts/bricolage-grotesque-latin.woff2?url";
6import sansFont from "@g1t/theme/fonts/hanken-grotesk-latin.woff2?url";
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales7import { MobileBar, Sidebar } from "./components/shell";
Billing accounts, terms and enterprises; g1t is no longer free8import { ButtonLink } from "./components/ui";
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas9import type { NavCounts } from "./lib/nav";
10import { identity, statusAdmin } from "./lib/services.server";
11import { settle } from "./lib/settle";
Billing accounts, terms and enterprises; g1t is no longer free12import { requireStaff } from "./lib/staff";
13
14export const links: Route.LinksFunction = () => [
15 { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look16 // The faces are served by sudo itself (@g1t/theme); these two are on every page.
17 { rel: "preload", href: sansFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
18 { rel: "preload", href: displayFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
Billing accounts, terms and enterprises; g1t is no longer free19];
20
21export const meta: Route.MetaFunction = () => [
22 { title: "sudo · g1t" },
23 { name: "robots", content: "noindex, nofollow" },
24];
25
26export async function loader({ context }: Route.LoaderArgs) {
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas27 const { email } = requireStaff(context);
28 // The sidebar's counts: a service that does not answer shows none.
29 const [waitlist, incidents] = await Promise.all([settle(identity.waitlistPending()), settle(statusAdmin.openCount())]);
30 const counts: NavCounts = { waitlist: waitlist.ok ? waitlist.value : 0, incidents: incidents.ok ? incidents.value : 0 };
31 return { email, counts };
Billing accounts, terms and enterprises; g1t is no longer free32}
33
34export function Layout({ children }: { children: React.ReactNode }) {
35 const root = useRouteLoaderData<typeof loader>("root");
36 return (
37 <html lang="en">
38 <head>
39 <meta charSet="utf-8" />
40 <meta name="viewport" content="width=device-width, initial-scale=1" />
41 <meta name="theme-color" content="#0f0f11" />
42 <Meta />
43 <Links />
44 </head>
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales45 <body className="min-h-screen">
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas46 <Sidebar email={root?.email} counts={root?.counts} />
47 <MobileBar email={root?.email} counts={root?.counts} />
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales48 <div className="lg:pl-60">{children}</div>
Billing accounts, terms and enterprises; g1t is no longer free49 {/* No <Scripts />: sudo ships no JavaScript, and its policy allows none. */}
50 </body>
51 </html>
52 );
53}
54
55export default function App() {
56 return <Outlet />;
57}
58
59export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
60 let title = "Something went wrong";
61 let details = "An unexpected error occurred.";
62 if (isRouteErrorResponse(error)) {
63 title = error.status === 404 ? "Not found" : `Error ${error.status}`;
64 details = typeof error.data === "string" && error.data ? error.data : error.statusText || details;
65 } else if (error instanceof Error) {
66 // Staff only: the real reason helps more than a polite one.
67 details = error.message;
68 }
69 return (
70 <main className="mx-auto max-w-xl px-4 py-24 text-center">
71 <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
72 <p className="mt-3 break-words text-muted">{details}</p>
73 <div className="mt-8">
74 <ButtonLink to="/" variant="quiet">
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales75 Back to the overview
Billing accounts, terms and enterprises; g1t is no longer free76 </ButtonLink>
77 </div>
78 </main>
79 );
80}