From cb4148fc500aaa7e7421e1780cce1497a111c124 Mon Sep 17 00:00:00 2001 From: Mamadou DICKO <63923024+mamadoudicko@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:33:59 +0100 Subject: [PATCH] feat: add default feed button label (#1892) Demo: https://github.com/StanGirard/quivr/assets/63923024/c25e5892-be59-47ed-b1ea-8ce6bcc50214 --- .../FeedCardTrigger/hooks/useFeedCardTrigger.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/FeedCardTrigger/hooks/useFeedCardTrigger.ts b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/FeedCardTrigger/hooks/useFeedCardTrigger.ts index 0df9cb79e..0c27a468d 100644 --- a/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/FeedCardTrigger/hooks/useFeedCardTrigger.ts +++ b/frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/ActionsModal/components/FeedCardTrigger/hooks/useFeedCardTrigger.ts @@ -1,4 +1,5 @@ -import { Fragment } from "react"; +import { useTranslation } from "react-i18next"; +import { LuFilePlus } from "react-icons/lu"; import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext"; @@ -6,15 +7,21 @@ import { useFeedCardTriggerUtils } from "./useFeedCardTriggerUtils"; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const useFeedCardTrigger = () => { + const { t } = useTranslation(["chat", "brain"]); + + const feedCardButtonDefaultLabel = t("chat:add_document"); + const feedCardButtonDefaultIcon = LuFilePlus; const { brainTypeToIcon, brainTypeToLabel } = useFeedCardTriggerUtils(); const { currentBrain } = useBrainContext(); const isBrainTypeDefined = currentBrain?.brain_type !== undefined; return { - label: isBrainTypeDefined ? brainTypeToLabel[currentBrain.brain_type] : "", + label: isBrainTypeDefined + ? brainTypeToLabel[currentBrain.brain_type] + : feedCardButtonDefaultLabel, Icon: isBrainTypeDefined ? brainTypeToIcon[currentBrain.brain_type] - : Fragment, + : feedCardButtonDefaultIcon, }; };