Skip to content
84 linesCodeBlameRaw

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.

Deployments: a preview for every pull request, production on g1t.page1import { ArrowLeft, ExternalLink } from "lucide-react";
2import { Link, data } from "react-router";
3
4import type { Route } from "./+types/deployment";
Social cards for every page: og.g1t.sh5import { page } from "../../lib/meta";
Deployments: a preview for every pull request, production on g1t.page6import { TimeAgo } from "../../components/ui";
7import { deployments } from "../../lib/services.server";
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look8import { getViewer } from "../../lib/session.server";
9import { requireRepo } from "../../lib/access.server";
Usage, Billing settings and prepaid AI credit; fixes from the UX audit10import { buildError } from "../../lib/deployments";
Deployments: a preview for every pull request, production on g1t.page11
Social cards for every page: og.g1t.sh12export function meta({ params, ...args }: Route.MetaArgs) {
13 return page(args, { title: `Deployment · ${params.owner}/${params.repo} · g1t` });
Deployments: a preview for every pull request, production on g1t.page14}
15
16export async function loader({ params, context }: Route.LoaderArgs) {
17 const viewer = getViewer(context);
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look18 await requireRepo(context, params, "read");
Projects: what a workspace builds and runs, first on every page19 const found = await deployments.get({ workspace: params.owner, slug: params.repo }, params.id, viewer);
Deployments: a preview for every pull request, production on g1t.page20 if (!found.ok) throw data(null, { status: 404 });
21 return { build: found.value };
22}
23
24const WORDS = {
25 queued: "Waiting for a sandbox",
26 building: "Building",
27 ready: "Live",
Builds say Replaced or Down once they are no longer live28 replaced: "Replaced by a newer build",
29 down: "Taken down",
Deployments: a preview for every pull request, production on g1t.page30 failed: "Failed",
31 skipped: "Skipped",
32} as const;
33
34export default function DeploymentPage({ loaderData, params }: Route.ComponentProps) {
35 const { build } = loaderData;
36 const base = `/${params.owner}/${params.repo}`;
Usage, Billing settings and prepaid AI credit; fixes from the UX audit37 const error = buildError(build);
Deployments: a preview for every pull request, production on g1t.page38 return (
39 <div className="mx-auto max-w-5xl">
40 <Link to={`${base}/deployments`} className="inline-flex items-center gap-1 text-sm text-muted hover:text-fg">
41 <ArrowLeft size={14} />
42 Deployments
43 </Link>
44 <h1 className="mt-3 text-xl font-semibold tracking-tight">
45 {build.kind === "production" ? "Production" : (
46 <>
Projects: what a workspace builds and runs, first on every page47 Preview of <span className="font-mono">{build.branch}</span>
48 {build.number != null && (
49 <Link to={`${base}/pull/${build.number}`} className="ml-2 text-base font-normal text-muted hover:underline">
50 #{build.number}
51 </Link>
52 )}
Deployments: a preview for every pull request, production on g1t.page53 </>
54 )}
55 <span className="ml-3 font-mono text-sm font-normal text-faint">{build.commit.slice(0, 12)}</span>
56 </h1>
57 <p className="mt-1 text-sm text-muted">
58 {WORDS[build.status]} · started <TimeAgo at={build.createdAt} /> by {build.createdBy}
59 {build.buildSeconds != null && ` · built in ${build.buildSeconds} s`}
60 </p>
61 {build.status === "ready" && (
62 <a href={build.url} className="mt-3 inline-flex items-center gap-1.5 font-mono text-sm text-accent hover:underline">
63 {build.url.replace("https://", "")}
64 <ExternalLink size={12} />
65 </a>
66 )}
Usage, Billing settings and prepaid AI credit; fixes from the UX audit67 {error && (
68 <p className="mt-4 rounded-lg border border-danger/30 bg-danger/5 px-4 py-3 text-sm [overflow-wrap:anywhere]">{error}</p>
Deployments: a preview for every pull request, production on g1t.page69 )}
70 {build.warnings.length > 0 && (
71 <ul className="mt-4 space-y-1 rounded-lg border border-warn/30 bg-warn/5 px-4 py-3 text-sm">
72 {build.warnings.map((warning) => (
73 <li key={warning}>{warning}</li>
74 ))}
75 </ul>
76 )}
77 <h2 className="mt-8 text-sm font-medium text-muted">Build log</h2>
Usage, Billing settings and prepaid AI credit; fixes from the UX audit78 {/* Long lines wrap, so a narrow screen shows the whole log without scrolling sideways. */}
79 <pre className="mt-3 max-h-[70vh] overflow-auto whitespace-pre-wrap rounded-xl border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-muted [overflow-wrap:anywhere]">
Deployments: a preview for every pull request, production on g1t.page80 {build.log || (build.status === "queued" || build.status === "building" ? "The log appears when the build finishes." : "No log.")}
81 </pre>
82 </div>
83 );
84}