flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/web/app/routes/repo/tree.tsx

21 lines800 bytesCodeBlame
1import type { Route } from "./+types/tree";
2import { page } from "../../lib/meta";
3import { TreeView } from "../../components/repo-view";
4import { repos } from "../../lib/services.server";
5import { getViewer, unwrap } from "../../lib/session.server";
6
7export function meta({ params, ...args }: Route.MetaArgs) {
8 const path = params["*"] ? `${params["*"]} · ` : "";
9 return page(args, { title: `${path}${params.owner}/${params.repo} · g1t` });
10}
11
12export async function loader({ params, context }: Route.LoaderArgs) {
13 const path = { namespace: params.owner, name: params.repo };
14 return unwrap(
15 await repos.tree(path, getViewer(context), params.ref, params["*"] ?? ""),
16 );
17}
18
19export default function Tree({ loaderData }: Route.ComponentProps) {
20 return <TreeView tree={loaderData} />;
21}