Skip to content

Commit

Permalink
sorting messages
Browse files Browse the repository at this point in the history
  • Loading branch information
FanisNgv committed Sep 13, 2024
1 parent 56a99e3 commit ede20d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/app/(withSidebar)/conversations/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export default function ConversationPage({
setMessage("");
};

const isPendingRequest = currentConversation &&
currentConversation.length > 0 &&
const isPendingRequest = currentConversation &&
currentConversation.length > 0 &&
currentConversation[currentConversation.length - 1].sender === "user" &&
currentConversation[currentConversation.length - 1].text !== null;

Expand Down Expand Up @@ -120,7 +120,7 @@ export default function ConversationPage({
...(isPendingRequest
? [{ id: Date.now(), text: "Ответ вот-вот будет...", sender: "bot" }]
: []),
]}
].sort((a, b) => a.id - b.id)}
/>

<div className="p-4 bg-white border-t border-gray-300 fixed bottom-0 w-full md:relative">
Expand All @@ -147,4 +147,4 @@ export default function ConversationPage({
</main>
</div>
);
}
}

0 comments on commit ede20d2

Please sign in to comment.