@@ -75,6 +75,7 @@ export default function ProjectSessionDetailPage({
7575 const [ repoChanging , setRepoChanging ] = useState ( false ) ;
7676 const [ autoSelectAgents , setAutoSelectAgents ] = useState ( true ) ;
7777 const [ showAgentsList , setShowAgentsList ] = useState ( false ) ;
78+ const [ showCommandsList , setShowCommandsList ] = useState ( false ) ;
7879
7980 // Directory browser state (unified for artifacts, repos, and workflow)
8081 const [ selectedDirectory , setSelectedDirectory ] = useState < {
@@ -1352,55 +1353,77 @@ export default function ProjectSessionDetailPage({
13521353 { workflowMetadata ?. commands && workflowMetadata . commands . length > 0 && (
13531354 < div className = "space-y-2" >
13541355 < div className = "text-sm font-medium" > Commands</ div >
1355- < div className = "relative" >
1356- { commandsScrollTop && (
1357- < div className = "absolute top-0 left-0 right-0 h-8 bg-gradient-to-b from-white to-transparent pointer-events-none z-10" />
1358- ) }
1359- < div
1360- className = "max-h-[400px] overflow-y-auto space-y-2 pr-1"
1361- onScroll = { ( e ) => {
1362- const target = e . currentTarget ;
1363- const isScrolledFromTop = target . scrollTop > 10 ;
1364- const isScrolledToBottom = target . scrollHeight - target . scrollTop <= target . clientHeight + 10 ;
1365- setCommandsScrollTop ( isScrolledFromTop ) ;
1366- setCommandsScrollBottom ( ! isScrolledToBottom ) ;
1367- } }
1356+
1357+ { /* View commands expandable section */ }
1358+ < div >
1359+ < Button
1360+ variant = "ghost"
1361+ size = "sm"
1362+ className = "w-full justify-between h-8 px-2"
1363+ onClick = { ( ) => setShowCommandsList ( ! showCommandsList ) }
13681364 >
1369- { workflowMetadata . commands . map ( ( cmd ) => {
1370- // Extract command name after last dot and capitalize
1371- const commandTitle = cmd . name . includes ( '.' )
1372- ? cmd . name . split ( '.' ) . pop ( )
1373- : cmd . name ;
1374-
1375- return (
1376- < div
1377- key = { cmd . id }
1378- className = "p-3 rounded-md border bg-muted/30"
1365+ < span className = "text-xs font-medium" >
1366+ View { workflowMetadata . commands . length } available command{ workflowMetadata . commands . length !== 1 ? 's' : '' }
1367+ </ span >
1368+ { showCommandsList ? (
1369+ < ChevronUp className = "h-3 w-3" />
1370+ ) : (
1371+ < ChevronDown className = "h-3 w-3" />
1372+ ) }
1373+ </ Button >
1374+
1375+ { showCommandsList && (
1376+ < div className = "relative mt-2" >
1377+ { commandsScrollTop && (
1378+ < div className = "absolute top-0 left-0 right-0 h-8 bg-gradient-to-b from-white to-transparent pointer-events-none z-10" />
1379+ ) }
1380+ < div
1381+ className = "max-h-[400px] overflow-y-auto space-y-2 pr-1"
1382+ onScroll = { ( e ) => {
1383+ const target = e . currentTarget ;
1384+ const isScrolledFromTop = target . scrollTop > 10 ;
1385+ const isScrolledToBottom = target . scrollHeight - target . scrollTop <= target . clientHeight + 10 ;
1386+ setCommandsScrollTop ( isScrolledFromTop ) ;
1387+ setCommandsScrollBottom ( ! isScrolledToBottom ) ;
1388+ } }
13791389 >
1380- < div className = "flex items-center justify-between mb-1" >
1381- < h3 className = "text-sm font-bold capitalize" >
1382- { commandTitle }
1383- </ h3 >
1384- < Button
1385- variant = "secondary"
1386- size = "sm"
1387- className = "flex-shrink-0 h-7 text-xs"
1388- onClick = { ( ) => handleCommandClick ( cmd . slashCommand ) }
1389- >
1390- Run { cmd . slashCommand }
1391- </ Button >
1392- </ div >
1393- { cmd . description && (
1394- < p className = "text-xs text-muted-foreground" >
1395- { cmd . description }
1396- </ p >
1397- ) }
1390+ { workflowMetadata . commands . map ( ( cmd ) => {
1391+ // Extract command name after last dot and capitalize
1392+ const commandTitle = cmd . name . includes ( '.' )
1393+ ? cmd . name . split ( '.' ) . pop ( )
1394+ : cmd . name ;
1395+
1396+ return (
1397+ < div
1398+ key = { cmd . id }
1399+ className = "p-3 rounded-md border bg-muted/30"
1400+ >
1401+ < div className = "flex items-center justify-between mb-1" >
1402+ < h3 className = "text-sm font-bold capitalize" >
1403+ { commandTitle }
1404+ </ h3 >
1405+ < Button
1406+ variant = "secondary"
1407+ size = "sm"
1408+ className = "flex-shrink-0 h-7 text-xs"
1409+ onClick = { ( ) => handleCommandClick ( cmd . slashCommand ) }
1410+ >
1411+ Run { cmd . slashCommand }
1412+ </ Button >
1413+ </ div >
1414+ { cmd . description && (
1415+ < p className = "text-xs text-muted-foreground" >
1416+ { cmd . description }
1417+ </ p >
1418+ ) }
1419+ </ div >
1420+ ) ;
1421+ } ) }
13981422 </ div >
1399- ) ;
1400- } ) }
1401- </ div >
1402- { commandsScrollBottom && (
1403- < div className = "absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-white to-transparent pointer-events-none z-10" />
1423+ { commandsScrollBottom && (
1424+ < div className = "absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-white to-transparent pointer-events-none z-10" />
1425+ ) }
1426+ </ div >
14041427 ) }
14051428 </ div >
14061429 </ div >
0 commit comments