From 894e5cacc2145f0b587429606a35b3c14108bf74 Mon Sep 17 00:00:00 2001 From: rbakkalian <71007207+rbakkalian@users.noreply.github.com> Date: Fri, 10 May 2024 23:49:38 +0400 Subject: [PATCH] Styled conversation page with all its components (#39) --- frontend/src/pages/Conversation/Conversation.tsx | 12 ++++++++---- .../pages/Conversation/Discussions/Discussion.tsx | 2 +- .../pages/Conversation/Discussions/Discussions.tsx | 8 +++++--- frontend/src/pages/Conversation/Navbar/Navbar.tsx | 13 +++++++------ frontend/src/pages/Conversation/Prompt/Prompt.tsx | 10 +++++++--- frontend/src/ui/Grid/Grid.tsx | 2 +- frontend/src/ui/Modal/Modal.tsx | 3 +-- 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/frontend/src/pages/Conversation/Conversation.tsx b/frontend/src/pages/Conversation/Conversation.tsx index 0372004..0d4c92c 100644 --- a/frontend/src/pages/Conversation/Conversation.tsx +++ b/frontend/src/pages/Conversation/Conversation.tsx @@ -12,14 +12,18 @@ function Conversation() { if (!id) return null; return ( - - + + - + - + diff --git a/frontend/src/pages/Conversation/Discussions/Discussion.tsx b/frontend/src/pages/Conversation/Discussions/Discussion.tsx index 80d7d67..3545f37 100644 --- a/frontend/src/pages/Conversation/Discussions/Discussion.tsx +++ b/frontend/src/pages/Conversation/Discussions/Discussion.tsx @@ -7,7 +7,7 @@ interface DiscussionProps { export default function Discussion({ role, text }: DiscussionProps) { return ( -
+
{role === PromptRole.User ? "YOU" : "Chatto"}
{text}
diff --git a/frontend/src/pages/Conversation/Discussions/Discussions.tsx b/frontend/src/pages/Conversation/Discussions/Discussions.tsx index 7643d7a..5f050bc 100644 --- a/frontend/src/pages/Conversation/Discussions/Discussions.tsx +++ b/frontend/src/pages/Conversation/Discussions/Discussions.tsx @@ -11,10 +11,12 @@ export default function Discussions({ id }: DiscussionProps) { const { data, isLoading, isError } = useGetConversation(id); return ( -
+
{isLoading && !data && } - {isError &&
Something went Wrong
} - {data?.discussions?.length === 0 && !isError && !isLoading &&
Ask me Questions
} + {isError &&
Something Went Wrong
} + {data?.discussions?.length === 0 && !isError && !isLoading && ( +
Ask me Questions
+ )} {data?.discussions?.map((discussion) => ( ))} diff --git a/frontend/src/pages/Conversation/Navbar/Navbar.tsx b/frontend/src/pages/Conversation/Navbar/Navbar.tsx index 44f6fc6..b0069bd 100644 --- a/frontend/src/pages/Conversation/Navbar/Navbar.tsx +++ b/frontend/src/pages/Conversation/Navbar/Navbar.tsx @@ -21,23 +21,23 @@ function Navbar({ id }: NavbarProps) { }; return ( -
-
- {isError && } + {isError &&

Something Went Wrong

} {isFetching && } {!isFetching && data && data.length === 0 &&
No Conversation
} {data?.map((conversation) => ( diff --git a/frontend/src/pages/Conversation/Prompt/Prompt.tsx b/frontend/src/pages/Conversation/Prompt/Prompt.tsx index 5db6a9d..7d7807a 100644 --- a/frontend/src/pages/Conversation/Prompt/Prompt.tsx +++ b/frontend/src/pages/Conversation/Prompt/Prompt.tsx @@ -19,17 +19,21 @@ function Prompt({ id }: PromptProps) { }; return ( -
+
setTextValue(e.currentTarget.value)} disabled={isPending} + placeholder="Enter your message..." />