Skip to content

Commit

Permalink
Create single team per chat
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Dec 19, 2023
1 parent f9ade72 commit cae4359
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 7 deletions.
39 changes: 38 additions & 1 deletion src/client/components/ConversationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { useState } from "react";
import Markdown from "markdown-to-jsx";

import type { Conversation } from "@wasp/entities";

import logo from "../static/captn-logo.png";

type ConversationsListProps = {
conversations: Conversation[];
isLoading: boolean;
};

export default function ConversationsList({
conversations,
isLoading,
}: ConversationsListProps) {
return (
<div className="w-full">
Expand Down Expand Up @@ -84,6 +85,42 @@ export default function ConversationsList({
</div>
);
})}
<div
className={`flex items-center px-5 py-2 group bg-captn-light-cream flex-col ${
isLoading ? "" : "hidden"
}`}
style={{ minHeight: "85px" }}
>
<div
className="relative ml-3 block w-full p-4 pl-10 text-sm text-captn-dark-blue border-captn-light-cream rounded-lg bg-captn-light-cream "
style={{ maxWidth: "840px", margin: "auto" }}
>
<span
className="absolute inline-block"
style={{
left: "-15px",
top: "6px",
height: " 45px",
width: "45px",
}}
>
<img
alt="captn logo"
src={logo}
className="w-full h-full"
style={{ borderRadius: "50%" }}
/>
</span>
<div className="chat-conversations text-base flex flex-col gap-2">
<span>
I am presently navigating the waters of your request.
<br />
Kindly stay anchored, and I will promptly return to you once I
have information to share.
</span>
</div>
</div>
</div>
</div>
);
}
22 changes: 16 additions & 6 deletions src/client/components/ConversationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ export default function ConversationWrapper() {

const scrollToBottom = () => {
if (chatWindowRef.current) {
// @ts-ignore
chatWindowRef.current.scrollTo({
// Delay the scrolling animation by 500ms
setTimeout(() => {
// Scroll to the bottom with a smooth behavior
// @ts-ignore
top: chatWindowRef.current.scrollHeight,
behavior: "smooth",
});
chatWindowRef.current.scrollTo({
// @ts-ignore
top: chatWindowRef.current.scrollHeight,
behavior: "smooth",
});
}, 200);
}
};

Expand Down Expand Up @@ -152,7 +156,13 @@ export default function ConversationWrapper() {
<div className="flex-1 overflow-hidden pb-36">
<div ref={chatWindowRef} className={`${chatContainerClass}`}>
{conversations && (
<ConversationsList conversations={conversations} />
<ConversationsList
conversations={conversations}
isLoading={
currentChatDetails &&
currentChatDetails.team_status === "inprogress"
}
/>
)}
</div>
{isLoading && <Loader />}
Expand Down

0 comments on commit cae4359

Please sign in to comment.