Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

UserMessageContextChips.tsx

657 lines24.1 KB

1import { msg, T, useGT, useMessages } from "gt-react";
2import type { MessageResolver } from "~/i18n/messages";
3import { useNativeFileDrag } from "../../useNativeFileDrag";
4import { resolvePathLinkTarget } from "@t3tools/shared/fileLinks";
5import { documentChipKindForFileName } from "~/pierre-icons";
6import { isSvgAttachment } from "@t3tools/shared/image";
7import { useRenderedAppearance } from "../../hooks/useTheme";
8import { PullRequestGlyph } from "../pullRequest/pullRequestIcons";
9import { ReadOnlySourcePreview } from "../files/AttachmentFilePreview";
10import { useRightPanelStore } from "~/rightPanelStore";
11import { COMPOSER_CONTEXT_KINDS } from "@t3tools/contracts";
12import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments";
13import { use, type ReactNode } from "react";
14import { FileDiff } from "@pierre/diffs/react";
15import { DiffWorkerPoolProvider } from "../DiffWorkerPoolProvider";
16import {
17 type ChatFileAttachment,
18 type ChatImageAttachment,
19 isImageAttachment,
20 isVideoAttachment,
21} from "../../types";
22import {
23 getRenderablePatch,
24 resolveDiffThemeName,
25 resolveFileDiffPath,
26} from "../../lib/diffRendering";
27import { PREFERRED_HIGHLIGHTER } from "../../lib/syntaxHighlighting";
28import ChatMarkdown from "../ChatMarkdown";
29import { EnvironmentContextChip } from "../EnvironmentContextChip";
30import { ThreadContextChip } from "../ThreadContextChip";
31import { ResponseReplyCard } from "./AssistantCitationChip";
32import { MessageCircleIcon, MousePointerClickIcon, PaintbrushIcon } from "lucide-react";
33import type { ComposerContextId, KnownComposerContextRecord } from "@t3tools/contracts";
34import { buildExpandedImagePreview } from "./ExpandedImagePreview";
35import { WorkspaceEntryIcon, WorkspaceEntryTooltip } from "./WorkspaceEntryIcon";
36import { TerminalContextInlineChip } from "./TerminalContextInlineChip";
37import {
38 ContextChipPopover as UserMessageContextPopover,
39 FileChip,
40 ImageChipButton,
41 PULL_REQUEST_CHIP_KINDS,
42 PullRequestChip,
43 UnresolvedChip,
44} from "../contextChipParts";
45import {
46 isPullRequestSummaryContext,
47 previewAnnotationTargetText,
48 pullRequestContextDisplayState,
49 pullRequestContextKindLabel,
50 reviewCommentContextLabel,
51 reviewCommentRangeText,
52 reviewCommentSectionText,
53} from "~/lib/composerContextRecords";
54import { formatComposerContextReference } from "@t3tools/shared/composerContextReferences";
55import { ContextChip, ContextChipLabel, type ContextChipKind } from "../ContextChip";
56import { createContextPresentationRegistry } from "../contextPresentationRegistry";
57import type { ChatMarkdownContextReference } from "../ChatMarkdown";
58import {
59 SkillChipPopover,
60 skillInstructionsOpener,
61 skillPopoverDescription,
62} from "./SkillInlineText";
63import { formatWorkspaceRelativePath } from "../../filePathDisplay";
64import {
65 buildReviewCommentRenderablePatch,
66 formatReviewCommentFence,
67 type ReviewCommentContext,
68} from "../../reviewCommentContext";
69import { TimelineRowCtx } from "./timelineRowContext";
70import { userMessageFileLabel } from "./TimelineUserMessageRow.logic";
71import { SharedTooltipTrigger } from "../ui/shared-tooltip";
72​
73function UserMessageMentionChip(props: {
74 record: Extract<KnownComposerContextRecord, { kind: "mention" }>;
75 copyMarkdown: string;
76}) {
77 const gt = useGT();
78 const ctx = use(TimelineRowCtx);
79 const nativeDrag = useNativeFileDrag(ctx.activeThreadEnvironmentId, () =>
80 resolvePathLinkTarget(props.record.path, ctx.workspaceRoot ?? ""),
81 );
82 return (
83 <SharedTooltipTrigger
84 render={
85 <ContextChip
86 {...nativeDrag}
87 kind={documentChipKindForFileName(props.record.path) ?? "mention"}
88 render={<button type="button" />}
89 aria-label={gt("Preview {name}", { name: props.record.path })}
90 data-markdown-copy={props.copyMarkdown}
91 onClick={() => {
92 if (ctx.threadRef)
93 useRightPanelStore.getState().openFile(ctx.threadRef, props.record.path);
94 }}
95 >
96 <WorkspaceEntryIcon
97 path={props.record.path}
98 environmentId={ctx.activeThreadEnvironmentId}
99 cwd={ctx.workspaceRoot}
100 theme={ctx.resolvedTheme}
101 />
102 <ContextChipLabel>{props.record.label}</ContextChipLabel>
103 </ContextChip>
104 }
105 label={
106 <>
107 <WorkspaceEntryTooltip
108 path={props.record.path}
109 environmentId={ctx.activeThreadEnvironmentId}
110 cwd={ctx.workspaceRoot}
111 />
112 </>
113 }
114 className="pointer-events-auto"
115 />
116 );
118​
119function UserMessageSkillChip(props: {
120 record: Extract<KnownComposerContextRecord, { kind: "skill" }>;
121 copyMarkdown: string;
122}) {
123 const { skills, threadRef } = use(TimelineRowCtx);
124 const skill = skills.find((candidate) => candidate.name === props.record.name);
125 return (
126 <SkillChipPopover
127 label={props.record.label || props.record.name}
128 description={skill ? skillPopoverDescription(skill) : null}
129 copyMarkdown={props.copyMarkdown}
130 onViewInstructions={skillInstructionsOpener(threadRef, skill)}
131 />
132 );
134​
135function UserMessagePullRequestContextChip(props: {
136 record: Extract<KnownComposerContextRecord, { kind: "review-comment" }>;
137 copyMarkdown: string;
138 kind: ContextChipKind;
139}) {
140 const { activeThreadEnvironmentId, openPullRequest } = use(TimelineRowCtx);
141 const messages = useMessages();
142 const metadata = props.record.pullRequest;
143 if (metadata === undefined) return null;
144 return (
145 <PullRequestChip
146 metadata={metadata}
147 environmentId={activeThreadEnvironmentId}
148 label={reviewCommentContextLabel(props.record, messages)}
149 kindLabel={pullRequestContextKindLabel(props.record, messages)}
150 kind={props.kind}
151 copyMarkdown={props.copyMarkdown}
152 onOpen={openPullRequest}
153 />
154 );
156​
157function UserMessagePreviewAnnotationDetails(props: {
158 record: Extract<KnownComposerContextRecord, { kind: "preview-annotation" }>;
159 image: ChatImageAttachment | null;
160}) {
161 const ctx = use(TimelineRowCtx);
162 const gt = useGT();
163 const messages = useMessages();
164 const visibleElements = props.record.elements ?? [];
165 const targetText = previewAnnotationTargetText(props.record, messages);
166 return (
167 <div className="max-w-full overflow-hidden rounded-lg border border-border/70 bg-background/70">
168 {props.image?.previewUrl ? (
169 <button
170 type="button"
171 className="block max-h-64 w-full cursor-zoom-in overflow-hidden border-b border-border/70 bg-muted"
172 aria-label={gt("Preview {name}", { name: props.image.name })}
173 onClick={() => {
174 if (!props.image) return;
175 const preview = buildExpandedImagePreview([props.image], props.image.id);
176 if (preview) ctx.onImageExpand(preview);
177 }}
178 >
179 <img
180 src={props.image.previewUrl}
181 alt={gt("Annotated preview crop")}
182 className="max-h-64 w-full object-contain"
183 />
184 </button>
185 ) : (
186 <div className="border-b border-border/70 bg-muted/40 px-3 py-2 text-secondary-label text-xs">
187 <T>Screenshot unavailable</T>
188 </div>
189 )}
190 <div className="min-w-0 px-3 py-2.5">
191 <div className="text-message-foreground text-xs font-medium">
192 {props.record.pageTitle?.trim() || props.record.pageUrl || gt("Preview annotation")}
193 </div>
194 {props.record.comment ? (
195 <div className="mt-1 whitespace-pre-wrap wrap-break-word text-sm">
196 {props.record.comment}
197 </div>
198 ) : null}
199 <div className="mt-1 flex items-center gap-2 text-secondary-label text-3xs">
200 {targetText ? <span className="truncate">{targetText}</span> : null}
201 {(props.record.styleChanges?.length ?? 0) > 0 ? (
202 <span className="inline-flex shrink-0 items-center gap-1">
203 <PaintbrushIcon className="size-3" />
204 {props.record.styleChanges?.length ?? 0}
205 </span>
206 ) : null}
207 </div>
208 {visibleElements.length > 0 ? (
209 <div className="mt-2 space-y-2 border-t border-border/60 pt-2">
210 {visibleElements.map((element) => {
211 const source = element.source;
212 const sourceLabel = source?.fileName
213 ? `${source.fileName}${source.lineNumber === null ? "" : `:${source.lineNumber}`}`
214 : null;
215 return (
216 <div
217 key={`${element.selector}\u0000${element.tagName}\u0000${sourceLabel ?? ""}\u0000${element.htmlPreview}`}
218 className="min-w-0"
219 >
220 <div className="flex min-w-0 items-center gap-2 text-xs">
221 <code className="truncate text-message-foreground">
222 {element.selector || `<${element.tagName}>`}
223 </code>
224 {sourceLabel ? (
225 <span className="ml-auto shrink-0 text-secondary-label">{sourceLabel}</span>
226 ) : null}
227 </div>
228 {element.htmlPreview?.trim() ? (
229 <pre className="mt-1 max-h-24 overflow-auto whitespace-pre-wrap rounded bg-muted/60 px-2 py-1.5 text-3xs leading-relaxed">
230 {element.htmlPreview.trim()}
231 </pre>
232 ) : null}
233 </div>
234 );
235 })}
236 </div>
237 ) : null}
238 </div>
239 </div>
240 );
242​
243function UserMessageElementDetails({
244 record,
245}: {
246 record: Extract<KnownComposerContextRecord, { kind: "element" }>;
247}) {
248 const sourceLabel = record.source?.fileName
249 ? `${record.source.fileName}${record.source.lineNumber === null ? "" : `:${record.source.lineNumber}`}`
250 : null;
251 return (
252 <div className="max-w-full overflow-hidden rounded-lg border border-border/70 bg-background/70">
253 <div className="border-b border-border/70 px-3 py-2.5">
254 <div className="truncate text-message-foreground text-xs font-medium">
255 {record.pageTitle?.trim() || record.pageUrl}
256 </div>
257 <div className="mt-0.5 truncate text-secondary-label text-3xs">{record.pageUrl}</div>
258 </div>
259 <div className="space-y-2 px-3 py-2.5">
260 <div className="flex min-w-0 items-center gap-2 text-xs">
261 <code className="truncate text-message-foreground">
262 {record.selector || `<${record.tagName}>`}
263 </code>
264 {sourceLabel ? (
265 <span className="ml-auto shrink-0 text-secondary-label">{sourceLabel}</span>
266 ) : null}
267 </div>
268 {record.htmlPreview?.trim() ? (
269 <div className="flex h-40 flex-col overflow-hidden rounded border border-border">
270 <ReadOnlySourcePreview name="element.html" text={record.htmlPreview} />
271 </div>
272 ) : null}
273 {record.styles?.trim() ? (
274 <div className="flex h-32 flex-col overflow-hidden rounded border border-border">
275 <ReadOnlySourcePreview name="styles.css" text={record.styles} />
276 </div>
277 ) : null}
278 </div>
279 </div>
280 );
282​
283interface UserMessageContextRenderContext {
284 environmentId: import("@t3tools/contracts").EnvironmentId;
285 reference: ChatMarkdownContextReference;
286 annotationImage: ChatImageAttachment | null;
287 attachment: ChatImageAttachment | ChatFileAttachment | null;
288 resolvedTheme: "light" | "dark";
289 copyMarkdown: string;
290 onExpandImage: (image: ChatImageAttachment) => void;
291 onExpandVideo: (file: ChatFileAttachment) => void;
292 onOpenFile: (file: ChatFileAttachment) => void;
293 m: MessageResolver;
295​
296function UnavailableUserMessageContextChip(props: UserMessageContextRenderContext) {
297 return (
298 <UnresolvedChip
299 label={props.reference.label}
300 copyMarkdown={props.copyMarkdown}
301 tooltip={props.m(msg("This context is no longer available."))}
302 />
303 );
305​
306const userMessageContextPresentationRegistry = createContextPresentationRegistry<
307 KnownComposerContextRecord,
308 UserMessageContextRenderContext,
309 ReactNode
310>({
311 requiredKinds: COMPOSER_CONTEXT_KINDS,
312 handlers: [
313 {
314 kind: "mention",
315 canRender: (record) => record.kind === "mention",
316 render: (record, context) =>
317 record.kind === "mention" ? (
318 <UserMessageMentionChip record={record} copyMarkdown={context.copyMarkdown} />
319 ) : (
320 <UnavailableUserMessageContextChip {...context} />
321 ),
322 },
323 {
324 kind: "skill",
325 canRender: (record) => record.kind === "skill",
326 render: (record, context) =>
327 record.kind === "skill" ? (
328 <UserMessageSkillChip record={record} copyMarkdown={context.copyMarkdown} />
329 ) : (
330 <UnavailableUserMessageContextChip {...context} />
331 ),
332 },
333 {
334 kind: "thread",
335 canRender: (record) => record.kind === "thread",
336 render: (record, context) =>
337 record.kind === "thread" ? (
338 <ThreadContextChip record={record} copyMarkdown={context.copyMarkdown} />
339 ) : (
340 <UnavailableUserMessageContextChip {...context} />
341 ),
342 },
343 {
344 kind: "response",
345 canRender: (record) => record.kind === "response",
346 render: (record, context) =>
347 record.kind === "response" ? (
348 <ResponseReplyCard
349 record={record}
350 copyMarkdown={context.copyMarkdown}
351 leading={context.reference.leading ?? false}
352 trailing={context.reference.trailing ?? false}
353 />
354 ) : (
355 <UnavailableUserMessageContextChip {...context} />
356 ),
357 },
358 {
359 kind: "environment",
360 canRender: (record) => record.kind === "environment",
361 render: (record, context) =>
362 record.kind === "environment" ? (
363 <EnvironmentContextChip record={record} copyMarkdown={context.copyMarkdown} />
364 ) : (
365 <UnavailableUserMessageContextChip {...context} />
366 ),
367 },
368 {
369 kind: "image",
370 canRender: (record, context) =>
371 record.kind === "image" &&
372 context.attachment !== null &&
373 isImageAttachment(context.attachment),
374 render: (record, context) => {
375 if (
376 record.kind !== "image" ||
377 context.attachment === null ||
378 !isImageAttachment(context.attachment)
379 ) {
380 return <UnavailableUserMessageContextChip {...context} />;
381 }
382 const attachment = context.attachment;
383 return (
384 <ImageChipButton
385 name={record.name}
386 previewUrl={attachment.previewUrl}
387 size={formatAttachmentSize(record.sizeBytes, context.m)}
388 data-markdown-copy={context.copyMarkdown}
389 onClick={() => context.onExpandImage(attachment)}
390 />
391 );
392 },
393 },
394 {
395 kind: "file",
396 canRender: (record, context) =>
397 record.kind === "file" && context.attachment !== null && context.attachment.type === "file",
398 render: (record, context) => {
399 if (
400 record.kind !== "file" ||
401 context.attachment === null ||
402 context.attachment.type !== "file"
403 ) {
404 return <UnavailableUserMessageContextChip {...context} />;
405 }
406 const attachment = context.attachment;
407 const isVideo = isVideoAttachment(attachment);
408 const label = userMessageFileLabel(attachment, context.m);
409 const disabled =
410 attachment.downloadable === false && (!isVideo || attachment.previewUrl === undefined);
411 const size =
412 attachment.downloadable === false
413 ? context.m(msg("Sending…"))
414 : formatAttachmentSize(record.sizeBytes, context.m);
415 return (
416 <FileChip
417 name={label}
418 svgPreview={
419 isSvgAttachment(attachment)
420 ? { environmentId: context.environmentId, attachmentId: attachment.id }
421 : undefined
422 }
423 size={size}
424 isVideo={isVideo}
425 theme={context.resolvedTheme}
426 disabled={disabled}
427 accessibleLabel={
428 isVideo
429 ? context.m(msg("Video attachment, {label}, {size}", { label, size }))
430 : context.m(msg("File attachment, {label}, {size}", { label, size }))
431 }
432 copyMarkdown={context.copyMarkdown}
433 onOpen={() =>
434 isVideo ? context.onExpandVideo(attachment) : context.onOpenFile(attachment)
435 }
436 tooltip={`${label}\n${size}`}
437 />
438 );
439 },
440 },
441 {
442 kind: "terminal",
443 canRender: (record) => record.kind === "terminal",
444 render: (record, context, definition) =>
445 record.kind === "terminal" ? (
446 <span data-markdown-copy={context.copyMarkdown}>
447 <TerminalContextInlineChip
448 terminalLabel={record.terminalLabel}
449 lineStart={record.lineStart}
450 lineEnd={record.lineEnd}
451 text={record.text}
452 detailsMode={definition.capabilities.details}
453 />
454 </span>
455 ) : (
456 <UnavailableUserMessageContextChip {...context} />
457 ),
458 },
459 {
460 kind: "element",
461 canRender: (record) => record.kind === "element",
462 render: (record, context) =>
463 record.kind === "element" ? (
464 <UserMessageContextPopover
465 copyMarkdown={context.copyMarkdown}
466 accessibleLabel={context.m(msg("Browser element, {label}", { label: record.label }))}
467 kind="element"
468 icon={<MousePointerClickIcon />}
469 label={record.label}
470 >
471 <UserMessageElementDetails record={record} />
472 </UserMessageContextPopover>
473 ) : (
474 <UnavailableUserMessageContextChip {...context} />
475 ),
476 },
477 {
478 kind: "review-comment",
479 canRender: (record) => record.kind === "review-comment",
480 render: (record, context) => {
481 if (record.kind !== "review-comment") {
482 return <UnavailableUserMessageContextChip {...context} />;
483 }
484 const isPullRequest = isPullRequestSummaryContext(record);
485 const label = reviewCommentContextLabel(record, context.m);
486 const kindLabel = isPullRequest
487 ? pullRequestContextKindLabel(record, context.m)
488 : context.m(msg("Review comment"));
489 const pullRequestState = pullRequestContextDisplayState(record) ?? "unknown";
490 if (isPullRequest && record.pullRequest !== undefined) {
491 return (
492 <UserMessagePullRequestContextChip
493 record={record}
494 copyMarkdown={context.copyMarkdown}
495 kind={PULL_REQUEST_CHIP_KINDS[pullRequestState]}
496 />
497 );
498 }
499 return (
500 <UserMessageContextPopover
501 copyMarkdown={context.copyMarkdown}
502 accessibleLabel={
503 record.pullRequest
504 ? context.m(
505 msg("{kind}, {label}, {title}", {
506 kind: kindLabel,
507 label,
508 title: record.pullRequest.title,
509 }),
510 )
511 : context.m(msg("{kind}, {label}", { kind: kindLabel, label }))
512 }
513 kind={isPullRequest ? PULL_REQUEST_CHIP_KINDS[pullRequestState] : "review-comment"}
514 icon={isPullRequest ? <PullRequestGlyph.pullRequest /> : <MessageCircleIcon />}
515 label={label}
516 >
517 <UserMessageReviewCommentCard
518 comment={{
519 id: record.contextId,
520 sectionId: record.sectionId,
521 sectionTitle: record.sectionTitle,
522 filePath: record.filePath,
523 startIndex: record.startIndex,
524 endIndex: record.endIndex,
525 rangeLabel: record.rangeLabel,
526 text: record.text,
527 diff: record.diff,
528 ...(record.fenceLanguage !== undefined
529 ? { fenceLanguage: record.fenceLanguage }
530 : {}),
531 ...(record.pullRequest !== undefined ? { pullRequest: record.pullRequest } : {}),
532 }}
533 />
534 </UserMessageContextPopover>
535 );
536 },
537 },
538 {
539 kind: "preview-annotation",
540 canRender: (record) => record.kind === "preview-annotation",
541 render: (record, context) =>
542 record.kind === "preview-annotation" ? (
543 <UserMessageContextPopover
544 copyMarkdown={context.copyMarkdown}
545 accessibleLabel={context.m(msg("Preview annotation, {label}", { label: record.label }))}
546 kind="preview-annotation"
547 icon={<MousePointerClickIcon />}
548 label={record.label}
549 >
550 <UserMessagePreviewAnnotationDetails record={record} image={context.annotationImage} />
551 </UserMessageContextPopover>
552 ) : (
553 <UnavailableUserMessageContextChip {...context} />
554 ),
555 },
556 ],
557 fallback: (_kind, _record, context) => <UnavailableUserMessageContextChip {...context} />,
558});
559​
560export function UserMessageContextReferenceChip(props: {
561 reference: ChatMarkdownContextReference;
562 record: KnownComposerContextRecord | undefined;
563 annotationImage: ChatImageAttachment | null;
564 attachment: ChatImageAttachment | ChatFileAttachment | null;
565 onExpandImage: (image: ChatImageAttachment) => void;
566 onExpandVideo: (file: ChatFileAttachment) => void;
567 onOpenFile: (file: ChatFileAttachment) => void;
568}) {
569 const { resolvedTheme, activeThreadEnvironmentId } = use(TimelineRowCtx);
570 const m = useMessages();
571 const copyMarkdown = formatComposerContextReference({
572 kind: props.reference.kind,
573 contextId: props.reference.contextId as ComposerContextId,
574 label: props.reference.label,
575 });
576 return userMessageContextPresentationRegistry.render(props.reference.kind, props.record, {
577 environmentId: activeThreadEnvironmentId,
578 reference: props.reference,
579 annotationImage: props.annotationImage,
580 attachment: props.attachment,
581 resolvedTheme,
582 copyMarkdown,
583 onExpandImage: props.onExpandImage,
584 onExpandVideo: props.onExpandVideo,
585 onOpenFile: props.onOpenFile,
586 m,
587 });
589​
590function UserMessageReviewCommentCard({ comment }: { comment: ReviewCommentContext }) {
591 const m = useMessages();
592 const renderedAppearance = useRenderedAppearance();
593 const ctx = use(TimelineRowCtx);
594 const fenceLanguage = comment.fenceLanguage ?? "diff";
595 const renderablePatch = getRenderablePatch(
596 buildReviewCommentRenderablePatch(comment),
597 `review-comment:${comment.id}`,
598 undefined,
599 m,
600 );
601​
602 return (
603 <div className="space-y-2 rounded-lg border border-border/70 bg-background/70 p-3">
604 <div className="space-y-1">
605 <div className="text-xs font-medium text-foreground">
606 {formatWorkspaceRelativePath(comment.filePath, ctx.workspaceRoot)}
607 </div>
608 <div className="text-2xs text-muted-foreground">
609 {reviewCommentSectionText(comment.sectionTitle, m)} ·{" "}
610 {reviewCommentRangeText(comment.rangeLabel, m)}
611 </div>
612 </div>
613 {comment.text.length > 0 && (
614 <div className="wrap-break-word text-sm">
615 <ChatMarkdown
616 text={comment.text}
617 cwd={ctx.markdownCwd}
618 threadRef={ctx.threadRef ?? undefined}
619 skills={ctx.skills}
620 parseRawHtml={false}
621 lineBreaks
622 />
623 </div>
624 )}
625 {fenceLanguage !== "diff" && comment.diff.trim().length > 0 && (
626 <ChatMarkdown
627 text={formatReviewCommentFence(fenceLanguage, comment.diff)}
628 cwd={ctx.markdownCwd}
629 threadRef={ctx.threadRef ?? undefined}
630 skills={ctx.skills}
631 className="text-foreground"
632 />
633 )}
634 {renderablePatch?.kind === "files" && (
635 <DiffWorkerPoolProvider>
636 {renderablePatch.files.map((fileDiff) => (
637 <FileDiff
638 key={resolveFileDiffPath(fileDiff)}
639 fileDiff={fileDiff}
640 options={{
641 collapsed: false,
642 diffStyle: "unified",
643 theme: resolveDiffThemeName(renderedAppearance),
644 preferredHighlighter: PREFERRED_HIGHLIGHTER,
645 }}
646 />
647 ))}
648 </DiffWorkerPoolProvider>
649 )}
650 {renderablePatch?.kind === "raw" && (
651 <pre className="overflow-x-auto rounded-md bg-muted/40 p-2 text-xs">
652 {renderablePatch.text}
653 </pre>
654 )}
655 </div>
656 );