mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-23 12:26:03 +03:00
feat: add default feed button label (#1892)
Demo: https://github.com/StanGirard/quivr/assets/63923024/c25e5892-be59-47ed-b1ea-8ce6bcc50214
This commit is contained in:
parent
bc2b012e47
commit
cb4148fc50
@ -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,
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user