@@ -93,7 +93,7 @@ export class ModifiedFilesTracker {
9393
9494 private renderAllFilePills ( contentWrapper : Element ) : void {
9595 this . allFiles . forEach ( ( { fileList, messageId } ) => {
96- const { filePaths = [ ] , deletedFiles = [ ] , actions, details, flatList } = fileList ;
96+ const { filePaths = [ ] , deletedFiles = [ ] , actions, details } = fileList ;
9797
9898 // Create a wrapper for each file group
9999 const fileGroupWrapper = DomBuilder . getInstance ( ) . build ( {
@@ -102,45 +102,57 @@ export class ModifiedFilesTracker {
102102 children : [ ]
103103 } ) ;
104104
105- // Render the file tree with original actions only
106- fileGroupWrapper . appendChild ( new ChatItemTreeViewWrapper ( {
107- tabId : this . props . tabId ,
108- messageId : this . getOriginalMessageId ( messageId ) ,
109- files : filePaths ,
110- cardTitle : '' ,
111- rootTitle : fileList . rootFolderTitle ,
112- deletedFiles,
113- flatList,
114- actions,
115- details,
116- hideFileCount : fileList . hideFileCount ?? true ,
117- collapsed : fileList . collapsed ?? false ,
118- referenceSuggestionLabel : '' ,
119- references : [ ] ,
120- onRootCollapsedStateChange : ( ) => { }
121- } ) . render ) ;
122-
123- contentWrapper . appendChild ( fileGroupWrapper ) ;
124- } ) ;
125-
126- // Add buttons separately using ChatItemButtonsWrapper, same as chat-item-card.ts
127- if ( ( ( this . props . chatItem ?. buttons ) != null ) && Array . isArray ( this . props . chatItem . buttons ) && this . props . chatItem . buttons . length > 0 ) {
128- const buttonsWrapper = new ChatItemButtonsWrapper ( {
129- tabId : this . props . tabId ,
130- classNames : [ 'mynah-modified-files-buttons' ] ,
131- formItems : null ,
132- buttons : this . props . chatItem . buttons ,
133- onActionClick : action => {
134- MynahUIGlobalEvents . getInstance ( ) . dispatch ( MynahEventNames . BODY_ACTION_CLICKED , {
105+ // Render each file individually with its own buttons
106+ filePaths . forEach ( filePath => {
107+ const singleFileWrapper = DomBuilder . getInstance ( ) . build ( {
108+ type : 'div' ,
109+ classNames : [ 'mynah-modified-files-single-file' ] ,
110+ children : [ ]
111+ } ) ;
112+
113+ // Render the file tree for single file
114+ singleFileWrapper . appendChild ( new ChatItemTreeViewWrapper ( {
115+ tabId : this . props . tabId ,
116+ messageId : this . getOriginalMessageId ( messageId ) ,
117+ files : [ filePath ] ,
118+ cardTitle : '' ,
119+ rootTitle : undefined , // No root title for single files
120+ deletedFiles : deletedFiles . filter ( df => df === filePath ) ,
121+ flatList : true , // Force flat list for single files
122+ actions : ( actions != null ) ? { [ filePath ] : actions [ filePath ] } : undefined ,
123+ details : ( details != null ) ? { [ filePath ] : details [ filePath ] } : undefined ,
124+ hideFileCount : true ,
125+ collapsed : false ,
126+ referenceSuggestionLabel : '' ,
127+ references : [ ] ,
128+ onRootCollapsedStateChange : ( ) => { }
129+ } ) . render ) ;
130+
131+ // Add buttons for this specific file if they exist
132+ if ( this . props . chatItem ?. buttons != null && Array . isArray ( this . props . chatItem . buttons ) && this . props . chatItem . buttons . length > 0 ) {
133+ const buttonsWrapper = new ChatItemButtonsWrapper ( {
135134 tabId : this . props . tabId ,
136- messageId : this . getOriginalMessageId ( this . props . chatItem ?. messageId ?? '' ) ,
137- actionId : action . id ,
138- actionText : action . text
135+ classNames : [ 'mynah-modified-files-file-buttons' ] ,
136+ formItems : null ,
137+ buttons : this . props . chatItem . buttons ,
138+ onActionClick : action => {
139+ MynahUIGlobalEvents . getInstance ( ) . dispatch ( MynahEventNames . BODY_ACTION_CLICKED , {
140+ tabId : this . props . tabId ,
141+ messageId : this . getOriginalMessageId ( messageId ) ,
142+ actionId : action . id ,
143+ actionText : action . text ,
144+ filePath // Add filePath to identify which file the action is for
145+ } ) ;
146+ }
139147 } ) ;
148+ singleFileWrapper . appendChild ( buttonsWrapper . render ) ;
140149 }
150+
151+ fileGroupWrapper . appendChild ( singleFileWrapper ) ;
141152 } ) ;
142- contentWrapper . appendChild ( buttonsWrapper . render ) ;
143- }
153+
154+ contentWrapper . appendChild ( fileGroupWrapper ) ;
155+ } ) ;
144156 }
145157
146158 private getOriginalMessageId ( messageId : string ) : string {
0 commit comments