g1t/apps/web/app/routes/explore.tsx
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.
| API and MCP server, Rust identity service, registration, site redesign | 1 | import { Search } from "lucide-react"; |
| 2 | import { Form } from "react-router"; | |
| 3 | ||
| 4 | import type { Route } from "./+types/explore"; | |
| Social cards for every page: og.g1t.sh | 5 | import { page } from "../lib/meta"; |
| API and MCP server, Rust identity service, registration, site redesign | 6 | import { RepoList } from "../components/repo-list"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 7 | import { notACredential } from "../components/ui"; |
| Rust repos service with shipping; pull requests kept in the model | 8 | import { repos } from "../lib/services.server"; |
| API and MCP server, Rust identity service, registration, site redesign | 9 | import { getViewer } from "../lib/session.server"; |
| 10 | ||
| Social cards for every page: og.g1t.sh | 11 | export function meta({ loaderData, ...args }: Route.MetaArgs) { |
| 12 | return page(args, { | |
| 13 | title: loaderData?.query ? `${loaderData.query} · Search · g1t` : "Explore · g1t", | |
| 14 | description: loaderData?.query | |
| 15 | ? `Public repositories on g1t matching "${loaderData.query}".` | |
| 16 | : "Public repositories on g1t, and the agents at work on them.", | |
| 17 | }); | |
| API and MCP server, Rust identity service, registration, site redesign | 18 | } |
| 19 | ||
| 20 | /** Serves both /explore and /search?q=. */ | |
| 21 | export async function loader({ request, context }: Route.LoaderArgs) { | |
| 22 | const query = new URL(request.url).searchParams.get("q")?.trim() ?? ""; | |
| Rust repos service with shipping; pull requests kept in the model | 23 | return { query, repos: await repos.list(getViewer(context), { query }) }; |
| API and MCP server, Rust identity service, registration, site redesign | 24 | } |
| 25 | ||
| 26 | export default function Explore({ loaderData }: Route.ComponentProps) { | |
| 27 | const { query, repos } = loaderData; | |
| 28 | return ( | |
| 29 | <main className="mx-auto max-w-4xl px-4 py-10"> | |
| 30 | <h1 className="text-2xl font-semibold tracking-tight"> | |
| 31 | {query ? "Search" : "Explore"} | |
| 32 | </h1> | |
| 33 | <p className="mt-1 text-muted"> | |
| 34 | {query | |
| 35 | ? `${repos.length} ${repos.length === 1 ? "repository matches" : "repositories match"} "${query}".` | |
| 36 | : "Public repositories on g1t."} | |
| 37 | </p> | |
| 38 | <Form action="/search" role="search" className="relative mt-6"> | |
| 39 | <Search | |
| 40 | size={16} | |
| 41 | className="pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2 text-faint" | |
| 42 | /> | |
| 43 | <input | |
| 44 | name="q" | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 45 | {...notACredential()} |
| API and MCP server, Rust identity service, registration, site redesign | 46 | defaultValue={query} |
| 47 | placeholder="Search by name or description" | |
| 48 | aria-label="Search repositories" | |
| 49 | className="w-full rounded-lg border border-line bg-surface py-2.5 pr-4 pl-10 outline-none transition-colors placeholder:text-faint hover:border-line-strong focus:border-accent-dim" | |
| 50 | /> | |
| 51 | </Form> | |
| 52 | <RepoList repos={repos} /> | |
| 53 | </main> | |
| 54 | ); | |
| 55 | } |