@@ -87,14 +87,14 @@ export function ScriptDetailModal({ script, isOpen, onClose, onInstallScript }:
8787 const scriptPath = `scripts/${ scriptMethod . script } ` ;
8888 const scriptName = script . name ;
8989 onInstallScript ( scriptPath , scriptName ) ;
90+
91+ // Scroll to top of the page to see the terminal
92+ window . scrollTo ( { top : 0 , behavior : 'smooth' } ) ;
93+
9094 onClose ( ) ; // Close the modal when starting installation
9195 }
9296 } ;
9397
94- const handleShowDiff = ( filePath : string ) => {
95- setSelectedDiffFile ( filePath ) ;
96- setDiffViewerOpen ( true ) ;
97- } ;
9898
9999 const handleViewScript = ( ) => {
100100 setTextViewerOpen ( true ) ;
@@ -279,53 +279,46 @@ export function ScriptDetailModal({ script, isOpen, onClose, onInstallScript }:
279279 </ div >
280280 ) }
281281
282- { scriptFilesData ?. success && ! scriptFilesLoading && (
283- < div className = "mx-6 mb-4 p-3 rounded-lg bg-gray-50 text-sm" >
284- < div className = "flex items-center space-x-4" >
285- < div className = "flex items-center space-x-2" >
286- < div className = { `w-2 h-2 rounded-full ${ scriptFilesData . ctExists ? 'bg-green-500' : 'bg-gray-300' } ` } > </ div >
287- < span > CT Script: { scriptFilesData . ctExists ? 'Available' : 'Not loaded' } </ span >
288- </ div >
289- < div className = "flex items-center space-x-2" >
290- < div className = { `w-2 h-2 rounded-full ${ scriptFilesData . installExists ? 'bg-green-500' : 'bg-gray-300' } ` } > </ div >
291- < span > Install Script: { scriptFilesData . installExists ? 'Available' : 'Not loaded' } </ span >
292- </ div >
293- { scriptFilesData ?. success && ( scriptFilesData . ctExists || scriptFilesData . installExists ) && comparisonData ?. success && ! comparisonLoading && (
282+ { scriptFilesData ?. success && ! scriptFilesLoading && ( ( ) => {
283+ // Determine script type from the first install method
284+ const firstScript = script ?. install_methods ?. [ 0 ] ?. script ;
285+ let scriptType = 'Script' ;
286+ if ( firstScript ?. startsWith ( 'ct/' ) ) {
287+ scriptType = 'CT Script' ;
288+ } else if ( firstScript ?. startsWith ( 'tools/' ) ) {
289+ scriptType = 'Tools Script' ;
290+ } else if ( firstScript ?. startsWith ( 'vm/' ) ) {
291+ scriptType = 'VM Script' ;
292+ } else if ( firstScript ?. startsWith ( 'vw/' ) ) {
293+ scriptType = 'VW Script' ;
294+ }
295+
296+ return (
297+ < div className = "mx-6 mb-4 p-3 rounded-lg bg-gray-50 text-sm" >
298+ < div className = "flex items-center space-x-4" >
294299 < div className = "flex items-center space-x-2" >
295- < div className = { `w-2 h-2 rounded-full ${ comparisonData . hasDifferences ? 'bg-orange-500' : 'bg-green-500' } ` } > </ div >
296- < span > Status: { comparisonData . hasDifferences ? 'Update available' : 'Up to date' } </ span >
297- </ div >
298- ) }
299- </ div >
300- { scriptFilesData . files . length > 0 && (
301- < div className = "mt-2 text-xs text-gray-600" >
302- Files: { scriptFilesData . files . join ( ', ' ) }
303- </ div >
304- ) }
305- { scriptFilesData ?. success && ( scriptFilesData . ctExists || scriptFilesData . installExists ) &&
306- comparisonData ?. success && comparisonData . hasDifferences && comparisonData . differences . length > 0 && (
307- < div className = "mt-2" >
308- < div className = "text-xs text-orange-600 mb-2" >
309- Differences in: { comparisonData . differences . join ( ', ' ) }
300+ < div className = { `w-2 h-2 rounded-full ${ scriptFilesData . ctExists ? 'bg-green-500' : 'bg-gray-300' } ` } > </ div >
301+ < span > { scriptType } : { scriptFilesData . ctExists ? 'Available' : 'Not loaded' } </ span >
310302 </ div >
311- < div className = "flex flex-wrap gap-2" >
312- { comparisonData . differences . map ( ( filePath , index ) => (
313- < button
314- key = { index }
315- onClick = { ( ) => handleShowDiff ( filePath ) }
316- className = "px-2 py-1 text-xs bg-orange-100 text-orange-700 rounded hover:bg-orange-200 transition-colors flex items-center space-x-1"
317- >
318- < svg className = "w-3 h-3" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
319- < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
320- </ svg >
321- < span > Show Diff: { filePath } </ span >
322- </ button >
323- ) ) }
303+ < div className = "flex items-center space-x-2" >
304+ < div className = { `w-2 h-2 rounded-full ${ scriptFilesData . installExists ? 'bg-green-500' : 'bg-gray-300' } ` } > </ div >
305+ < span > Install Script: { scriptFilesData . installExists ? 'Available' : 'Not loaded' } </ span >
324306 </ div >
307+ { scriptFilesData ?. success && ( scriptFilesData . ctExists || scriptFilesData . installExists ) && comparisonData ?. success && ! comparisonLoading && (
308+ < div className = "flex items-center space-x-2" >
309+ < div className = { `w-2 h-2 rounded-full ${ comparisonData . hasDifferences ? 'bg-orange-500' : 'bg-green-500' } ` } > </ div >
310+ < span > Status: { comparisonData . hasDifferences ? 'Update available' : 'Up to date' } </ span >
311+ </ div >
312+ ) }
325313 </ div >
326- ) }
327- </ div >
328- ) }
314+ { scriptFilesData . files . length > 0 && (
315+ < div className = "mt-2 text-xs text-gray-600" >
316+ Files: { scriptFilesData . files . join ( ', ' ) }
317+ </ div >
318+ ) }
319+ </ div >
320+ ) ;
321+ } ) ( ) }
329322
330323 { /* Content */ }
331324 < div className = "p-6 space-y-6" >
0 commit comments