The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 60 lines 2.01 KB
Raw
1 import { T, useGT } from "gt-react";
2 import type { PullRequestReviewGuideNote } from "@t3tools/contracts";
3
4 import { cn } from "~/lib/utils";
5
6 import { GuideProse } from "./GuideProse";
7
8 export function GuideNoteMarker({ marker }: { marker: string }) {
9 return (
10 <span
11 aria-hidden
12 className="inline-flex size-4.5 shrink-0 items-center justify-center rounded-full bg-info/16 font-medium text-3xs text-info-foreground tabular-nums"
13 >
14 {marker}
15 </span>
16 );
17 }
18
19 export function GuideNotes({
20 notes,
21 className,
22 }: {
23 notes: ReadonlyArray<{ readonly marker: string; readonly note: PullRequestReviewGuideNote }>;
24 className?: string;
25 }) {
26 const gt = useGT();
27 if (notes.length === 0) return null;
28 return (
29 <section className={cn("flex min-w-0 flex-col gap-2", className)}>
30 <h4 className="flex items-baseline justify-between gap-2 text-xs font-medium text-foreground">
31 <T>Notes on this stop</T>
32 <span className="font-normal text-muted-foreground tabular-nums">
33 {gt("{count, plural, one {{count} note} other {{count} notes}}", {
34 count: notes.length,
35 })}
36 </span>
37 </h4>
38 <ol className="flex flex-col gap-3">
39 {notes.map(({ marker, note }) => (
40 <li key={marker} className="flex min-w-0 gap-2">
41 <GuideNoteMarker marker={marker} />
42 <div className="flex min-w-0 flex-col gap-0.5">
43 <p className="flex flex-wrap items-baseline gap-x-2 text-xs">
44 <span className="font-medium text-foreground">{note.title}</span>
45 <span className="truncate font-mono text-2xs text-muted-foreground">
46 {note.path.split("/").at(-1)}:{note.line}
47 </span>
48 </p>
49 {note.body.trim() !== "" ? (
50 <div className="text-xs text-muted-foreground">
51 <GuideProse text={note.body} />
52 </div>
53 ) : null}
54 </div>
55 </li>
56 ))}
57 </ol>
58 </section>
59 );
60 }