From b7a081e94f73a181d7b425b4194af1b44f9df6fd Mon Sep 17 00:00:00 2001 From: Antoine Dewez <44063631+Zewed@users.noreply.github.com> Date: Wed, 28 Aug 2024 02:30:48 +0200 Subject: [PATCH] feat(frontend): interaction with brain items (#3106) # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate): --- .../MentionItem/MentionItem.module.scss | 6 +- .../BrainButton/BrainButton.module.scss | 53 ++++++++++++------ .../BrainsList/BrainButton/BrainButton.tsx | 56 +++++++++++++------ .../BrainItem/BrainItem.module.scss | 14 +++-- .../BrainsList/BrainItem/BrainItem.tsx | 41 +++++++++++--- .../KnowledgeTab/KnowledgeTab.module.scss | 7 +++ .../components/KnowledgeTab/KnowledgeTab.tsx | 18 +++--- frontend/app/studio/[brainId]/page.tsx | 13 +++++ .../CurrentBrain/CurrentBrain.module.scss | 6 +- .../PageHeader/PageHeader.module.scss | 2 +- frontend/lib/components/ui/Icon/Icon.tsx | 30 +++++++--- .../ui/OptionsModal/OptionsModal.tsx | 1 + .../ui/QuivrButton/QuivrButton.module.scss | 6 ++ .../components/ui/QuivrButton/QuivrButton.tsx | 3 +- frontend/lib/helpers/iconList.ts | 8 +-- frontend/lib/types/QuivrButton.ts | 2 +- 16 files changed, 191 insertions(+), 75 deletions(-) diff --git a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatEditor/Editor/MentionsList/MentionItem/MentionItem.module.scss b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatEditor/Editor/MentionsList/MentionItem/MentionItem.module.scss index 96b5b326c7cc..1b6b98ad95da 100644 --- a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatEditor/Editor/MentionsList/MentionItem/MentionItem.module.scss +++ b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ChatEditor/Editor/MentionsList/MentionItem/MentionItem.module.scss @@ -25,8 +25,10 @@ } .brain_snippet { - width: 18px; - height: 18px; + min-width: 18px; + min-height: 18px; + max-width: 18px; + max-height: 18px; border-radius: Radius.$normal; display: flex; justify-content: center; diff --git a/frontend/app/search/BrainsList/BrainButton/BrainButton.module.scss b/frontend/app/search/BrainsList/BrainButton/BrainButton.module.scss index e368cee65b6f..151b7aa382c6 100644 --- a/frontend/app/search/BrainsList/BrainButton/BrainButton.module.scss +++ b/frontend/app/search/BrainsList/BrainButton/BrainButton.module.scss @@ -5,7 +5,7 @@ .brain_button_container { display: flex; - padding: Spacings.$spacing03; + padding: Spacings.$spacing04; border: 1px solid var(--border-0); border-radius: Radius.$normal; cursor: pointer; @@ -19,30 +19,47 @@ border-color: var(--primary-0); } + &.not_hovered { + &:hover { + border-color: var(--border-0); + } + } + .header { display: flex; - gap: Spacings.$spacing03; + gap: Spacings.$spacing05; width: 100%; align-items: center; + overflow: hidden; + justify-content: space-between; - .brain_image { - border-radius: Radius.$normal; - } - - .name { - @include Typography.EllipsisOverflow; - font-size: Typography.$small; - font-weight: 500; - } - - .brain_snippet { - width: 24px; - height: 24px; - border-radius: Radius.$normal; + .left { display: flex; - justify-content: center; + gap: Spacings.$spacing03; align-items: center; - font-size: Typography.$tiny; + overflow: hidden; + + .brain_image { + border-radius: Radius.$normal; + } + + .name { + @include Typography.EllipsisOverflow; + font-size: Typography.$small; + font-weight: 500; + } + + .brain_snippet { + min-width: 24px; + min-height: 24px; + max-width: 24px; + max-height: 24px; + border-radius: Radius.$normal; + display: flex; + justify-content: center; + align-items: center; + font-size: Typography.$tiny; + } } } diff --git a/frontend/app/search/BrainsList/BrainButton/BrainButton.tsx b/frontend/app/search/BrainsList/BrainButton/BrainButton.tsx index e0024bfa969b..6e4bccb9163b 100644 --- a/frontend/app/search/BrainsList/BrainButton/BrainButton.tsx +++ b/frontend/app/search/BrainsList/BrainButton/BrainButton.tsx @@ -2,7 +2,9 @@ import { UUID } from "crypto"; import Image from "next/image"; +import { useState } from "react"; +import { Icon } from "@/lib/components/ui/Icon/Icon"; import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext"; import { BrainType } from "@/lib/types/BrainConfig"; @@ -28,36 +30,58 @@ const BrainButton = ({ brainOrModel, newBrain, }: BrainButtonProps): JSX.Element => { + const [optionsHovered, setOptionsHovered] = useState(false); const { setCurrentBrainId } = useBrainContext(); return (