1- import  React  from  'react' ; 
1+ import  React ,   {   useEffect ,   useRef   }  from  'react' ; 
22import  { 
33  Modal , 
44  ModalClose , 
@@ -9,10 +9,26 @@ import {
99  Chip , 
1010  LinearProgress , 
1111  Sheet , 
12+   List , 
13+   ListItem , 
14+   ListItemButton , 
15+   ListItemContent , 
16+   ListItemDecorator , 
1217}  from  '@mui/joy' ; 
1318import  {  FileIcon ,  FolderIcon  }  from  'lucide-react' ; 
1419import  {  Editor  }  from  '@monaco-editor/react' ; 
1520
21+ import  fairyflossTheme  from  '../Shared/fairyfloss.tmTheme.js' ; 
22+ 
23+ const  {  parseTmTheme }  =  require ( 'monaco-themes' ) ; 
24+ 
25+ function  setTheme ( editor : any ,  monaco : any )  { 
26+   const  themeData  =  parseTmTheme ( fairyflossTheme ) ; 
27+ 
28+   monaco . editor . defineTheme ( 'my-theme' ,  themeData ) ; 
29+   monaco . editor . setTheme ( 'my-theme' ) ; 
30+ } 
31+ 
1632interface  TaskFilesModalProps  { 
1733  open : boolean ; 
1834  onClose : ( )  =>  void ; 
@@ -30,6 +46,24 @@ export default function TaskFilesModal({
3046  isLoading, 
3147  fileCount, 
3248} : TaskFilesModalProps )  { 
49+   const  editorRef  =  useRef ( null ) ; 
50+ 
51+   // useEffect(() => { 
52+   //   if (data) { 
53+   //     if (editorRef?.current && typeof data === 'string') { 
54+   //       editorRef?.current?.setValue(data); 
55+   //     } 
56+   //   } 
57+   // }, [data]); 
58+ 
59+   // function handleEditorDidMount(editor, monaco) { 
60+   //   editorRef.current = editor; 
61+   //   if (editorRef?.current && typeof data === 'string') { 
62+   //     editorRef?.current?.setValue(data); 
63+   //   } 
64+   //   setTheme(editor, monaco); 
65+   // } 
66+ 
3367  return  ( 
3468    < Modal  open = { open }  onClose = { onClose } > 
3569      < ModalDialog 
@@ -40,15 +74,15 @@ export default function TaskFilesModal({
4074        } } 
4175      > 
4276        < ModalClose  /> 
43-         < Typography  level = "title-md"  sx = { {   mb :  2   } } > 
77+         < Typography  level = "title-md"  sx = { { } } > 
4478          Files in { taskName } 
4579        </ Typography > 
4680
47-         < Box  sx = { {   mb :  2   } } > 
81+         { /*  <Box sx={{}}>
4882          <Chip size="sm" variant="soft" color="primary"> 
4983            {fileCount} {fileCount === 1 ? 'file' : 'files'} 
5084          </Chip> 
51-         </ Box > 
85+         </Box> */  } 
5286
5387        { isLoading  ? ( 
5488          < LinearProgress  /> 
@@ -69,36 +103,46 @@ export default function TaskFilesModal({
69103                No files found in src/ directory
70104              </ Typography > 
71105            )  : ( 
72-               < Box  display = "flex"  gap = { 4 }  sx = { {  height : '100%'  } } > 
106+               < Box 
107+                 display = "flex" 
108+                 gap = { 4 } 
109+                 sx = { {  height : '100%'  } } 
110+                 id = "task-gallery-files-container" 
111+               > 
73112                < Sheet 
74-                   sx = { {  width : 300 ,  gap : 2 ,  overflow : 'hidden'  } } 
113+                   sx = { { 
114+                     gap : 2 , 
115+                     overflow : 'hidden' , 
116+                     flex : 1 , 
117+                     minWidth : '300px' , 
118+                   } } 
75119                  variant = "outlined" 
120+                   id = "task-gallery-files-list" 
76121                > 
77-                   { files . map ( ( file ,  index )  =>  ( 
78-                     < Box 
79-                       key = { index } 
80-                       sx = { { 
81-                         display : 'flex' , 
82-                         alignItems : 'center' , 
83-                         gap : 1 , 
84-                         p : 1 , 
85-                         borderRadius : 'sm' , 
86-                         '&:hover' : { 
87-                           backgroundColor : 'background.level1' , 
88-                         } , 
89-                       } } 
90-                     > 
91-                       < FileIcon  size = { 16 }  /> 
92-                       < Typography 
93-                         level = "body-sm" 
94-                         sx = { {  fontFamily : 'monospace'  } } 
95-                       > 
96-                         { file } 
97-                       </ Typography > 
98-                     </ Box > 
99-                   ) ) } 
122+                   < List  size = "sm" > 
123+                     { files . map ( ( file ,  index )  =>  ( 
124+                       < ListItem  key = { index } > 
125+                         < ListItemButton > 
126+                           < ListItemDecorator > 
127+                             < FileIcon  size = { 16 }  /> 
128+                           </ ListItemDecorator > 
129+                           < ListItemContent > 
130+                             < Typography 
131+                               level = "body-sm" 
132+                               sx = { {  fontFamily : 'monospace'  } } 
133+                             > 
134+                               { file } 
135+                             </ Typography > 
136+                           </ ListItemContent > 
137+                         </ ListItemButton > 
138+                       </ ListItem > 
139+                     ) ) } 
140+                   </ List > 
100141                </ Sheet > 
101-                 < Box  sx = { {  flex : 1 ,  height : '100%'  } } > 
142+                 < Box 
143+                   sx = { {  flex : 3 ,  height : '100%'  } } 
144+                   id = "task-gallery-file-viewer" 
145+                 > 
102146                  < Editor 
103147                    defaultLanguage = "shell" 
104148                    theme = "my-theme" 
@@ -111,7 +155,7 @@ export default function TaskFilesModal({
111155                      cursorStyle : 'block' , 
112156                      wordWrap : 'on' , 
113157                    } } 
114-                     onMount = { ( )   =>   { } } 
158+                     //  onMount={handleEditorDidMount }
115159                  /> 
116160                </ Box > 
117161              </ Box > 
0 commit comments