Skip to content
86 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.

Merge branch 'main' into worktree-agent-a69aeabc4b0deeb971/**
2 * A release as the Releases page and its own page show it: when and of
3 * which tag and commit on the left, its title, notes and downloads on the
4 * right; one above the other on a phone.
5 */
6import { FileArchive, GitCommitHorizontal, Tag as TagIcon } from "lucide-react";
7import { Link } from "react-router";
8
9import type { Release, RepoPath } from "@g1t/contracts";
10
11import { Markdown } from "./markdown";
12import { Pill, TimeAgo } from "./ui";
Merge commit authors and hovercards: commits show their accounts, every name opens a card (repos 0016)13import { UserCard } from "./user-card";
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9714
15export function encodeTag(tag: string): string {
16 return tag.split("/").map(encodeURIComponent).join("/");
17}
18
19export function ReleaseCard({ release, repo, linkTitle = true }: { release: Release; repo: RepoPath; linkTitle?: boolean }) {
20 const base = `/${repo.namespace}/${repo.name}`;
21 const title = release.name || release.tagName;
22 const when = release.publishedAt ?? release.createdAt;
23 return (
24 <article className="grid gap-4 md:grid-cols-[10rem_minmax(0,1fr)] md:gap-6">
25 <div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 text-sm text-muted md:flex-col md:items-start md:pt-4">
26 <span className="text-faint">
27 <TimeAgo at={when} />
28 </span>
29 <Link to={`${base}/tree/${encodeTag(release.tagName)}`} className="inline-flex min-w-0 items-center gap-1.5 font-mono text-[0.8125rem] hover:text-accent">
30 <TagIcon size={14} className="shrink-0 text-faint" />
31 <span className="truncate">{release.tagName}</span>
32 </Link>
33 <Link to={`${base}/commit/${release.target}`} className="inline-flex items-center gap-1.5 font-mono text-[0.8125rem] hover:text-accent">
34 <GitCommitHorizontal size={14} className="shrink-0 text-faint" />
35 {release.target.slice(0, 7)}
36 </Link>
37 </div>
38 <div className="min-w-0 overflow-hidden rounded-xl border border-line bg-surface">
39 <div className="border-b border-line px-5 py-4">
40 <div className="flex flex-wrap items-center gap-2">
41 <h3 className="min-w-0 text-xl font-semibold tracking-tight break-words">
42 {linkTitle ? (
43 <Link to={`${base}/releases/tag/${encodeTag(release.tagName)}`} className="hover:text-accent hover:underline">
44 {title}
45 </Link>
46 ) : (
47 title
48 )}
49 </h3>
50 {release.latest && <Pill>Latest</Pill>}
51 {release.prerelease && <Pill>Pre-release</Pill>}
52 {release.draft && <Pill>Draft</Pill>}
53 </div>
54 {release.author && (
55 <p className="mt-1 text-xs text-faint">
Merge commit authors and hovercards: commits show their accounts, every name opens a card (repos 0016)56 <UserCard username={release.author}>
57 <Link to={`/u/${release.author}`} className="font-medium text-muted hover:text-accent">
58 {release.author}
59 </Link>
60 </UserCard>{" "}
Merge branch 'main' into worktree-agent-a69aeabc4b0deeb9761 {release.draft ? "drafted this" : "released this"} <TimeAgo at={when} />
62 </p>
63 )}
64 </div>
65 <div className="px-5 py-4">
66 {release.body.trim() ? (
67 <Markdown source={release.body} repo={repo} base={`${base}/blob/${encodeTag(release.tagName)}`} />
68 ) : (
69 <p className="text-sm text-faint">No notes.</p>
70 )}
71 </div>
72 <div className="border-t border-line px-5 py-3">
73 <h4 className="mb-2 text-xs font-medium tracking-wide text-faint uppercase">Downloads</h4>
74 <a
75 href={`${base}/archive/${encodeTag(release.tagName)}.zip`}
76 download
77 className="inline-flex items-center gap-2 text-sm text-muted hover:text-accent"
78 >
79 <FileArchive size={14} className="text-faint" />
80 Source code (zip)
81 </a>
82 </div>
83 </div>
84 </article>
85 );
86}

This file's history is long; its oldest lines are credited to the oldest commit read.