import Link from "next/link";
import type { ReactNode } from "react";
import { Surface } from "@unlocalhosted/metalui";
import { ActorAvatar, ActorName } from "./agent";
import { Markdown } from "./markdown";
import { Label } from "./ui";
import { formatDate, timeAgo } from "@/lib/format";
// The parts of an issue's or pull request's conversation: comments on raised plates beside their
// author, and events as lines on the activity rail.
export function CommentBox({
author,
agent,
createdAt,
body,
verb = "commented",
badge,
children,
}: {
author: string;
agent?: string | null;
createdAt: number;
body: string;
verb?: ReactNode;
badge?: ReactNode;
children?: ReactNode;
}) {
return (
{verb} {timeAgo(createdAt)}
{badge && {badge}}
{body.trim() ? (
{body}
) : (
!children &&
No description.
)}
{children &&
{children}
}
);
}
/** A point on the activity rail: a small sunk well on the page, holding the event's glyph or an unlit dot. */
export function TimelineDot({ children }: { children?: ReactNode }) {
return (
{children ?? }
);
}
/** One line on the rail: who did what, when. */
export function TimelineEvent({ icon, actor, agent, at, children }: { icon?: ReactNode; actor: string | null; agent?: string | null; at: number; children: ReactNode }) {
return (