From f73d21e09fb488cc911adf20c717a87495664e16 Mon Sep 17 00:00:00 2001 From: Mufeed VH Date: Wed, 25 Jun 2025 01:44:15 +0530 Subject: [PATCH] refactor(ui): improve agent execution layout with sticky header and configuration Restructure AgentExecution component layout to enhance user experience: - Make header and configuration sections sticky to remain visible during scrolling - Optimize scrollable output display area with proper overflow handling - Improve container structure for better layout management and responsiveness - Maintain existing functionality while providing better visual organization --- src/components/AgentExecution.tsx | 537 +++++++++++++++--------------- 1 file changed, 273 insertions(+), 264 deletions(-) diff --git a/src/components/AgentExecution.tsx b/src/components/AgentExecution.tsx index 7af66f7..ee27b50 100644 --- a/src/components/AgentExecution.tsx +++ b/src/components/AgentExecution.tsx @@ -442,291 +442,300 @@ export const AgentExecution: React.FC = ({ return (
-
- {/* Header */} - -
- -
- {renderIcon()} -
-
-

{agent.name}

- {isRunning && ( -
-
- Running -
- )} -
-

- {isRunning ? "Click back to return to main menu - view in CC Agents > Running Sessions" : "Execute CC Agent"} -

-
-
-
- -
- {messages.length > 0 && ( - <> +
- + {renderIcon()} +
+
+

{agent.name}

+ {isRunning && ( +
+
+ Running +
+ )} +
+

+ {isRunning ? "Click back to return to main menu - view in CC Agents > Running Sessions" : "Execute CC Agent"} +

+
+
+
+ +
+ {messages.length > 0 && ( + <> - } - content={ -
- - -
- } - open={copyPopoverOpen} - onOpenChange={setCopyPopoverOpen} - align="end" - /> - - )} -
-
- - {/* Configuration */} -
- {/* Error display */} - {error && ( - - - {error} + + + Copy Output + + + } + content={ +
+ + +
+ } + open={copyPopoverOpen} + onOpenChange={setCopyPopoverOpen} + align="end" + /> + + )} +
- )} - - {/* Project Path */} -
- -
- setProjectPath(e.target.value)} - placeholder="Select or enter project path" - disabled={isRunning} - className="flex-1" - /> - -
+
+ + {/* Sticky Configuration */} +
+
+ {/* Error display */} + {error && ( + + + {error} + + )} - {/* Model Selection */} -
- -
- - - + {/* Project Path */} +
+ +
+ setProjectPath(e.target.value)} + placeholder="Select or enter project path" + disabled={isRunning} + className="flex-1" + /> + +
-
- {/* Task Input */} -
- -
- setTask(e.target.value)} - placeholder={agent.default_task || "Enter the task for the agent"} - disabled={isRunning} - className="flex-1" - onKeyPress={(e) => { - if (e.key === "Enter" && !isRunning && projectPath && task.trim()) { - handleExecute(); - } - }} - /> - + {/* Model Selection */} +
+ +
+ + + +
+
+ + {/* Task Input */} +
+ +
+ setTask(e.target.value)} + placeholder={agent.default_task || "Enter the task for the agent"} + disabled={isRunning} + className="flex-1" + onKeyPress={(e) => { + if (e.key === "Enter" && !isRunning && projectPath && task.trim()) { + handleExecute(); + } + }} + /> + +
- {/* Output Display */} -
-
{ - // Mark that user has scrolled manually - if (!hasUserScrolled) { - setHasUserScrolled(true); - } - - // If user scrolls back to bottom, re-enable auto-scroll - if (isAtBottom()) { - setHasUserScrolled(false); - } - }} - > -
- {messages.length === 0 && !isRunning && ( -
- -

Ready to Execute

-

- Select a project path and enter a task to run the agent -

-
- )} - - {isRunning && messages.length === 0 && ( -
-
- - Initializing agent... -
-
- )} - -
+
+
{ + // Mark that user has scrolled manually + if (!hasUserScrolled) { + setHasUserScrolled(true); + } + + // If user scrolls back to bottom, re-enable auto-scroll + if (isAtBottom()) { + setHasUserScrolled(false); + } + }} > - - {rowVirtualizer.getVirtualItems().map((virtualItem) => { - const message = displayableMessages[virtualItem.index]; - return ( - el && rowVirtualizer.measureElement(el)} - initial={{ opacity: 0, y: 10 }} - animate={{ opacity: 1, y: 0 }} - transition={{ duration: 0.2 }} - className="absolute inset-x-4 pb-4" - style={{ top: virtualItem.start }} - > - - - - - ); - })} - -
- -
+
+ {messages.length === 0 && !isRunning && ( +
+ +

Ready to Execute

+

+ Select a project path and enter a task to run the agent +

+
+ )} + + {isRunning && messages.length === 0 && ( +
+
+ + Initializing agent... +
+
+ )} + +
+ + {rowVirtualizer.getVirtualItems().map((virtualItem) => { + const message = displayableMessages[virtualItem.index]; + return ( + el && rowVirtualizer.measureElement(el)} + initial={{ opacity: 0, y: 10 }} + animate={{ opacity: 1, y: 0 }} + transition={{ duration: 0.2 }} + className="absolute inset-x-4 pb-4" + style={{ top: virtualItem.start }} + > + + + + + ); + })} + +
+ +
+