Skip to content

Commit

Permalink
empty messages problem solved
Browse files Browse the repository at this point in the history
  • Loading branch information
FanisNgv committed Sep 12, 2024
1 parent 4063abe commit 4b69f99
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions frontend/src/app/components/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ export default function MessageList({ messages }: MessageListProps) {
<ScrollArea key={messages.length} className="flex-1 p-4 overflow-y-auto bg-white">
<AnimatePresence>
{messages.map((msg) => (
<motion.div
key={msg.id}
initial={{ opacity: 0, y: 50 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.5 }}
className={`mb-4 ${msg.sender === 'user' ? 'flex justify-end' : ''}`}
>
<div className={`inline-block p-2 rounded-lg max-w-[70%] break-words ${
msg.sender === 'user' ? 'bg-[#D958E4] text-white text-left' : 'bg-[#CDCED7] text-black text-justify'
}`}>
{msg.text}
</div>
</motion.div>
msg.text && (
<motion.div
key={msg.id}
initial={{ opacity: 0, y: 50 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.5 }}
className={`mb-4 ${msg.sender === 'user' ? 'flex justify-end' : ''}`}
>
<div className={`inline-block p-2 rounded-lg max-w-[70%] break-words ${
msg.sender === 'user' ? 'bg-[#D958E4] text-white text-left' : 'bg-[#CDCED7] text-black text-justify'
}`}>
{msg.text}
</div>
</motion.div>
)
))}
</AnimatePresence>
</ScrollArea>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export default function Home() {
redirectToConversation();
}, [router, config.ENDPOINT]);

return null; // или можно вернуть компонент загрузки
return null;
}

0 comments on commit 4b69f99

Please sign in to comment.