Skip to content
546 linesCodeBlameRaw
1import { useEffect, useMemo, useRef, useState } from "react";
2import {
3 isRouteErrorResponse,
4 Link,
5 Links,
6 Meta,
7 Outlet,
8 Scripts,
9 ScrollRestoration,
10 type ShouldRevalidateFunctionArgs,
11 useLocation,
12 useMatches,
13 useRouteError,
14 useRouteLoaderData,
15} from "react-router";
16
17import { type User, awaitsConfirmation, hasAccessIn, sharedWorkspaces } from "@g1t/contracts";
18
19import type { Route } from "./+types/root";
20import appCss from "./app.css?url";
21import displayFont from "@g1t/theme/fonts/bricolage-grotesque-latin.woff2?url";
22import sansFont from "@g1t/theme/fonts/hanken-grotesk-latin.woff2?url";
23import { ButtonLink } from "./components/ui";
24import { Card } from "./components/ui/card";
25import { AppShell, Progress, type ShellData, useLeaving } from "./components/shell";
26import { SiteFooter } from "./components/footer";
27import { PublicHeader } from "./components/public-header";
28import { SpikeBanner } from "./components/spike-banner";
29import { PolicyNotice } from "./components/policy-notice";
30import { identify } from "./lib/analytics.client";
31import { visitorAsksFirst } from "./lib/analytics-consent";
32import { AnalyticsConsent } from "./components/analytics-consent";
33import { readCookie } from "./lib/mission";
34import { WORKSPACE_COOKIE, workspaceFor } from "./lib/workspace-choice";
35import { PageMain } from "./components/landmark";
36import { NotFound } from "./components/not-found";
37import { frameOf } from "./lib/chrome";
38import { DOCK_COOKIE, SIDEBAR_COOKIE, pinsToShow, sidebarClosed } from "./lib/apps";
39import { savedPins } from "./lib/dock.server";
40import { StandaloneFrame } from "./components/standalone";
41import { billing, chat, identity, inbox, projects, workspaceAgents } from "./lib/services.server";
42import { teamsByAgent } from "./lib/people";
43import { unreadTotals } from "./lib/chat";
44import { countsFor, readableRepos } from "./lib/access.server";
45import { shortCache } from "./lib/cache.server";
46import { getViewer, viewerMiddleware } from "./lib/session.server";
47import { shortcutOf, workspaceProjects } from "./lib/workspace-projects.server";
48import { registrationMode } from "./lib/registration.server";
49import { addresses } from "./lib/addresses.server";
50import { RELOADED_KEY, RELOAD_GIVE_UP_MS, clientNavigated, reloadFixes, reloadedBefore } from "./lib/stale-build";
51import { useNonce } from "./lib/nonce";
52import { isNeedsSignIn } from "./lib/website-token";
53import { setLiveViaToken } from "./lib/live-socket";
54import { LiveNotifications } from "./components/notifications/live-notifications";
55import { THEME_COLOR, THEME_COOKIE, readTheme, themeAttribute, useThemeChoice } from "./lib/theme";
56
57
58export const links: Route.LinksFunction = () => [
59 { rel: "icon", href: "/favicon.ico", sizes: "32x32" },
60 { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" },
61 { rel: "icon", type: "image/png", sizes: "192x192", href: "/icon-192.png" },
62 { rel: "icon", type: "image/png", sizes: "512x512", href: "/icon-512.png" },
63 // Home screens and password managers look for a square, opaque 180px tile;
64 // the "-precomposed" name is served too, for the ones that ask for it.
65 { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
66 // Installable: name, icons and colours for "Add to Home Screen" (public/site.webmanifest;
67 // manifest.webmanifest is the same file, kept for installs that already point at it).
68 { rel: "manifest", href: "/site.webmanifest" },
69 // The text and headline faces are wanted on every page, so they start
70 // loading with the stylesheet; mono waits until something uses it.
71 { rel: "preload", href: sansFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
72 { rel: "preload", href: displayFont, as: "font", type: "font/woff2", crossOrigin: "anonymous" },
73];
74
75export const middleware: Route.MiddlewareFunction[] = [viewerMiddleware];
76
77export async function loader({ context, params, request }: Route.LoaderArgs) {
78 const user = getViewer(context);
79 const cookies = request.headers.get("cookie");
80 const chosen = readCookie(cookies, WORKSPACE_COOKIE);
81 const dock = readCookie(cookies, DOCK_COOKIE);
82 // Whether sign-up takes an invite: the sign-up page says so, and
83 // Settings → Invites offers invites to g1t only then. Cached per isolate.
84 const [shell, mode] = await Promise.all([
85 // An account still confirming its address sees only the pages that
86 // allows (lib/confirm-gate.ts), in the visitor's frame.
87 user && !awaitsConfirmation(user)
88 ? shellFor(user, params, chosen, context).catch((error: unknown) => {
89 // A sidebar that could not be read is no reason to lose the page,
90 // or to draw it as if they were signed out.
91 console.error("root: the sidebar could not be read", error);
92 return bareShell(user, params, chosen);
93 })
94 : visitorShell(params, context),
95 registrationMode(),
96 ]);
97 // The apps this person pinned to their dock here: as their account keeps
98 // them (read with the rest of the shell), else as this device's cookie
99 // remembers them (lib/apps.ts).
100 if (shell.workspace) shell.pins = pinsToShow(shell.pins, dock, shell.workspace.slug);
101 // Where this g1t lives, for clone lines, agent setup and link previews.
102 return {
103 user,
104 shell,
105 // Whether they folded the sidebar away, so the page is drawn that way from the start.
106 sidebarClosed: sidebarClosed(readCookie(cookies, SIDEBAR_COOKIE)),
107 // Their Appearance, so the page is drawn in it from the first byte (lib/theme.ts).
108 theme: readTheme(readCookie(cookies, THEME_COOKIE)),
109 inviteOnly: mode !== "open",
110 addresses: addresses(),
111 // Visitors from where the law asks first are asked before analytics runs.
112 analyticsConsent: visitorAsksFirst(request),
113 };
114}
115
116/**
117 * The sidebar for someone not signed in: nothing of their own, only the
118 * open counts of the project being looked at. One call, and only in a
119 * project; it answers the same for a private project as a missing one.
120 */
121async function visitorShell(params: { owner?: string; repo?: string }, context: Route.LoaderArgs["context"]): Promise<ShellData> {
122 const path = params.owner && params.repo ? { namespace: params.owner, name: params.repo } : null;
123 const counts = path ? await countsFor(context, params) : null;
124 return {
125 workspace: null,
126 repos: [],
127 repo: path && counts?.ok ? { ...path, member: false, issues: counts.value.issues, pulls: counts.value.pulls } : null,
128 limit: null,
129 monthUsageMicros: null,
130 };
131}
132
133/** The sidebar from what the session already says, with no service asked. */
134function bareShell(user: User, params: { owner?: string; repo?: string }, chosen: string | null): ShellData {
135 return {
136 workspace: workspaceFor(user.workspaces ?? [], chosen, params),
137 repos: [],
138 repo: null,
139 limit: null,
140 monthUsageMicros: null,
141 };
142}
143
144/**
145 * The sidebar only changes with the workspace or repository being looked
146 * at, or after something was submitted: not on every page within them.
147 */
148export function shouldRevalidate({
149 currentParams,
150 nextParams,
151 formMethod,
152 defaultShouldRevalidate,
153}: ShouldRevalidateFunctionArgs) {
154 if (formMethod && formMethod !== "GET") return defaultShouldRevalidate;
155 return currentParams.owner !== nextParams.owner || currentParams.repo !== nextParams.repo;
156}
157
158/**
159 * The sidebar: the workspace whose pages or project these are when it is
160 * one of yours, else the one you chose (lib/workspace-choice.ts); its
161 * projects; and the repository being looked at.
162 */
163async function shellFor(
164 user: User,
165 params: { owner?: string; repo?: string },
166 chosen: string | null,
167 context: Route.LoaderArgs["context"],
168): Promise<ShellData> {
169 const memberships = user.workspaces ?? [];
170 const workspace = workspaceFor(memberships, chosen, params);
171 const path = params.owner && params.repo ? { namespace: params.owner, name: params.repo } : null;
172 const now = new Date();
173 const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)).toISOString();
174 // What the sidebar shows of the workspace changes rarely: kept for a few
175 // seconds per person and workspace, except just after they changed
176 // something (lib/cache.server.ts).
177 const kept = <T,>(what: string, load: () => Promise<T>) =>
178 workspace ? shortCache(`shell:${what}:${user.id}:${workspace.slug}`, SHELL_TTL_MS, load) : Promise.resolve(null);
179 const [listed, counts, status, usage, limit, entitlements, shared, unread, shortcuts, chatUnread, teamAgents, dockPins] = await Promise.all([
180 // Every project, for the palette and the count; the sidebar lists only
181 // the person's pinned and recent ones (lib/pins.ts).
182 workspace ? workspaceProjects(workspace.slug, user) : Promise.resolve(null),
183 path ? countsFor(context, params) : Promise.resolve(null),
184 // Whether billing is on, without reading the account: that asks the
185 // card processor about the workspace's cards, too slow for every page.
186 kept("status", () => billing.status()).catch(() => null),
187 kept(`usage:${monthStart}`, () => billing.usage(workspace!.slug, user, monthStart)).catch(() => null),
188 kept("limit", () => billing.limit(workspace!.slug, user)).catch(() => null),
189 kept("entitlements", () => billing.entitlements(workspace!.slug)).catch(() => null),
190 sharedRepos(user),
191 // The bell's count: one query, never kept, so marking an item shows at once.
192 inbox.counts(user.username).catch(() => null),
193 // Never kept: opening a project moves it up Recent.
194 workspace ? projects.shortcuts(workspace.slug, user).catch(() => null) : Promise.resolve(null),
195 // The rail's Chat badge: never kept, and never waited on for long.
196 workspace ? chatUnreadFor(workspace.slug, user) : Promise.resolve(null),
197 // Home's Recent and the Agents sidebar, on every page: never waited on for long.
198 workspace ? agentsFor(workspace.slug, user) : Promise.resolve(null),
199 // The dock's pins, kept with the account so every device shows the same
200 // dock; never kept here, so a pin shows the moment it is made. Null
201 // falls back to the cookie (lib/dock.server.ts).
202 workspace ? savedPins(user, workspace.slug) : Promise.resolve(null),
203 ]);
204 return {
205 workspace,
206 // Projects are what the sidebar lists: what the workspace builds and runs.
207 repos: listed?.ok ? listed.value.map(shortcutOf) : [],
208 pinned: (shortcuts?.pinned ?? []).map(shortcutOf),
209 recent: (shortcuts?.recent ?? []).map(shortcutOf),
210 repo:
211 path && counts?.ok
212 ? {
213 ...path,
214 // Until the repository's own page says what their role is.
215 member: hasAccessIn(user, path.namespace),
216 issues: counts.value.issues,
217 pulls: counts.value.pulls,
218 }
219 : null,
220 // Where the workspace stands against its usage limit, once billing is on.
221 limit:
222 status?.enabled && limit?.ok
223 ? {
224 exposureMicros: limit.value.exposureMicros,
225 ceilingMicros: limit.value.ceilingMicros,
226 state: limit.value.state,
227 comped: limit.value.trust === "internal",
228 }
229 : null,
230 free: Boolean(status?.free),
231 // A spend spike or a hold pauses new compute: the shell says so on every page.
232 compute:
233 workspace && entitlements && (entitlements.paused || entitlements.spike?.status === "open")
234 ? { paused: entitlements.paused, spike: entitlements.spike ?? null, owner: workspace.role === "owner" }
235 : null,
236 shared,
237 inbox: unread,
238 chat: chatUnread,
239 agents: teamAgents,
240 pins: dockPins ?? undefined,
241 // While g1t is free every charge is zero, so usage is shown at cost.
242 // Usage at price, the one figure every page shows.
243 monthUsageMicros: usage?.ok ? (usage.value.free ? usage.value.usedMicros : (usage.value.priceMicros ?? usage.value.spentMicros)) : null,
244 };
245}
246
247/** Starred and recent conversations Home's sidebar lists. */
248const SHELL_CONVERSATIONS = 8;
249
250/**
251 * What is unread in chat, for the rail, and the starred and latest
252 * conversations, for Home's sidebar; null when chat is slow to answer or
253 * does not.
254 */
255async function chatUnreadFor(slug: string, user: User): Promise<ShellData["chat"]> {
256 const timeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), CHAT_BADGE_WAIT_MS));
257 const read = chat
258 .sidebar(slug, user)
259 .then((result) => {
260 if (!result.ok) return null;
261 const entries = result.value.entries;
262 const latest = [...entries].sort((a, b) => (b.channel.last_message_at ?? "").localeCompare(a.channel.last_message_at ?? ""));
263 return {
264 ...unreadTotals(entries),
265 starred: entries.filter((e) => e.starred).slice(0, SHELL_CONVERSATIONS),
266 recent: latest.slice(0, SHELL_CONVERSATIONS),
267 };
268 })
269 .catch(() => null);
270 return Promise.race([read, timeout]);
271}
272
273/** The workspace's agents, as the shell lists them; null when the agents service is slow or down. */
274async function agentsFor(slug: string, user: User): Promise<ShellData["agents"]> {
275 const timeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), CHAT_BADGE_WAIT_MS));
276 // The workspace's agents and the person's own personal ones, for "Yours",
277 // with the teams each is on, for the Agents sidebar's groups.
278 const read = Promise.all([workspaceAgents.list(slug, user, { personal: "mine" }), identity.teamAgentIndex(slug).catch(() => null)])
279 .then(([result, index]) => {
280 if (!result.ok) return null;
281 const teams = index ? teamsByAgent(index) : null;
282 return result.value
283 .filter((agent) => !agent.archived_at)
284 .map((agent) => ({
285 id: agent.id,
286 handle: agent.handle,
287 display_name: agent.display_name,
288 avatar: agent.avatar,
289 avatar_seed: agent.avatar_seed,
290 role: agent.role,
291 title: agent.title,
292 status: agent.status,
293 builtin: agent.builtin === true,
294 scope: agent.scope,
295 ...(teams ? { teams: teams[agent.id] ?? [] } : {}),
296 }));
297 })
298 .catch(() => null);
299 return Promise.race([read, timeout]);
300}
301
302/** The longest the rail's Chat badge holds up a page. */
303const CHAT_BADGE_WAIT_MS = 300;
304
305/**
306 * How long the sidebar's workspace answers are kept: as long as someone's
307 * own changes read fresh anyway (lib/perf.ts `PRIMARY_WINDOW_SECONDS`).
308 */
309const SHELL_TTL_MS = 30_000;
310
311/** Most repositories listed under Shared with you. */
312const MAX_SHARED = 20;
313
314/**
315 * Repositories shared with the user in workspaces they do not belong to,
316 * by their grants: only those, never the workspace's other repositories.
317 */
318async function sharedRepos(user: User): Promise<ShellData["shared"]> {
319 const outside = new Set(sharedWorkspaces(user));
320 if (outside.size === 0) return [];
321 const ids = (user.grants ?? []).filter((grant) => outside.has(grant.workspace)).map((grant) => grant.repo_id).slice(0, MAX_SHARED);
322 const found = await readableRepos(ids, user);
323 return found
324 .map((repo) => ({ namespace: repo.namespace, name: repo.name, isPrivate: repo.isPrivate }))
325 .sort((a, b) => `${a.namespace}/${a.name}`.localeCompare(`${b.namespace}/${b.name}`));
326}
327
328/**
329 * The root's data as the browser last had it. When a navigation fails in a
330 * way that takes the root's data with it, the error is still drawn in the
331 * person's own frame, signed in, not the visitor's. Never kept on the
332 * server, where one module serves everyone.
333 */
334let lastRoot: Awaited<ReturnType<typeof loader>> | undefined;
335
336export function Layout({ children }: { children: React.ReactNode }) {
337 const nonce = useNonce();
338 // Undefined when the root loader itself failed.
339 const loaded = useRouteLoaderData<typeof loader>("root");
340 const inBrowser = typeof document !== "undefined";
341 if (loaded && inBrowser) lastRoot = loaded;
342 const root = loaded ?? (inBrowser ? lastRoot : undefined);
343 const user = root?.user;
344 // A page opened with an access token signs its live sockets in with tickets (lib/live-socket.ts).
345 if (inBrowser) setLiveViaToken(Boolean(user?.token?.website));
346 const { pathname, search } = useLocation();
347 // Drawn around the error page too: a 404 keeps the sidebar out of a
348 // project or workspace the viewer cannot see.
349 const error = useRouteError();
350 const missing = isRouteErrorResponse(error) && error.status === 404;
351 // The billing page shows the full banner itself.
352 const paused = root?.shell?.compute && root.shell.workspace && !pathname.endsWith("/-/billing") && (
353 <SpikeBanner
354 compact
355 slug={root.shell.workspace.slug}
356 entitlements={{ paused: root.shell.compute.paused, spike: root.shell.compute.spike }}
357 owner={root.shell.compute.owner}
358 />
359 );
360 // On the few pages an account still confirming its address can open
361 // besides /confirm-email (policies, support, signing in): the way back.
362 const verify = user && awaitsConfirmation(user) && pathname !== "/confirm-email" && (
363 <p
364 role="status"
365 className="flex flex-wrap items-center justify-center gap-x-3 gap-y-1 border-b border-warn/30 bg-warn/10 px-4 py-2 text-sm"
366 >
367 <span>Confirm your email address to start using g1t.</span>
368 <Link to="/confirm-email" className="font-medium underline underline-offset-4">
369 Enter your code
370 </Link>
371 </p>
372 );
373 // A workspace that requires two-factor authentication of someone who
374 // has not turned it on: they keep their place, and cannot use it yet.
375 const held = user?.held && user.held.length > 0 && pathname !== "/settings/two-factor" && <PolicyNotice held={user.held} />;
376 const leaving = useLeaving();
377 // Auto, Light or Dark: as the cookie said when the page was drawn, or as just switched.
378 const theme = useThemeChoice(root?.theme);
379 // Which frame the page is drawn in (lib/chrome.ts): on its own, the app's, or the public one.
380 const frame = frameOf(pathname, {
381 signedIn: user != null && !awaitsConfirmation(user),
382 workspace: (user?.workspaces ?? []).length > 0,
383 });
384 const banner =
385 paused || verify || held ? (
386 <>
387 {paused}
388 {verify}
389 {held}
390 </>
391 ) : null;
392 return (
393 <html lang="en" data-theme={themeAttribute(theme)}>
394 <head>
395 <meta charSet="utf-8" />
396 <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
397 {/* The browser bar matches the page: one colour for a chosen theme, the system's for Auto. */}
398 {theme === "auto" ? (
399 <>
400 <meta name="theme-color" media="(prefers-color-scheme: light)" content={THEME_COLOR.light} />
401 <meta name="theme-color" media="(prefers-color-scheme: dark)" content={THEME_COLOR.dark} />
402 </>
403 ) : (
404 <meta name="theme-color" content={THEME_COLOR[theme]} />
405 )}
406 <meta name="mobile-web-app-capable" content="yes" />
407 <meta name="apple-mobile-web-app-capable" content="yes" />
408 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
409 {/* The stylesheet before everything React Router preloads, so a slow
410 connection paints sooner. */}
411 <link rel="stylesheet" href={appCss} precedence="default" />
412 {root?.analyticsConsent && <meta name="g1t-analytics" content="consent" />}
413 <Meta />
414 <Links nonce={nonce} />
415 </head>
416 <body className="flex min-h-screen flex-col" data-frame={frame === "app" && user && root?.shell ? "app" : frame}>
417 {/* The first stop for the keyboard: past the menus, to the page. */}
418 <a
419 href="#content"
420 className="sr-only rounded-md bg-fg px-3 py-2 text-sm font-medium text-bg focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70]"
421 >
422 Skip to content
423 </a>
424 {frame === "standalone" ? (
425 <StandaloneFrame>{children}</StandaloneFrame>
426 ) : frame === "app" && user && root?.shell ? (
427 <AppShell user={user} shell={root.shell} missing={missing} banner={banner} sidebarClosed={root.sidebarClosed}>
428 {children}
429 </AppShell>
430 ) : (
431 <>
432 <Progress />
433 <PublicHeader user={user} />
434 {banner}
435 <div id="content" tabIndex={-1} {...leaving} className={`grow outline-none ${leaving.className}`}>
436 {children}
437 </div>
438 <SiteFooter user={user} />
439 </>
440 )}
441 {/* Live notifications for the signed-in: the feed socket, toasts, the tab's count (components/notifications). */}
442 {user && !awaitsConfirmation(user) && (
443 <LiveNotifications workspace={root?.shell?.workspace?.slug ?? null} inbox={root?.shell?.inbox?.unread ?? null} />
444 )}
445 <AnalyticsConsent />
446 <ScrollRestoration nonce={nonce} />
447 <Scripts nonce={nonce} />
448 </body>
449 </html>
450 );
451}
452
453export default function App() {
454 const userId = useRouteLoaderData<typeof loader>("root")?.user?.id ?? null;
455 // Tell analytics who is signed in, once per change; signing out forgets them.
456 const lastUserId = useRef<string | null>(null);
457 useEffect(() => {
458 identify(userId, lastUserId.current);
459 lastUserId.current = userId;
460 }, [userId]);
461 return <Outlet />;
462}
463
464export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
465 const location = useLocation();
466 const matches = useMatches();
467 const href = location.pathname + location.search + location.hash;
468 // A tab left open across a deploy: load the address again as a whole
469 // page, once, rather than show an error the reload fixes. A document load
470 // never reloads, so the server and the hydrating client render the same.
471 const reloadable = reloadFixes({
472 error,
473 status: isRouteErrorResponse(error) ? error.status : undefined,
474 clientNavigation: clientNavigated(location.key),
475 caughtByCatchAll: matches.at(-1)?.id === "routes/not-found",
476 });
477 // Already loaded again once, or the reload never started: show the page.
478 const tried = useMemo(() => reloadable && reloadedBefore(href), [reloadable, href]);
479 const [gaveUp, setGaveUp] = useState<string | null>(null);
480 const reload = reloadable && !tried && gaveUp !== href;
481 useEffect(() => {
482 if (!reload) return;
483 try {
484 sessionStorage.setItem(RELOADED_KEY, href);
485 } catch {
486 // No session storage: reload anyway; a document load never asks again.
487 }
488 window.location.assign(href);
489 const timer = window.setTimeout(() => setGaveUp(href), RELOAD_GIVE_UP_MS);
490 return () => window.clearTimeout(timer);
491 }, [reload, href]);
492 if (reload) {
493 return (
494 <PageMain className="mx-auto max-w-xl px-4 py-32 text-center text-sm text-muted" aria-busy="true">
495 <title>Loading · g1t</title>
496 Loading the latest version of g1t…
497 </PageMain>
498 );
499 }
500
501 let title = "Something went wrong";
502 let details = "An unexpected error occurred. Try again in a moment.";
503 let stack: string | undefined;
504
505 if (isRouteErrorResponse(error)) {
506 // The same page for something private and something missing.
507 if (error.status === 404) {
508 return (
509 <>
510 <title>Not found · g1t</title>
511 <NotFound data={error.data} />
512 </>
513 );
514 }
515 if (typeof error.data === "string" && error.data) {
516 details = error.data;
517 }
518 // A token asked for what needs a real sign-in (lib/website-token.ts).
519 if (isNeedsSignIn(error.data)) {
520 title = "This needs you to sign in";
521 details = error.data.message;
522 }
523 } else if (import.meta.env.DEV && error instanceof Error) {
524 details = error.message;
525 stack = error.stack;
526 }
527
528 return (
529 <PageMain className="mx-auto max-w-xl px-4 py-32 text-center">
530 <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
531 <p className="mt-3 text-muted">{details}</p>
532 <div className="mt-8">
533 <ButtonLink to="/" variant="outline">
534 Back to home
535 </ButtonLink>
536 </div>
537 {stack && (
538 <Card asChild tone="plain" radius="lg" className="mt-8 overflow-x-auto p-4 text-left text-xs">
539 <pre>
540 <code>{stack}</code>
541 </pre>
542 </Card>
543 )}
544 </PageMain>
545 );
546}