From acc88e362d314cc28836c382b1ce8eba3483faa4 Mon Sep 17 00:00:00 2001 From: notmd <33456881+notmd@users.noreply.github.com> Date: Sat, 22 Apr 2023 01:03:19 +0700 Subject: [PATCH] Rework chat layout UI (#2741) The `QueueInfo` is removed for now. I will add it back in follow up PR. Most of the change are UI code, there is no logic here, it safe to merge Desktop Light mode ![image](https://user-images.githubusercontent.com/33456881/233029668-d04702cd-9f3b-4315-a4e2-8d99d78c68aa.png) Dark mode ![image](https://user-images.githubusercontent.com/33456881/233029734-eaf0b350-43c8-487f-a1a4-13972280bb57.png) Mobile Light mode ![image](https://user-images.githubusercontent.com/33456881/233031042-45d5fd2c-ca70-48c4-b41a-abb6c70ac502.png) Dark mode ![image](https://user-images.githubusercontent.com/33456881/233031086-508eabc4-1910-4d81-b079-0a5720d7e67d.png) --------- Co-authored-by: AbdBarho --- website/public/locales/en/chat.json | 3 +- .../src/components/Chat/ChatConfigDesktop.tsx | 38 ++++++ ...hatConfigDrawer.tsx => ChatConfigForm.tsx} | 39 +------ .../src/components/Chat/ChatConfigMobile.tsx | 42 +++++++ .../src/components/Chat/ChatConfigSaver.tsx | 9 +- .../src/components/Chat/ChatConversation.tsx | 48 +++++--- website/src/components/Chat/ChatForm.tsx | 73 +++++++----- .../components/Chat/ChatInputIconButton.tsx | 19 +++ website/src/components/Chat/ChatListBase.tsx | 47 +++----- .../src/components/Chat/ChatListDesktop.tsx | 15 +-- website/src/components/Chat/ChatListItem.tsx | 9 +- .../src/components/Chat/ChatListMobile.tsx | 49 ++++++-- .../src/components/Chat/ChatMessageEntry.tsx | 10 +- website/src/components/Chat/ChatSection.tsx | 42 +++---- .../components/Chat/InferencePoweredBy.tsx | 37 +++--- website/src/components/Header/Header.tsx | 9 +- website/src/components/Layout/ChatLayout.tsx | 49 ++++---- .../components/Messages/BaseMessageEntry.tsx | 4 +- website/src/components/SideMenu.tsx | 109 ++++++++++-------- website/src/components/SideMenuLayout.tsx | 31 ++--- website/src/components/TeamMember.tsx | 8 +- website/src/pages/chat/index.tsx | 15 ++- website/src/styles/Theme/index.ts | 8 +- website/src/utils/chat.ts | 3 +- 24 files changed, 432 insertions(+), 284 deletions(-) create mode 100644 website/src/components/Chat/ChatConfigDesktop.tsx rename website/src/components/Chat/{ChatConfigDrawer.tsx => ChatConfigForm.tsx} (86%) create mode 100644 website/src/components/Chat/ChatConfigMobile.tsx create mode 100644 website/src/components/Chat/ChatInputIconButton.tsx diff --git a/website/public/locales/en/chat.json b/website/public/locales/en/chat.json index bd473b74ff..99ca3bd84a 100644 --- a/website/public/locales/en/chat.json +++ b/website/public/locales/en/chat.json @@ -23,5 +23,6 @@ "top_p": "Top P", "typical_p": "Typical P", "you_are_logged_in": "You are logged in to the chat service", - "your_chats": "Your Chats" + "your_chats": "Your Chats", + "input_placeholder": "Ask the assistant anything" } diff --git a/website/src/components/Chat/ChatConfigDesktop.tsx b/website/src/components/Chat/ChatConfigDesktop.tsx new file mode 100644 index 0000000000..e58b7253ca --- /dev/null +++ b/website/src/components/Chat/ChatConfigDesktop.tsx @@ -0,0 +1,38 @@ +import { Box } from "@chakra-ui/react"; +import { useTranslation } from "next-i18next"; +import { memo } from "react"; +import SimpleBar from "simplebar-react"; + +import { ChatConfigForm } from "./ChatConfigForm"; + +export const ChatConfigDesktop = memo(function ChatConfigDesktop() { + const { t } = useTranslation("chat"); + return ( + + + {t("config_title")} + + + + + + + ); +}); diff --git a/website/src/components/Chat/ChatConfigDrawer.tsx b/website/src/components/Chat/ChatConfigForm.tsx similarity index 86% rename from website/src/components/Chat/ChatConfigDrawer.tsx rename to website/src/components/Chat/ChatConfigForm.tsx index bfb33b31e7..69a5d7bd7c 100644 --- a/website/src/components/Chat/ChatConfigDrawer.tsx +++ b/website/src/components/Chat/ChatConfigForm.tsx @@ -1,14 +1,7 @@ import { - Drawer, - DrawerBody, - DrawerCloseButton, - DrawerContent, - DrawerHeader, - DrawerOverlay, Flex, FormControl, FormLabel, - IconButton, NumberDecrementStepper, NumberIncrementStepper, NumberInput, @@ -22,9 +15,7 @@ import { Stack, Switch, Tooltip, - useDisclosure, } from "@chakra-ui/react"; -import { Settings } from "lucide-react"; import { useTranslation } from "next-i18next"; import { ChangeEvent, memo, useCallback, useState } from "react"; import { Controller, useFormContext, useWatch } from "react-hook-form"; @@ -32,28 +23,6 @@ import { ChatConfigFormData, SamplingParameters } from "src/types/Chat"; import { useChatContext } from "./ChatContext"; import { areParametersEqual } from "./WorkParameters"; - -export const ChatConfigDrawer = memo(function ChatConfigDrawer() { - const { isOpen, onOpen, onClose } = useDisclosure(); - - const { t } = useTranslation("chat"); - return ( - <> - } onClick={onOpen} size="lg" borderRadius="xl" /> - - - - - {t("config_title")} - - - - - - > - ); -}); - const sliderItems: Readonly< Array<{ key: keyof SamplingParameters; @@ -112,7 +81,7 @@ const parameterLabel: Record = { typical_p: "Typical P", }; -const ChatConfigForm = () => { +export const ChatConfigForm = memo(function ChatConfigForm() { const { t } = useTranslation("chat"); const { modelInfos } = useChatContext(); @@ -178,7 +147,7 @@ const ChatConfigForm = () => { ))} ); -}; +}); type NumberInputSliderProps = { max?: number; @@ -216,7 +185,9 @@ const ChatParameterField = memo(function ChatParameterField(props: NumberInputSl - {label} + + {label} + diff --git a/website/src/components/Chat/ChatConfigMobile.tsx b/website/src/components/Chat/ChatConfigMobile.tsx new file mode 100644 index 0000000000..caa7579b02 --- /dev/null +++ b/website/src/components/Chat/ChatConfigMobile.tsx @@ -0,0 +1,42 @@ +import { + Drawer, + DrawerBody, + DrawerCloseButton, + DrawerContent, + DrawerHeader, + DrawerOverlay, + useDisclosure, +} from "@chakra-ui/react"; +import { Settings } from "lucide-react"; +import { useTranslation } from "next-i18next"; +import { memo } from "react"; + +import { ChatConfigForm } from "./ChatConfigForm"; +import { ChatInputIconButton } from "./ChatInputIconButton"; + +export const ChatConfigDrawer = memo(function ChatConfigDrawer() { + const { isOpen, onOpen, onClose } = useDisclosure(); + + const { t } = useTranslation("chat"); + return ( + <> + + + + + + {t("config_title")} + + + + + + > + ); +}); diff --git a/website/src/components/Chat/ChatConfigSaver.tsx b/website/src/components/Chat/ChatConfigSaver.tsx index 698317d09f..2d258d0a09 100644 --- a/website/src/components/Chat/ChatConfigSaver.tsx +++ b/website/src/components/Chat/ChatConfigSaver.tsx @@ -4,11 +4,14 @@ import { ChatConfigFormData } from "src/types/Chat"; import { setConfigCache } from "src/utils/chat"; export const ChatConfigSaver = () => { - const { watch } = useFormContext(); + const { watch, formState } = useFormContext(); const config = watch(); useEffect(() => { - setConfigCache(config); - }, [config]); + // only update when form is changed + if (formState.isDirty) { + setConfigCache(config); + } + }, [config, formState.isDirty]); return null; }; diff --git a/website/src/components/Chat/ChatConversation.tsx b/website/src/components/Chat/ChatConversation.tsx index ce5138d686..4bdc262a6c 100644 --- a/website/src/components/Chat/ChatConversation.tsx +++ b/website/src/components/Chat/ChatConversation.tsx @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Flex, useBoolean, useToast } from "@chakra-ui/react"; +import { Box, useBoolean, useToast } from "@chakra-ui/react"; import { memo, useCallback, useRef, useState } from "react"; import { UseFormGetValues } from "react-hook-form"; +import SimpleBar from "simplebar-react"; import { useMessageVote } from "src/hooks/chat/useMessageVote"; import { get, post } from "src/lib/api"; import { handleChatEventStream, QueueInfo } from "src/lib/chat_stream"; @@ -200,18 +201,39 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf ); return ( - - - {isSending && streamedResponse && } - + + + + {isSending && streamedResponse && } + - + ); }); diff --git a/website/src/components/Chat/ChatForm.tsx b/website/src/components/Chat/ChatForm.tsx index da27a5808a..059f5cef24 100644 --- a/website/src/components/Chat/ChatForm.tsx +++ b/website/src/components/Chat/ChatForm.tsx @@ -1,11 +1,12 @@ -import { Button, Grid, Textarea } from "@chakra-ui/react"; +import { Box, CircularProgress, Flex, Textarea } from "@chakra-ui/react"; +import { Send } from "lucide-react"; import { useTranslation } from "next-i18next"; import { forwardRef, KeyboardEvent, SyntheticEvent, useCallback } from "react"; import TextareaAutosize from "react-textarea-autosize"; import { QueueInfo } from "src/lib/chat_stream"; -import { ChatConfigDrawer } from "./ChatConfigDrawer"; -import { QueueInfoMessage } from "./QueueInfoMessage"; +import { ChatConfigDrawer } from "./ChatConfigMobile"; +import { ChatInputIconButton } from "./ChatInputIconButton"; type ChatFormProps = { isSending: boolean; @@ -16,7 +17,7 @@ type ChatFormProps = { // eslint-disable-next-line react/display-name export const ChatForm = forwardRef((props, ref) => { const { isSending, onSubmit: onSubmit, queueInfo } = props; - const { t } = useTranslation("common"); + const { t } = useTranslation("chat"); const handleSubmit = useCallback( (e: SyntheticEvent) => { e.preventDefault(); @@ -34,31 +35,43 @@ export const ChatForm = forwardRef((props, r [onSubmit] ); return ( - - - - : undefined} - size="lg" - borderRadius="xl" - > - {t("submit")} - - - - + + + + + + {isSending ? ( + + ) : ( + + )} + + + ); }); diff --git a/website/src/components/Chat/ChatInputIconButton.tsx b/website/src/components/Chat/ChatInputIconButton.tsx new file mode 100644 index 0000000000..0d050c1b8b --- /dev/null +++ b/website/src/components/Chat/ChatInputIconButton.tsx @@ -0,0 +1,19 @@ +import { Box, BoxProps } from "@chakra-ui/react"; +import { LucideIcon } from "lucide-react"; + +export const ChatInputIconButton = ({ icon: Icon, ...props }: { icon: LucideIcon } & BoxProps) => ( + + + +); diff --git a/website/src/components/Chat/ChatListBase.tsx b/website/src/components/Chat/ChatListBase.tsx index 149f894e1e..751d1fdaa0 100644 --- a/website/src/components/Chat/ChatListBase.tsx +++ b/website/src/components/Chat/ChatListBase.tsx @@ -1,40 +1,28 @@ import "simplebar-react/dist/simplebar.min.css"; -import { Card, CardProps } from "@chakra-ui/react"; +import { Box, CardProps } from "@chakra-ui/react"; import { Plus } from "lucide-react"; import { useTranslation } from "next-i18next"; -import { memo, useCallback, useMemo } from "react"; +import { memo, useCallback } from "react"; import SimpleBar from "simplebar-react"; import { get } from "src/lib/api"; import { API_ROUTES } from "src/lib/routes"; import { GetChatsResponse } from "src/types/Chat"; import useSWR from "swr"; -import { HEADER_HEIGHT } from "../Header/Header"; import { ChatListItem } from "./ChatListItem"; import { CreateChatButton } from "./CreateChatButton"; +import { InferencePoweredBy } from "./InferencePoweredBy"; export const ChatListBase = memo(function ChatListBase({ - isSideBar, chats, // TODO: can we remove this? ...props -}: CardProps & { isSideBar: boolean; chats?: GetChatsResponse }) { +}: CardProps & { chats?: GetChatsResponse }) { const { data: response, mutate: mutateChatResponse } = useSWR(API_ROUTES.LIST_CHAT, get, { fallbackData: chats, }); const { t } = useTranslation(["common", "chat"]); - const sideProps: CardProps = useMemo( - () => - isSideBar - ? { - w: "260px", - position: "fixed", - } - : {}, - [isSideBar] - ); - const handleUpdateTitle = useCallback( ({ chatId, title }: { chatId: string; title: string }) => { mutateChatResponse( @@ -62,22 +50,16 @@ export const ChatListBase = memo(function ChatListBase({ ); return ( - {response?.chats.map((chat) => ( ))} - + + ); }); diff --git a/website/src/components/Chat/ChatListDesktop.tsx b/website/src/components/Chat/ChatListDesktop.tsx index 39293683ae..5311a31206 100644 --- a/website/src/components/Chat/ChatListDesktop.tsx +++ b/website/src/components/Chat/ChatListDesktop.tsx @@ -1,12 +1,7 @@ -import { Box } from "@chakra-ui/react"; -import { memo } from "react"; - import { ChatListBase } from "./ChatListBase"; -export const ChatListDesktop = memo(function ChatListDesktop() { - return ( - - - - ); -}); +const display = { base: "none", lg: "flex" }; + +export const ChatListDesktop = () => { + return ; +}; diff --git a/website/src/components/Chat/ChatListItem.tsx b/website/src/components/Chat/ChatListItem.tsx index ed653054ba..513055e156 100644 --- a/website/src/components/Chat/ChatListItem.tsx +++ b/website/src/components/Chat/ChatListItem.tsx @@ -4,7 +4,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { useTranslation } from "next-i18next"; import { KeyboardEvent, MouseEvent, useCallback, useRef } from "react"; -import { del, put } from "src/lib/api"; +import { put } from "src/lib/api"; import { API_ROUTES, ROUTES } from "src/lib/routes"; import { ChatItem } from "src/types/Chat"; import useSWRMutation from "swr/mutation"; @@ -73,7 +73,12 @@ export const ChatListItem = ({ borderRadius="lg" bg={isEditing ? "transparent" : undefined} _hover={{ - bg: isEditing ? "transparent" : undefined, + bg: isEditing ? "transparent" : isActive ? "gray.200" : "gray.100", + }} + _dark={{ + _hover: { + bg: isEditing ? "transparent" : isActive ? "whiteAlpha.300" : "whiteAlpha.200", + }, }} > {!isEditing ? ( diff --git a/website/src/components/Chat/ChatListMobile.tsx b/website/src/components/Chat/ChatListMobile.tsx index 97bb9234d1..7a46a40e52 100644 --- a/website/src/components/Chat/ChatListMobile.tsx +++ b/website/src/components/Chat/ChatListMobile.tsx @@ -1,12 +1,22 @@ -import { Drawer, DrawerCloseButton, DrawerContent, DrawerOverlay, IconButton, useDisclosure } from "@chakra-ui/react"; +import { + Drawer, + DrawerCloseButton, + DrawerContent, + DrawerOverlay, + Flex, + IconButton, + useDisclosure, +} from "@chakra-ui/react"; import { AlignJustify } from "lucide-react"; import { useRouter } from "next/router"; import { useTranslation } from "next-i18next"; -import { useEffect } from "react"; +import { memo, useEffect } from "react"; +import { getDashBoardLayoutSidebarItem } from "../Layout"; +import { SideMenuItem } from "../SideMenu"; import { ChatListBase } from "./ChatListBase"; -export function ChatListMobile() { +export const ChatListMobile = memo(function ChatListMobile() { const { isOpen, onOpen, onClose } = useDisclosure(); const { t } = useTranslation("chat"); const { events } = useRouter(); @@ -27,7 +37,7 @@ export function ChatListMobile() { return ( <> } aria-label={t("your_chats")} @@ -38,7 +48,7 @@ export function ChatListMobile() { > - + - + + + {getDashBoardLayoutSidebarItem().map((item) => ( + + ))} + + + > ); -} +}); diff --git a/website/src/components/Chat/ChatMessageEntry.tsx b/website/src/components/Chat/ChatMessageEntry.tsx index 94fffef9fe..0a290dc9a4 100644 --- a/website/src/components/Chat/ChatMessageEntry.tsx +++ b/website/src/components/Chat/ChatMessageEntry.tsx @@ -167,11 +167,16 @@ type PendingMessageEntryProps = { "data-id"?: string; }; +const messageEntryContainerProps = { + maxWidth: { base: "3xl", "2xl": "4xl" }, + w: "full", +}; + export const PendingMessageEntry = forwardRef(function PendingMessageEntry( { content, isAssistant, children, ...props }, ref ) { - const bgUser = useColorModeValue("white", "gray.700"); + const bgUser = "transparent"; const bgAssistant = useColorModeValue("#DFE8F1", "#42536B"); const { data: session } = useSession(); const image = session?.user?.image; @@ -188,7 +193,8 @@ export const PendingMessageEntry = forwardRef {children} diff --git a/website/src/components/Chat/ChatSection.tsx b/website/src/components/Chat/ChatSection.tsx index 97f75cda23..c52ba54618 100644 --- a/website/src/components/Chat/ChatSection.tsx +++ b/website/src/components/Chat/ChatSection.tsx @@ -1,46 +1,38 @@ -import { Card, CardBody, Divider } from "@chakra-ui/react"; -import dynamic from "next/dynamic"; import { FormProvider, useForm } from "react-hook-form"; import { ChatConfigFormData } from "src/types/Chat"; import { getConfigCache } from "src/utils/chat"; +import { useIsomorphicLayoutEffect } from "usehooks-ts"; +import { ChatConfigDesktop } from "./ChatConfigDesktop"; import { ChatConfigSaver } from "./ChatConfigSaver"; import { useChatContext } from "./ChatContext"; import { ChatConversation } from "./ChatConversation"; -import { InferencePoweredBy } from "./InferencePoweredBy"; - -const ChatConfigSummary = dynamic(() => import("./ChatConfigSummary"), { ssr: false }); export const ChatSection = ({ chatId }: { chatId: string | null }) => { const { modelInfos } = useChatContext(); console.assert(modelInfos.length > 0, "No model config was found"); - let defaultValues = getConfigCache(); - if (defaultValues) { - const model = modelInfos.find((model) => model.name === defaultValues.model_config_name); - if (!model) { - defaultValues = null; - } - } - if (!defaultValues) { - defaultValues = { + const form = useForm({ + defaultValues: { ...modelInfos[0].parameter_configs[0].sampling_parameters, model_config_name: modelInfos[0].name, - }; - } + }, + }); + + useIsomorphicLayoutEffect(() => { + const cache = getConfigCache(); + const model = modelInfos.find((model) => model.name === cache?.model_config_name); + if (model && cache) { + form.reset(cache); + } + }, [form.reset, modelInfos]); - const form = useForm({ defaultValues }); return ( - - - - - - - - + + + ); diff --git a/website/src/components/Chat/InferencePoweredBy.tsx b/website/src/components/Chat/InferencePoweredBy.tsx index ce5bb58ac0..b86b06e496 100644 --- a/website/src/components/Chat/InferencePoweredBy.tsx +++ b/website/src/components/Chat/InferencePoweredBy.tsx @@ -1,30 +1,27 @@ -import { Grid, Heading } from "@chakra-ui/react"; +import { Flex } from "@chakra-ui/react"; +import { Fragment } from "react"; import { TeamMember } from "src/components/TeamMember"; import data from "../../data/team.json"; -const SponsorGroup = ({ heading, members }) => { - const { people } = data; - return ( - <> - - {heading} - - - {members.map((id) => { - const info = people[id] ?? {}; - return ; - })} - - > - ); +const sponsors = ["hf", "stability", "redmond", "wandb"] as const; + +const rootProps = { + bg: "transparent", + borderRadius: 0, }; export const InferencePoweredBy = () => { return ( - <> - - - > + + {sponsors.map((id) => ( + + + + ))} + + Sponsored By + + ); }; diff --git a/website/src/components/Header/Header.tsx b/website/src/components/Header/Header.tsx index cb5c09d668..ac86465a50 100644 --- a/website/src/components/Header/Header.tsx +++ b/website/src/components/Header/Header.tsx @@ -33,11 +33,11 @@ function AccountButton() { export const HEADER_HEIGHT = "82px"; -export type HeaderProps = { preLogoSlot?: ReactNode }; +export type HeaderProps = { preLogoSlot?: ReactNode; fixed?: boolean }; const ANNOUNCEMENT_CACHE_KEY = "announcement"; -export function Header({ preLogoSlot }: HeaderProps) { +export function Header({ preLogoSlot, fixed = true }: HeaderProps) { const { t } = useTranslation(); const { data: session } = useSession(); const homeURL = session ? "/dashboard" : "/"; @@ -66,7 +66,7 @@ export function Header({ preLogoSlot }: HeaderProps) { {initialShowAnnouncement && showAnnouncement && ( - diff --git a/website/src/components/Layout/ChatLayout.tsx b/website/src/components/Layout/ChatLayout.tsx index cba158ccac..e59341ea71 100644 --- a/website/src/components/Layout/ChatLayout.tsx +++ b/website/src/components/Layout/ChatLayout.tsx @@ -1,33 +1,38 @@ -import { Box, Flex } from "@chakra-ui/react"; +import { Flex } from "@chakra-ui/react"; import { ChatListDesktop } from "../Chat/ChatListDesktop"; import { ChatListMobile } from "../Chat/ChatListMobile"; -import { SlimFooter } from "../Dashboard/SlimFooter"; -import { HeaderLayout } from "../Header/Header"; +import { Header } from "../Header/Header"; import { getDashBoardLayoutSidebarItem } from "../Layout"; -import { SideMenuLayout } from "../SideMenuLayout"; +import { SideMenuItem } from "../SideMenu"; import { ToSWrapper } from "../ToSWrapper"; export const getChatLayout = (page: React.ReactElement) => ( - }> + + }> - - - - - {page} - - - - + + + {getDashBoardLayoutSidebarItem().map((item) => ( + + ))} - + + {page} + - + ); diff --git a/website/src/components/Messages/BaseMessageEntry.tsx b/website/src/components/Messages/BaseMessageEntry.tsx index c694c21e7e..c620194e0b 100644 --- a/website/src/components/Messages/BaseMessageEntry.tsx +++ b/website/src/components/Messages/BaseMessageEntry.tsx @@ -10,10 +10,11 @@ export type BaseMessageEntryProps = StrictOmit; bg?: string; highlight?: boolean; + containerProps?: BoxProps; }; export const BaseMessageEntry = forwardRef(function BaseMessageEntry( - { content, avatarProps, children, highlight, ...props }, + { content, avatarProps, children, highlight, containerProps, ...props }, ref ) { const bg = useColorModeValue("#DFE8F1", "#42536B"); @@ -33,6 +34,7 @@ export const BaseMessageEntry = forwardRef - {items.map((item) => { - const label = t(getTypeSafei18nKey(item.labelID)); - return ( - - - - - {label} - - - - ); - })} + {items.map((item) => ( + + ))} ); } + +export const SideMenuItem = ({ + item, + variant = "default", + active, +}: { + item: SideMenuItemType; + variant: "default" | "chat"; + active?: boolean; +}) => { + const isChat = variant === "chat"; + const router = useRouter(); + const { t } = useTranslation(); + const label = t(getTypeSafei18nKey(item.labelID)); + const isActive = active ?? router.pathname === item.pathname; + return ( + + + + + {label} + + + + ); +}; diff --git a/website/src/components/SideMenuLayout.tsx b/website/src/components/SideMenuLayout.tsx index de567896ae..7f1c6397ec 100644 --- a/website/src/components/SideMenuLayout.tsx +++ b/website/src/components/SideMenuLayout.tsx @@ -1,38 +1,31 @@ -import { Box, BoxProps } from "@chakra-ui/react"; +import { Box } from "@chakra-ui/react"; import { PropsWithChildren } from "react"; import { SIDE_MENU_WIDTH, SideMenu, SideMenuProps } from "src/components/SideMenu"; +import { colors } from "src/styles/Theme/colors"; -export const SideMenuLayout = ({ - items, - children, - collapsed, - innerBoxProps, -}: PropsWithChildren & { - innerBoxProps?: BoxProps; -}) => { - const desktopBreakpoint = collapsed ? "lg" : "md"; - +export const SideMenuLayout = ({ items, children }: PropsWithChildren) => { return ( - + {children} diff --git a/website/src/components/TeamMember.tsx b/website/src/components/TeamMember.tsx index e456ccb995..f60a19ee9a 100644 --- a/website/src/components/TeamMember.tsx +++ b/website/src/components/TeamMember.tsx @@ -1,4 +1,4 @@ -import { Avatar, Badge, Box, Flex, Text, useColorModeValue } from "@chakra-ui/react"; +import { Avatar, Badge, Box, Flex, FlexProps, Text, useColorModeValue } from "@chakra-ui/react"; import { Github } from "@icons-pack/react-simple-icons"; import Link from "next/link"; @@ -8,11 +8,13 @@ export interface TeamMemberProps { url?: string; githubURL?: string; title: string; + rootProps?: FlexProps; } -export function TeamMember({ name, url, imageURL, githubURL, title }: TeamMemberProps) { + +export function TeamMember({ name, url, imageURL, githubURL, title, rootProps }: TeamMemberProps) { const contributorBackgroundColor = useColorModeValue("gray.200", "gray.700"); return ( - + diff --git a/website/src/pages/chat/index.tsx b/website/src/pages/chat/index.tsx index baa76f298d..313fdabdbb 100644 --- a/website/src/pages/chat/index.tsx +++ b/website/src/pages/chat/index.tsx @@ -22,7 +22,20 @@ const ChatList = ({ chatResponse }: InferGetServerSidePropsType {t("chat")} - + > ); }; diff --git a/website/src/styles/Theme/index.ts b/website/src/styles/Theme/index.ts index 02f8ebf923..e29225cbf1 100644 --- a/website/src/styles/Theme/index.ts +++ b/website/src/styles/Theme/index.ts @@ -1,5 +1,6 @@ import { type ThemeConfig, extendTheme } from "@chakra-ui/react"; import { Styles } from "@chakra-ui/theme-tools"; +import { Inter } from "@next/font/google"; import { withProse } from "@nikolovlazar/chakra-ui-prose"; import { colors } from "./colors"; @@ -7,7 +8,6 @@ import { badgeTheme } from "./components/Badge"; import { cardTheme } from "./components/Card"; import { containerTheme } from "./components/Container"; import { tableTheme } from "./components/Table"; -import { Inter } from "@next/font/google"; const inter = Inter({ subsets: ["latin"] }); @@ -41,8 +41,6 @@ const styles: Styles = { global: (props) => ({ "*": { transition: "background-color 200ms cubic-bezier(0.4, 0, 1, 1)", - // bg: props.colorMode === "light" ? colors.light.bg : colors.dark.bg, - // color: props.colorMode === "light" ? colors.light.text : colors.dark.text, }, ".oa-basic-theme": { bg: props.colorMode === "light" ? colors.light.bg : colors.dark.bg, @@ -50,7 +48,9 @@ const styles: Styles = { }, body: { position: "relative", - bg: props.colorMode === "light" ? "gray.100" : colors.dark.bg, + }, + ".simplebar-scrollbar::before": { + bg: props.colorMode === "light" ? "gray.300" : "gray.500", }, }), }; diff --git a/website/src/utils/chat.ts b/website/src/utils/chat.ts index b17d3a769b..ed0fdc364c 100644 --- a/website/src/utils/chat.ts +++ b/website/src/utils/chat.ts @@ -8,13 +8,12 @@ export const setConfigCache = (config: ChatConfigFormData) => { } }; -export const getConfigCache = () => { +export const getConfigCache = (): ChatConfigFormData | null => { if (typeof localStorage !== "undefined") { const oldConfig = localStorage.getItem(CHAT_CONFIG_KEY); if (oldConfig) { return JSON.parse(oldConfig); } - return null; } return null; };