Skip to content

Commit 551ce9b

Browse files
committed
Refactor plan details props and chat input logic
Replaces TaskDetailsProps with PlanDetailsProps for plan panel components and updates prop usage accordingly. Simplifies chat input disabling logic in PlanChat and PlanChatBody, always showing the chat input and only disabling it based on submitting state. Cleans up unused props and improves type consistency across related components.
1 parent 27ef6ee commit 551ce9b

File tree

6 files changed

+23
-32
lines changed

6 files changed

+23
-32
lines changed

src/frontend/src/components/content/PlanChat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
159159
{renderThinkingState(waitingForPlan)}
160160

161161
{/* Plan response with all information */}
162-
{showApprovalButtons && renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
162+
{renderPlanResponse(planApprovalRequest, handleApprovePlan, handleRejectPlan, processingApproval, showApprovalButtons)}
163163
{renderAgentMessages(agentMessages)}
164164

165165

@@ -174,7 +174,7 @@ const PlanChat: React.FC<SimplifiedPlanChatProps> = ({
174174
setInput={setInput}
175175
submittingChatDisableInput={submittingChatDisableInput}
176176
OnChatSubmit={OnChatSubmit}
177-
showChatInput={!planApprovalRequest}
177+
showChatInput={true}
178178
waitingForPlan={waitingForPlan}
179179
loading={false} />
180180
</div>

src/frontend/src/components/content/PlanChatBody.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
2828
maxWidth: '800px',
2929
margin: '0 auto',
3030
width: '100%'
31-
}}>
31+
}}
32+
33+
>
3234
<ChatInput
3335
value={input}
3436
onChange={setInput}
3537
onEnter={() => OnChatSubmit(input)}
36-
disabledChat={submittingChatDisableInput || waitingForPlan}
38+
disabledChat={submittingChatDisableInput}
3739
placeholder={
3840
waitingForPlan
3941
? "Creating plan..."
@@ -44,7 +46,7 @@ const PlanChatBody: React.FC<SimplifiedPlanChatProps> = ({
4446
appearance="transparent"
4547
onClick={() => OnChatSubmit(input)}
4648
icon={<SendRegular />}
47-
disabled={submittingChatDisableInput || waitingForPlan}
49+
disabled={submittingChatDisableInput}
4850
style={{ height: '40px', width: '40px' }}
4951
/>
5052
</ChatInput>

src/frontend/src/components/content/PlanPanelRight.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import {
66
PersonRegular,
77
ArrowTurnDownRightRegular,
88
} from "@fluentui/react-icons";
9-
import { MPlanData } from "../../models";
9+
import { MPlanData, PlanDetailsProps } from "../../models";
1010
import { TaskService } from "../../services/TaskService";
1111
import { AgentTypeUtils, AgentType } from "../../models/enums";
1212
import ContentNotFound from "../NotFound/ContentNotFound";
1313

14-
interface PlanPanelRightProps {
15-
planData: any;
16-
loading: boolean;
17-
planApprovalRequest: MPlanData | null;
18-
}
1914

20-
const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
15+
const PlanPanelRight: React.FC<PlanDetailsProps> = ({
2116
planData,
2217
loading,
2318
planApprovalRequest
@@ -62,9 +57,9 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
6257

6358
// Get the icon name from the utility
6459
const iconName = AgentTypeUtils.getAgentIcon(agentType);
65-
60+
6661
// Return the appropriate icon component or fallback to PersonRegular
67-
return <PersonRegular style={{
62+
return <PersonRegular style={{
6863
color: 'var(--colorPaletteBlueForeground2)',
6964
fontSize: '16px'
7065
}} />;
@@ -83,11 +78,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
8378
if (!planApprovalRequest.steps || planApprovalRequest.steps.length === 0) return [];
8479

8580
const result: Array<{ type: 'heading' | 'substep'; text: string }> = [];
86-
81+
8782
planApprovalRequest.steps.forEach(step => {
8883
const action = step.cleanAction || step.action || '';
8984
const trimmedAction = action.trim();
90-
85+
9186
if (trimmedAction) {
9287
// Check if the step ends with a colon
9388
if (trimmedAction.endsWith(':')) {
@@ -117,8 +112,8 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
117112
display: 'flex',
118113
flexDirection: 'column'
119114
}}>
120-
<Body1 style={{
121-
marginBottom: '16px',
115+
<Body1 style={{
116+
marginBottom: '16px',
122117
flexShrink: 0,
123118
fontSize: '14px',
124119
fontWeight: 600,
@@ -186,7 +181,7 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
186181
flex: 1,
187182
overflow: 'auto'
188183
}}>
189-
<Body1 style={{
184+
<Body1 style={{
190185
marginBottom: '16px',
191186
fontSize: '14px',
192187
fontWeight: 600,
@@ -227,11 +222,11 @@ const PlanPanelRight: React.FC<PlanPanelRightProps> = ({
227222
}}>
228223
{getAgentIcon(agentName)}
229224
</div>
230-
225+
231226
{/* Agent Info - just name */}
232227
<div style={{ flex: 1 }}>
233-
<Body1 style={{
234-
fontWeight: 600,
228+
<Body1 style={{
229+
fontWeight: 600,
235230
fontSize: '14px',
236231
color: 'var(--colorNeutralForeground1)'
237232
}}>

src/frontend/src/models/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export * from './homeInput';
1616
export * from './auth';
1717

1818
// Export taskDetails with explicit naming to avoid Agent conflict
19-
export type { SubTask, Human, TaskDetailsProps } from './taskDetails';
19+
export type { SubTask, Human, PlanDetailsProps } from './taskDetails';
2020
export type { Agent as TaskAgent } from './taskDetails';
2121

2222
// Export Team models (Agent interface takes precedence)

src/frontend/src/models/taskDetails.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ProcessedPlanData, Step } from "./plan";
1+
import { MPlanData, ProcessedPlanData, Step } from "./plan";
22

33
export interface SubTask {
44
id: string;
@@ -20,10 +20,8 @@ export interface Human {
2020
avatarUrl?: string;
2121
}
2222

23-
export interface TaskDetailsProps {
23+
export interface PlanDetailsProps {
2424
planData: ProcessedPlanData;
2525
loading: boolean;
26-
submittingChatDisableInput: boolean;
27-
processingSubtaskId: string | null;
28-
OnApproveStep: (step: Step, total: number, completed: number, approve: boolean) => void;
26+
planApprovalRequest: MPlanData | null;
2927
}

src/frontend/src/pages/PlanPage.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,7 @@ const PlanPage: React.FC = () => {
504504

505505
<PlanPanelRight
506506
planData={planData}
507-
submittingChatDisableInput={submittingChatDisableInput}
508-
processingSubtaskId={processingSubtaskId}
509507
loading={loading}
510-
streamingMessages={streamingMessages}
511-
planApproved={planApproved}
512508
planApprovalRequest={planApprovalRequest}
513509
/>
514510
</CoralShellRow>

0 commit comments

Comments
 (0)