Skip to content

Commit

Permalink
feat:modified user-message view (All-Hands-AI#54)
Browse files Browse the repository at this point in the history
Signed-off-by: Vikramaditya <[email protected]>
  • Loading branch information
Ghat0tkach authored Mar 19, 2024
1 parent d5c28a4 commit 1e733b0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
22 changes: 18 additions & 4 deletions frontend/src/components/ChatInterface.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@
margin-bottom: 20px;
}

.message {
.message-layout {
display: flex;
margin-bottom: 10px;
}

.message{
display: flex;
}
.user-message{
display: flex;
flex-direction: row-reverse;
margin:10px 10px 0 auto
}
.user-message .message-content {
background-color: #007acc ;
}

.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
margin:0 10px;
}

.message-content {
Expand All @@ -32,6 +43,7 @@
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}


.input-container {
display: flex;
align-items: center;
Expand Down Expand Up @@ -61,6 +73,8 @@
font-size: 16px;
}


.input-container svg {
height: 16px;
}
}

23 changes: 16 additions & 7 deletions frontend/src/components/ChatInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ function ChatInterface(): JSX.Element {
<div className="chat-interface">
<div className="message-list">
{messages.map((msg, index) => (
<div key={index} className="message">
<img
src={msg.sender === "user" ? userAvatar : assistantAvatar}
alt={`${msg.sender} avatar`}
className="avatar"
/>
<div className="message-content">{msg.content}</div>
<div key={index} className="message-layout">
<div
className={`${msg.sender === "user" ? "user-message" : "message"}`}
>
<img
src={msg.sender === "user" ? userAvatar : assistantAvatar}
alt={`${msg.sender} avatar`}
className="avatar"
/>
<div className="message-content">{msg.content}</div>
</div>
</div>
))}
</div>
Expand All @@ -77,6 +81,11 @@ function ChatInterface(): JSX.Element {
value={inputMessage}
onChange={(e) => setInputMessage(e.target.value)}
placeholder="Send a message (won't interrupt the Assistant)"
onKeyDown={(e) => {
if (e.key === "Enter") {
handleSendMessage();
}
}}
/>
<button type="button" onClick={handleSendMessage}>
<span className="button-text">Send</span>
Expand Down

0 comments on commit 1e733b0

Please sign in to comment.