From 315411facdb0cb136decf769457960cbbc8c920c Mon Sep 17 00:00:00 2001 From: Aditya Nandan <61308761+iMADi-ARCH@users.noreply.github.com> Date: Sun, 2 Jul 2023 18:00:11 +0530 Subject: [PATCH] remove blank scrollbars and use predefined components (#452) * style(chat and brains dropdown): remove blank scrollbars and use predefined components * style(chat): use custom scrollbar style by using scrollbar class --- frontend/app/chat/[chatId]/page.tsx | 2 +- .../chat/components/ChatMessages/index.tsx | 2 +- .../app/chat/components/ChatsList/index.tsx | 15 +-- frontend/app/chat/layout.tsx | 2 +- .../NavItems/components/BrainsDropDown.tsx | 101 +++++++++++------- 5 files changed, 67 insertions(+), 55 deletions(-) diff --git a/frontend/app/chat/[chatId]/page.tsx b/frontend/app/chat/[chatId]/page.tsx index 79636bc61..1e88f8133 100644 --- a/frontend/app/chat/[chatId]/page.tsx +++ b/frontend/app/chat/[chatId]/page.tsx @@ -9,7 +9,7 @@ import { ChatProvider } from "./context/ChatContext"; export default function ChatPage() { return (
-
+
{ return (
diff --git a/frontend/app/chat/components/ChatsList/index.tsx b/frontend/app/chat/components/ChatsList/index.tsx index 8448dc322..ca8785f1f 100644 --- a/frontend/app/chat/components/ChatsList/index.tsx +++ b/frontend/app/chat/components/ChatsList/index.tsx @@ -26,7 +26,7 @@ export const ChatsList = (): JSX.Element => { setOpen(false); } }} - className="lg:sticky fixed top-0 left-0 bottom-0 overflow-visible z-30 border-r border-black/10 dark:border-white/25 bg-white dark:bg-black" + className="flex flex-col lg:sticky fixed top-16 left-0 bottom-0 lg:h-[90vh] overflow-visible z-30 border-r border-black/10 dark:border-white/25 bg-white dark:bg-black" > { ? "10px 10px 16px rgba(0, 0, 0, 0)" : "10px 10px 16px rgba(0, 0, 0, 0.5)", }} - className={cn("overflow-hidden")} + className={cn("overflow-hidden flex flex-col flex-1")} > -
+
-
+
{allChats.map((chat) => ( { return ( -
+
{children}
diff --git a/frontend/lib/components/NavBar/components/NavItems/components/BrainsDropDown.tsx b/frontend/lib/components/NavBar/components/NavItems/components/BrainsDropDown.tsx index 925af5e5e..c2da2ce18 100644 --- a/frontend/lib/components/NavBar/components/NavItems/components/BrainsDropDown.tsx +++ b/frontend/lib/components/NavBar/components/NavItems/components/BrainsDropDown.tsx @@ -3,9 +3,12 @@ import { useEffect, useRef, useState } from "react"; import { FaBrain } from "react-icons/fa"; import { IoMdAdd } from "react-icons/io"; +import Button from "@/lib/components/ui/Button"; +import Field from "@/lib/components/ui/Field"; import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext"; import { useEventTracking } from "@/services/analytics/useEventTracking"; - +import { AnimatePresence, motion } from "framer-motion"; +import { MdCheck } from "react-icons/md"; export const BrainsDropDown = (): JSX.Element => { const [showDropdown, setShowDropdown] = useState(false); @@ -17,7 +20,7 @@ export const BrainsDropDown = (): JSX.Element => { const toggleDropdown = () => { setShowDropdown((prevState) => !prevState); - void track("SHOW_BRAINS_DROPDOWN") + void track("SHOW_BRAINS_DROPDOWN"); }; const handleCreateBrain = () => { @@ -27,7 +30,7 @@ export const BrainsDropDown = (): JSX.Element => { void createBrain(newBrainName); setNewBrainName(""); // Reset the new brain name input - void track("BRAIN_CREATED") + void track("BRAIN_CREATED"); }; const handleClickOutside = (event: MouseEvent) => { @@ -40,9 +43,9 @@ export const BrainsDropDown = (): JSX.Element => { }; const changeBrains = (value: string) => { - void track("CHANGE_BRAIN") - setNewBrainName(value) - } + void track("CHANGE_BRAIN"); + setNewBrainName(value); + }; useEffect(() => { document.addEventListener("mousedown", handleClickOutside); @@ -63,42 +66,58 @@ export const BrainsDropDown = (): JSX.Element => { > - {showDropdown && ( -
- {/* Option to create a new brain */} -
-
- changeBrains(e.target.value)} - className="flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:outline-none" - /> - -
-
- {/* List of brains */} - {allBrains.map((brain) => ( - - ))} -
- )} + changeBrains(e.target.value)} + /> + + +
+ {/* List of brains */} + {allBrains.map((brain) => ( + + ))} +
+ + )} +
);