From e3f95ad3b68dd8cafda7ec2896431f48440e02bd Mon Sep 17 00:00:00 2001 From: Ishaan Sharma <33966319+oneishaansharma@users.noreply.github.com> Date: Thu, 15 Jan 2026 13:26:45 -0800 Subject: [PATCH] chore: make File Changes section collapsible (#60) --- frontend/src/components/message/PatchPart.tsx | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/message/PatchPart.tsx b/frontend/src/components/message/PatchPart.tsx index 0d5df523..725a7636 100644 --- a/frontend/src/components/message/PatchPart.tsx +++ b/frontend/src/components/message/PatchPart.tsx @@ -1,5 +1,7 @@ +import { useState } from 'react' import type { components } from '@/api/opencode-types' import { getRelativePath } from './FileToolRender' +import { ChevronDown, ChevronUp } from 'lucide-react' type PatchPartType = components['schemas']['PatchPart'] @@ -8,18 +10,32 @@ interface PatchPartProps { onFileClick?: (filePath: string) => void } +const INITIAL_FILES_SHOWN = 3 + export function PatchPart({ part, onFileClick }: PatchPartProps) { + const [expanded, setExpanded] = useState(false) + + const hasMoreFiles = part.files.length > INITIAL_FILES_SHOWN + const displayedFiles = expanded ? part.files : part.files.slice(0, INITIAL_FILES_SHOWN) + const hiddenCount = part.files.length - INITIAL_FILES_SHOWN + return (