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/components/repo-list.tsx

69 lines2,376 bytesCodeBlame
1import { BookMarked, CircleDot, GitPullRequest, Lock } from "lucide-react";
2import { Link } from "react-router";
3
4import type { Repo } from "@g1t/contracts";
5
6import { EmptyState, Pill, TimeAgo } from "./ui";
7
8export function RepoList({
9 repos,
10 open,
11}: {
12 repos: Repo[];
13 /** Open issues and pull requests by repository id, where known. */
14 open?: Record<string, { issues: number; pulls: number }>;
15}) {
16 if (repos.length === 0) {
17 return (
18 <div className="mt-4">
19 <EmptyState title="No repositories yet" />
20 </div>
21 );
22 }
23 return (
24 <ul className="mt-4 grid gap-3 sm:grid-cols-2">
25 {repos.map((repo) => (
26 <li key={repo.id}>
27 <Link
28 prefetch="intent"
29 to={`/${repo.namespace}/${repo.name}`}
30 className="flex h-full flex-col rounded-xl border border-line bg-surface p-4 transition-colors hover:border-line-strong"
31 >
32 <span className="flex items-center gap-2">
33 {repo.isPrivate ? (
34 <Lock size={15} className="text-faint" />
35 ) : (
36 <BookMarked size={15} className="text-faint" />
37 )}
38 <span className="truncate font-mono text-sm">
39 <span className="text-muted">{repo.namespace}/</span>
40 <span className="font-medium">{repo.name}</span>
41 </span>
42 {repo.isPrivate && <Pill>private</Pill>}
43 </span>
44 <span className="mt-2 line-clamp-2 grow text-sm text-muted">
45 {repo.description ?? "No description."}
46 </span>
47 <span className="mt-3 flex items-center gap-3 text-xs text-faint">
48 <span className="grow">
49 Created <TimeAgo at={repo.createdAt} />
50 </span>
51 {open?.[repo.id] && (
52 <>
53 <span className="flex items-center gap-1" title="Open issues">
54 <CircleDot size={12} />
55 {open[repo.id].issues}
56 </span>
57 <span className="flex items-center gap-1" title="Pull requests in progress">
58 <GitPullRequest size={12} />
59 {open[repo.id].pulls}
60 </span>
61 </>
62 )}
63 </span>
64 </Link>
65 </li>
66 ))}
67 </ul>
68 );
69}