Skip to content

Commit

Permalink
submit third demo
Browse files Browse the repository at this point in the history
  • Loading branch information
SGYSY committed Jul 27, 2024
1 parent 1e4606d commit 4b90ff2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions im_server/frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ function App() {
setShowTaskCards(false);
};

const resetChat = () => {
setSelectedGroup(null);
setShowTaskCards(true);
};

return (
<div className="app-container">
<GroupList groups={groups} onGroupSelect={handleGroupSelect} />
Expand All @@ -326,6 +331,7 @@ function App() {
teamName={selectedGroup ? commID2Name[selectedGroup] : "Select a group"}
showTaskCards={showTaskCards}
setShowTaskCards={setShowTaskCards} // 传递回调函数
resetChat={resetChat}
/>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions im_server/frontend/src/components/ChatWindow/ChatWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import frontedIcon3 from '../ChatWindow/frontedIcon3.png';
import frontedIcon4 from '../ChatWindow/frontedIcon4.png';
import logoIcon from '../ChatWindow/IoA_logo.png';

function ChatWindow({ messages, teamName, showTaskCards, setShowTaskCards }) {
function ChatWindow({ messages, teamName, showTaskCards, setShowTaskCards, resetChat }) {
const [displayMessages, setDisplayMessages] = useState([]);
const [newMessageText, setNewMessageText] = useState("");
const [shouldScroll, setShouldScroll] = useState(false);
Expand Down Expand Up @@ -165,7 +165,7 @@ function ChatWindow({ messages, teamName, showTaskCards, setShowTaskCards }) {
<div className="right-header-bar">
<span className="group-name">INTERNET OF AGENTS</span>
<div className="actions"> {/* 包裹 New chat 和 Share 的 div */}
<div className="new-chat">
<div className="new-chat" onClick={resetChat}>
<img src={chatIcon} alt="Chat" className="chat-img" />
<span className="username-chat">New chat</span>
</div>
Expand Down

0 comments on commit 4b90ff2

Please sign in to comment.