Skip to content

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.sh
53 linesCodeBlameRaw
1import { AgentAvatar } from "../agent-avatar";
2import { WithPresence } from "../presence";
3
4import { cn } from "../../lib/cn";
5import { Avatar } from "../ui/avatar";
6
7/**
8 * A member's face: a person's avatar, or, on an old message from an agent
9 * that no longer exists (or one from g1t), a plain tile with the agent
10 * marker (components/ui/avatar.tsx). With `presence`, a person's carries
11 * their dot (active, away, notifications paused; components/presence.tsx),
12 * cut out of `ring`, the colour behind it, which also rings the marker.
13 */
14export function MemberAvatar({
15 member,
16 size = 20,
17 presence = false,
18 ring,
19}: {
20 member: { kind: "user" | "agent" | "system"; id?: string; name: string; avatar: string | null };
21 size?: number;
22 presence?: boolean;
23 ring?: string;
24}) {
25 // @g1t: the g1t mark, with the agent marker.
26 if (member.kind === "system") return <Avatar name="g1t" system agent size={size} ring={ring} />;
27 if (member.kind === "agent") return <AgentAvatar agent={member} size={size} ring={ring} />;
28 const avatar = <Avatar name={member.name} image={member.avatar} size={size} />;
29 if (!presence) return avatar;
30 return (
31 <WithPresence person={{ id: member.id, username: member.name }} size={size} ring={ring}>
32 {avatar}
33 </WithPresence>
34 );
35}
36
37/**
38 * AGENT beside the name an old message from an agent was posted under;
39 * DELETED AGENT, in the quiet colours, when chat says it was deleted.
40 */
41export function AgentPill({ className, deleted = false }: { className?: string; deleted?: boolean }) {
42 return (
43 <span
44 className={cn(
45 "inline-flex h-4 shrink-0 items-center rounded-sm bg-accent/15 px-1 text-[0.5625rem] font-semibold tracking-[0.06em] text-accent uppercase",
46 deleted && "bg-raised text-muted",
47 className,
48 )}
49 >
50 {deleted ? "Deleted agent" : "Agent"}
51 </span>
52 );
53}