Skip to content

Commit 8342303

Browse files
committed
minor bug fixes
1 parent 4cbdab1 commit 8342303

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

frontend/src/components/ChatBox/ChatBox.component.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const ChatBox = () => {
3131
chatContainer.scrollTop = chatContainer.scrollHeight;
3232

3333
// Set scrollLeft to the maximum value to keep the scroll bar at the right
34-
chatContainer.scrollLeft = chatContainer.scrollWidth - chatContainer.clientWidth;
34+
chatContainer.scrollLeft =
35+
chatContainer.scrollWidth - chatContainer.clientWidth;
3536
}
3637
}, [chat]);
3738

@@ -60,20 +61,29 @@ const ChatBox = () => {
6061
backgroundColor: "gray.100",
6162
borderRadius: "md",
6263
padding: "10px",
63-
width: "100%" // Use 100% width
64+
width: "100%", // Use 100% width
6465
}}
6566
>
6667
{chat.map((entry, i) => (
6768
<HStack
6869
w="100%"
69-
justifyContent={entry.nickname === user?.username ? "flex-end" : "flex-start"} // Align based on the sender
70+
justifyContent={
71+
entry.nickname === user?.username ? "flex-end" : "flex-start"
72+
} // Align based on the sender
7073
key={i}
7174
>
7275
{entry.nickname !== user?.username && (
73-
<Avatar name={entry.nickname} w="40px" h="40px" />
76+
<Avatar
77+
name={entry.nickname}
78+
w="40px"
79+
h="40px"
80+
alignSelf="flex-start"
81+
/>
7482
)}
7583
<Text
76-
backgroundColor={entry.nickname === user?.username ? "blue.400" : "gray.200"}
84+
backgroundColor={
85+
entry.nickname === user?.username ? "blue.400" : "gray.200"
86+
}
7787
color={entry.nickname === user?.username ? "white" : "black"}
7888
borderRadius="lg"
7989
paddingX={2}
@@ -87,7 +97,12 @@ const ChatBox = () => {
8797
{entry.msg}
8898
</Text>
8999
{entry.nickname === user?.username && (
90-
<Avatar name={entry.nickname} w="40px" h="40px" />
100+
<Avatar
101+
name={entry.nickname}
102+
w="40px"
103+
h="40px"
104+
alignSelf="flex-start"
105+
/>
91106
)}
92107
</HStack>
93108
))}

0 commit comments

Comments
 (0)