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.
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1 | import { Box, Lock } from "lucide-react"; |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 2 | import { Link, NavLink, Outlet, type ShouldRevalidateFunctionArgs, data, useLocation, useRouteLoaderData } from "react-router"; |
| Projects: what a workspace builds and runs, first on every page | 3 | |
| 4 | import type { Project } from "@g1t/contracts"; | |
| Initial g1t: services, event bus, intents and attempts | 5 | |
| 6 | import type { Route } from "./+types/layout"; | |
| Topics sit in About on the files pages, under the description | 7 | import { Topics } from "../../components/topics"; |
| Social cards for every page: og.g1t.sh | 8 | import { page } from "../../lib/meta"; |
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 9 | import { type Tab as PageTab, tabsFor } from "../../lib/project-nav"; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 10 | import { Pill } from "../../components/ui"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 11 | import { ArchivedBanner } from "../../components/repo-lifecycle"; |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 12 | import { WelcomeBanner } from "../../components/welcome"; |
| 13 | import { clearWelcome, welcomes } from "../../lib/invites"; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 14 | import { notFound } from "../../lib/not-found.server"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 15 | import { redirectIfRenamed, redirectIfTransferred } from "../../lib/renamed.server"; |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 16 | import { accessFor, countsFor, repoFor } from "../../lib/access.server"; |
| 17 | import { projects } from "../../lib/services.server"; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 18 | import { getViewer, unwrap } from "../../lib/session.server"; |
| Initial g1t: services, event bus, intents and attempts | 19 | |
| Social cards for every page: og.g1t.sh | 20 | export function meta({ loaderData: loaded, params, ...args }: Route.MetaArgs) { |
| 21 | return page(args, { title: `${loaded?.project?.name ?? params.repo} · ${params.owner} · g1t` }); | |
| Initial g1t: services, event bus, intents and attempts | 22 | } |
| 23 | ||
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 24 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| Initial g1t: services, event bus, intents and attempts | 25 | const viewer = getViewer(context); |
| 26 | const path = { namespace: params.owner, name: params.repo }; | |
| Projects: what a workspace builds and runs, first on every page | 27 | const [repo, counts, found] = await Promise.all([ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 28 | repoFor(context, params), |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 29 | countsFor(context, params), |
| Projects: what a workspace builds and runs, first on every page | 30 | projects.get(params.owner, params.repo, viewer), |
| Initial g1t: services, event bus, intents and attempts | 31 | ]); |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 32 | if (!repo.ok && !found.ok) { |
| 33 | // Under a workspace's old name, after a rename: the project is at the new one. | |
| 34 | await redirectIfRenamed(request, params.owner); | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 35 | // A repository transferred to another workspace: it is there now. |
| 36 | await redirectIfTransferred(request, params.owner, params.repo, viewer); | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 37 | throw notFound("project"); |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 38 | } |
| Projects: what a workspace builds and runs, first on every page | 39 | let project: Project | null = found.ok ? found.value : null; |
| 40 | // A repository made a moment ago, before its project: make it now. | |
| 41 | if (!project && repo.ok && !repo.value.forkOf) { | |
| 42 | const own = await projects.byRepo(repo.value.id); | |
| 43 | project = own.find((p) => p.slug === params.repo.toLowerCase()) ?? own[0] ?? null; | |
| 44 | } | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 45 | const value = unwrap(repo); |
| 46 | // The viewer's role on the repository and what it lets them do, for the | |
| 47 | // pages under it and the sidebar. | |
| 48 | const access = accessFor(viewer, value); | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 49 | // Just given access with an invite: welcomed once (routes/invite.tsx). |
| 50 | const welcome = Boolean(access.role) && welcomes(request.headers.get("cookie"), `${value.namespace}/${value.name}`); | |
| 51 | const headers = welcome ? { "Set-Cookie": clearWelcome(new URL(request.url).protocol === "https:") } : undefined; | |
| 52 | return data({ | |
| 53 | welcome, | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 54 | repo: value, |
| Projects: what a workspace builds and runs, first on every page | 55 | project, |
| Issues and pull requests replace intents and attempts | 56 | open: counts.ok ? counts.value : { issues: 0, pulls: 0 }, |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 57 | access, |
| 58 | member: access.insider, | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 59 | }, { headers }); |
| Initial g1t: services, event bus, intents and attempts | 60 | } |
| 61 | ||
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 62 | /** |
| 63 | * The project's header, tabs and the viewer's role change with the project | |
| 64 | * or after something was submitted, not from one page of it to the next, | |
| 65 | * nor when a page refreshes itself. | |
| 66 | */ | |
| 67 | export function shouldRevalidate({ currentParams, nextParams, formMethod, defaultShouldRevalidate }: ShouldRevalidateFunctionArgs) { | |
| 68 | if (formMethod && formMethod !== "GET") return defaultShouldRevalidate; | |
| 69 | return currentParams.owner !== nextParams.owner || currentParams.repo !== nextParams.repo; | |
| 70 | } | |
| 71 | ||
| Projects: what a workspace builds and runs, first on every page | 72 | /** The project the page is in, for the pages under it. */ |
| 73 | export function useProject() { | |
| 74 | return useRouteLoaderData<typeof loader>("routes/repo/layout"); | |
| 75 | } | |
| 76 | ||
| Search across all of g1t, Explore, and a command palette | 77 | /** A repository's topics, each a way into Explore. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 78 | function Header({ project, isPrivate, archived, namespace, name, description, large }: { |
| Projects: what a workspace builds and runs, first on every page | 79 | project: Project | null; |
| 80 | isPrivate: boolean; | |
| 81 | namespace: string; | |
| 82 | name: string; | |
| 83 | description: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 84 | archived?: boolean; |
| Projects: what a workspace builds and runs, first on every page | 85 | large?: boolean; |
| 86 | }) { | |
| 87 | const base = `/${namespace}/${name}`; | |
| 88 | return ( | |
| 89 | <div className="flex flex-wrap items-center gap-x-3 gap-y-1"> | |
| 90 | <span | |
| 91 | className={`flex shrink-0 items-center justify-center rounded-md bg-raised text-muted ring-1 ring-line ${large ? "size-8" : "size-6"}`} | |
| 92 | > | |
| 93 | {isPrivate ? <Lock size={large ? 15 : 13} /> : <Box size={large ? 15 : 13} />} | |
| 94 | </span> | |
| 95 | <h1 className={large ? "text-lg" : "text-[0.9375rem]"}> | |
| 96 | <Link to={`/${namespace}`} className="font-mono text-muted hover:text-fg"> | |
| 97 | {namespace} | |
| 98 | </Link> | |
| 99 | <span className="mx-1.5 text-faint">/</span> | |
| 100 | <Link to={base} className="font-semibold hover:underline"> | |
| 101 | {project?.name ?? name} | |
| 102 | </Link> | |
| 103 | </h1> | |
| 104 | <Pill>{isPrivate ? "private" : "public"}</Pill> | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 105 | {archived && <Pill>archived</Pill>} |
| Projects: what a workspace builds and runs, first on every page | 106 | {description && <p className="min-w-0 truncate text-sm text-muted">{description}</p>} |
| 107 | </div> | |
| 108 | ); | |
| 109 | } | |
| 110 | ||
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 111 | /** |
| 112 | * The views of the page the project is on, as tabs across its top: Files, | |
| 113 | * Commits and what is coming under Code, and so on. Soon tabs open their | |
| 114 | * roadmap page, under the same tabs. | |
| 115 | */ | |
| 116 | function PageTabs({ base, tabs }: { base: string; tabs: PageTab[] }) { | |
| 117 | const { pathname } = useLocation(); | |
| 118 | const rest = pathname.slice(base.length + 1); | |
| 119 | const current = (tab: PageTab) => | |
| 120 | [tab.path, ...(tab.also ?? [])].some((path) => rest === path || rest.startsWith(`${path}/`)); | |
| 121 | return ( | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 122 | <nav aria-label="Views" className="relative -mb-px flex gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"> |
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 123 | {tabs.map((tab) => ( |
| 124 | <NavLink | |
| 125 | key={tab.path} | |
| 126 | to={`${base}/${tab.path}`} | |
| 127 | title={tab.about} | |
| 128 | prefetch="intent" | |
| 129 | className={`flex shrink-0 items-center gap-1.5 border-b-2 px-3 pt-1 pb-2.5 text-sm transition-colors ${ | |
| 130 | current(tab) | |
| 131 | ? "border-accent font-medium text-fg" | |
| 132 | : tab.soon | |
| 133 | ? "border-transparent text-faint hover:text-muted" | |
| 134 | : "border-transparent text-muted hover:text-fg" | |
| 135 | }`} | |
| 136 | > | |
| 137 | {tab.label} | |
| Observability gets its own page; tabs never overflow | 138 | {/* Soon, said quietly: a dot, with the word for screen readers. */} |
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 139 | {tab.soon && ( |
| Observability gets its own page; tabs never overflow | 140 | <> |
| 141 | <span aria-hidden="true" className="size-1.5 rounded-full bg-accent/70" /> | |
| 142 | <span className="sr-only">(soon)</span> | |
| 143 | </> | |
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 144 | )} |
| 145 | </NavLink> | |
| 146 | ))} | |
| 147 | </nav> | |
| 148 | ); | |
| 149 | } | |
| 150 | ||
| Projects: what a workspace builds and runs, first on every page | 151 | export default function ProjectLayout({ loaderData }: Route.ComponentProps) { |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 152 | const { repo, project, member, access, welcome } = loaderData; |
| Initial g1t: services, event bus, intents and attempts | 153 | const base = `/${repo.namespace}/${repo.name}`; |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 154 | // The project's own description, else the repository's as it is now. |
| 155 | const description = (project && !project.descriptionInherited ? project.description : null) ?? repo.description; | |
| A flat project menu with Code first, views as tabs, and Stripe for every owner | 156 | const { pathname } = useLocation(); |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 157 | const tabs = tabsFor(pathname.slice(base.length + 1), member, access.can); |
| Topics sit in About on the files pages, under the description | 158 | // The files' own About says what it is and its topics, as the one place. |
| Compare: any two branches, the commits one has that the other does not, and the diff, with Open a pull request | 159 | const filesPage = /^(code|tree|blob|commits?|branches|tags|compare)(\/|$)/.test(pathname.slice(base.length + 1)); |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 160 | // Everyone, signed in or not, finds the project's pages in the sidebar; |
| 161 | // the page shows its name, and the views of the page it is on as tabs. | |
| Initial g1t: services, event bus, intents and attempts | 162 | return ( |
| API and MCP server, Rust identity service, registration, site redesign | 163 | <> |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 164 | <div className="border-b border-line"> |
| 165 | <div className={`mx-auto max-w-6xl px-4 sm:px-6 ${tabs ? "pt-3" : "py-3"}`}> | |
| Projects: what a workspace builds and runs, first on every page | 166 | <Header |
| 167 | project={project} | |
| 168 | isPrivate={repo.isPrivate} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 169 | archived={Boolean(repo.archivedAt)} |
| Projects: what a workspace builds and runs, first on every page | 170 | namespace={repo.namespace} |
| 171 | name={repo.name} | |
| Files pages say Files in the trail and keep the description in About only | 172 | // The files' own About says it there, as the one place. |
| Topics sit in About on the files pages, under the description | 173 | description={filesPage ? null : description} |
| Projects: what a workspace builds and runs, first on every page | 174 | /> |
| Topics sit in About on the files pages, under the description | 175 | {/* On the files' pages, About shows them. */} |
| 176 | {!filesPage && <Topics topics={repo.topics} />} | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 177 | {tabs && ( |
| 178 | <div className="mt-3"> | |
| 179 | <PageTabs base={base} tabs={tabs} /> | |
| 180 | </div> | |
| 181 | )} | |
| API and MCP server, Rust identity service, registration, site redesign | 182 | </div> |
| 183 | </div> | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 184 | <div className="mx-auto max-w-6xl px-4 py-6 sm:px-6"> |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 185 | {welcome && ( |
| 186 | <div className="mb-6"> | |
| 187 | <WelcomeBanner title={`You're in ${repo.namespace}/${repo.name}`}> | |
| 188 | You have the {access.role} role on it now. Its code, issues and pull requests are yours to work on. | |
| 189 | </WelcomeBanner> | |
| 190 | </div> | |
| 191 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 192 | {repo.archivedAt && ( |
| 193 | <div className="mb-6"> | |
| 194 | <ArchivedBanner base={base} owner={access.can.administer} settings={/^settings(\/|$)/.test(pathname.slice(base.length + 1))} /> | |
| 195 | </div> | |
| 196 | )} | |
| API and MCP server, Rust identity service, registration, site redesign | 197 | <Outlet /> |
| 198 | </div> | |
| 199 | </> | |
| Initial g1t: services, event bus, intents and attempts | 200 | ); |
| 201 | } |