From e6e5099d6bbb3a3a6f7a6464e5b60f70228aec11 Mon Sep 17 00:00:00 2001 From: Aditya Nandan <61308761+iMADi-ARCH@users.noreply.github.com> Date: Thu, 15 Jun 2023 02:28:37 +0530 Subject: [PATCH] Feat/responsive chat bar (#314) * feat(chat): close and open chatbar on button toggle * feat(chat): drag to open chat bar * fix(chat): fix warning of not being able to animate shadows * fix(chat): make chat input a little responsive --------- Co-authored-by: Stan Girard --- .../ChatMessages/ChatInput/ConfigButton.tsx | 4 +- .../ChatMessages/ChatInput/MicButton.tsx | 6 +- .../ChatMessages/ChatInput/index.tsx | 12 ++- .../app/chat/components/ChatsList/index.tsx | 77 +++++++++++++++---- .../lib/context/BrainConfigProvider/types.ts | 7 +- 5 files changed, 79 insertions(+), 27 deletions(-) diff --git a/frontend/app/chat/components/ChatMessages/ChatInput/ConfigButton.tsx b/frontend/app/chat/components/ChatMessages/ChatInput/ConfigButton.tsx index b6c2ecd7d..19f98cb54 100644 --- a/frontend/app/chat/components/ChatMessages/ChatInput/ConfigButton.tsx +++ b/frontend/app/chat/components/ChatMessages/ChatInput/ConfigButton.tsx @@ -6,8 +6,8 @@ import { MdSettings } from "react-icons/md"; export function ConfigButton() { return ( - ); diff --git a/frontend/app/chat/components/ChatMessages/ChatInput/MicButton.tsx b/frontend/app/chat/components/ChatMessages/ChatInput/MicButton.tsx index 53bf19368..7a01802a6 100644 --- a/frontend/app/chat/components/ChatMessages/ChatInput/MicButton.tsx +++ b/frontend/app/chat/components/ChatMessages/ChatInput/MicButton.tsx @@ -8,16 +8,16 @@ export function MicButton() { return ( ); diff --git a/frontend/app/chat/components/ChatMessages/ChatInput/index.tsx b/frontend/app/chat/components/ChatMessages/ChatInput/index.tsx index 9ebf3445d..d37904c2e 100644 --- a/frontend/app/chat/components/ChatMessages/ChatInput/index.tsx +++ b/frontend/app/chat/components/ChatMessages/ChatInput/index.tsx @@ -28,11 +28,17 @@ export function ChatInput() { className="w-full p-2 border border-gray-300 dark:border-gray-500 outline-none rounded dark:bg-gray-800" placeholder="Begin conversation here..." /> - - - +
+ + +
); } diff --git a/frontend/app/chat/components/ChatsList/index.tsx b/frontend/app/chat/components/ChatsList/index.tsx index fd53c529f..05d2ce285 100644 --- a/frontend/app/chat/components/ChatsList/index.tsx +++ b/frontend/app/chat/components/ChatsList/index.tsx @@ -1,23 +1,72 @@ "use client"; +import { cn } from "@/lib/utils"; +import { MotionConfig, motion } from "framer-motion"; +import { useState } from "react"; +import { MdChevronRight } from "react-icons/md"; import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext"; import ChatsListItem from "./ChatsListItem"; import { NewChatButton } from "./NewChatButton"; export function ChatsList() { const { allChats, deleteChat } = useChatsContext(); + + const [open, setOpen] = useState(false); + return ( -
- -
+ + { + if (info.offset.x > 100 && !open) { + setOpen(true); + } else if (info.offset.x < -100 && open) { + 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" + > + +
+ +
+
+ +
+
); } diff --git a/frontend/lib/context/BrainConfigProvider/types.ts b/frontend/lib/context/BrainConfigProvider/types.ts index 30aee1261..55498a084 100644 --- a/frontend/lib/context/BrainConfigProvider/types.ts +++ b/frontend/lib/context/BrainConfigProvider/types.ts @@ -32,17 +32,14 @@ export const anthropicModels = [ export const googleModels = ["vertexai"] as const; // TODO activate when not in demo mode -// export const googleModels = [] as const; +// export const googleModels = [] as const; export const models = [ ...openAiModels, ...anthropicModels, ...googleModels, ] as const; -export const paidModels= [ - ...openAiPaidModels, - ...googleModels, -] as const; +export const paidModels = [...openAiPaidModels, ...googleModels] as const; export type PaidModels = (typeof paidModels)[number];