diff --git a/frontend/src/components/message/PatchPart.tsx b/frontend/src/components/message/PatchPart.tsx index 0d5df52..725a763 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 (