Skip to content

Commit 14d6170

Browse files
committed
use chatinput from enunsoo
1 parent 9abc03d commit 14d6170

4 files changed

Lines changed: 25 additions & 36 deletions

File tree

src/frontend_react/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/>
1212
<link rel="apple-touch-icon" href="/logo192.png" />
1313
<link rel="manifest" href="/manifest.json" />
14-
<title>MACAE</title>
14+
<title>Multi-Agent - Custom Automation Engine</title>
1515
</head>
1616
<body>
1717
<noscript>You need to enable JavaScript to run this app.</noscript>

src/frontend_react/src/components/content/HomeInput.tsx

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,29 @@ import {
1515
ShoppingBag20Regular,
1616
DocumentEdit20Regular,
1717
} from "@fluentui/react-icons";
18-
import React, { useRef, useEffect } from "react";
18+
import React, { useRef, useEffect, useState } from "react";
1919
import { useNavigate } from 'react-router-dom';
2020
import "./../../styles/Chat.css"; // Assuming you have a CSS file for additional styles
2121
import "./../../styles/HomeInput.css";
2222
import { HomeInputProps, quickTasks, QuickTask } from "../../models/homeInput";
2323
import { TaskService } from "../../services/TaskService";
2424
import { NewTaskService } from "../../services/NewTaskService";
25+
import ChatInput from "@/coral/modules/ChatInput";
2526

2627

2728
const HomeInput: React.FC<HomeInputProps> = ({
2829
onInputSubmit,
2930
onQuickTaskSelect,
3031
}) => {
31-
const [inputValue, setInputValue] = React.useState("");
32+
const [input, setInput] = useState("");
3233
const textareaRef = useRef<HTMLTextAreaElement>(null);
3334
const navigate = useNavigate();
3435

3536
/**
3637
* Reset textarea to empty state
3738
*/
3839
const resetTextarea = () => {
39-
setInputValue("");
40+
setInput("");
4041
if (textareaRef.current) {
4142
textareaRef.current.style.height = "auto";
4243
textareaRef.current.focus();
@@ -50,13 +51,13 @@ const HomeInput: React.FC<HomeInputProps> = ({
5051
}, []);
5152

5253
const handleSubmit = async () => {
53-
if (inputValue.trim()) {
54+
if (input.trim()) {
5455
try {
5556
// Submit the input task using TaskService
56-
const response = await TaskService.submitInputTask(inputValue.trim());
57+
const response = await TaskService.submitInputTask(input.trim());
5758

5859
// Clear the input field
59-
setInputValue("");
60+
setInput("");
6061
if (textareaRef.current) {
6162
textareaRef.current.style.height = "auto";
6263
}
@@ -72,7 +73,7 @@ const HomeInput: React.FC<HomeInputProps> = ({
7273
};
7374
const handleQuickTaskClick = (task: QuickTask) => {
7475
// Copy task description to textarea
75-
setInputValue(task.description);
76+
setInput(task.description);
7677

7778
// Focus on textarea
7879
if (textareaRef.current) {
@@ -90,40 +91,27 @@ const HomeInput: React.FC<HomeInputProps> = ({
9091
textareaRef.current.style.height = "auto";
9192
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
9293
}
93-
}, [inputValue]);
94+
}, [input]);
9495

9596
return (
96-
9797
<div className="home-input-container">
9898
<div className="home-input-content">
9999
<div className="home-input-center-content">
100100
<div className="home-input-title-wrapper">
101101
<Title2>How can I help?</Title2>
102102
</div>
103103

104-
<div className="home-input-input-section">
105-
<div className="home-input-input-wrapper">
106-
<textarea
107-
ref={textareaRef}
108-
className="home-input-input-field"
109-
value={inputValue}
110-
onChange={(e) => setInputValue(e.target.value)}
111-
placeholder="Describe what you'd like to do or use / to reference files, people, and more"
112-
rows={1}
113-
/>
114-
<Button
115-
className="home-input-send-button"
116-
onClick={handleSubmit}
117-
disabled={!inputValue.trim()}
118-
icon={<Send20Regular />}
119-
/>
120-
</div>
121-
<div className="home-input-ai-footer">
122-
<Caption1>
123-
AI-Generated content may be incorrect
124-
</Caption1>
125-
</div>
126-
</div>
104+
<ChatInput
105+
value={input}
106+
placeholder="Describe what you'd like to do or use / to reference files, people, and more" onChange={setInput} >
107+
<Button
108+
appearance="subtle"
109+
className="home-input-send-button"
110+
onClick={handleSubmit}
111+
disabled={!input.trim()}
112+
icon={<Send20Regular />}
113+
/>
114+
</ChatInput>
127115

128116
<div className="home-input-quick-tasks-section">
129117
<div className="home-input-quick-tasks-header">
@@ -142,7 +130,9 @@ const HomeInput: React.FC<HomeInputProps> = ({
142130
</div>
143131
<div className="home-input-quick-task-text-content">
144132
<Body1Strong>{task.title}</Body1Strong>
145-
<Body1 className="home-input-quick-task-description">{task.description}</Body1>
133+
<Body1 className="home-input-quick-task-description">
134+
{task.description}
135+
</Body1>
146136
</div>
147137
</div>
148138
</Card>

src/frontend_react/src/components/content/PlanPanelRight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const PlanPanelRight: React.FC<TaskDetailsProps> = ({
1717

1818
return (
1919
<PanelRight
20-
panelWidth={450}
20+
panelWidth={400}
2121
defaultClosed={false}
2222
panelResize={true}
2323
panelType="first"

src/frontend_react/src/components/content/TaskDetails.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ const TaskDetails: React.FC<TaskDetailsProps> = ({
101101
/>
102102
<div className="task-details-agent-details">
103103
<span className="task-details-agent-name">{agent}</span>
104-
<span className="task-details-agent-description">agent description</span>
105104
</div>
106105
</div>
107106
))}

0 commit comments

Comments
 (0)